Sponsored by Deepsite.site

Model Context Protocol (MCP) Agent Frameworks Demo

Created By
andrewginns8 months ago
Repo for demonstrating simple Model Context Protocol (MCP) server with several Agent Frameworks
Content

Model Context Protocol (MCP) Agent Frameworks Demo

This repository demonstrates the usage of Model Context Protocol (MCP) servers with several frameworks:

  • Google Agent Development Toolkit (ADK)
  • LangGraph Agents
  • OpenAI Agents
  • Pydantic-AI Agents

Included MCP Server is based on MCP Python SDK Quickstart

  • Modified to include a datetime tool and run as a server invoked by Agents

Tracing is done through Pydantic Logfire.

MCP Concept

Quickstart

cp .env.example .env

  • Add GEMINI_API_KEY and/or OPENAI_API_KEY
  • [Optional] Add LOGFIRE_TOKEN to visualise evaluations in Logfire web ui

Run an Agent framework script e.g.:

  • uv run basic_mcp_use/pydantic_mcp.py - Requires GEMINI_API_KEY by default

  • uv run basic_mcp_use/oai-agent_mcp.py - Requires OPENAI_API_KEY by default

Check console or Logfire for output

Project Overview

This project aims to teach:

  1. How to use MCP with multiple LLM Agent frameworks
    • Single MCP server usage and Multi-MCP server usage
  2. How to see traces LLM Agents with Logfire
  3. How to evaluate LLMs with PydanticAI evals

Logfire UI

Repository Structure

  • agents_mcp_usage/basic_mcp/basic_mcp_use/ - Contains basic examples of single MCP usage:

    • adk_mcp.py - Example of using MCP with Google's Agent Development Kit (ADK)
    • langgraph_mcp.py - Example of using MCP with LangGraph
    • oai-agent_mcp.py - Example of using MCP with OpenAI Agents
    • pydantic_mcp.py - Example of using MCP with Pydantic-AI
  • agents_mcp_usage/basic_mcp/eval_basic_mcp_use/ - Contains evaluation examples for single MCP usage:

    • evals_adk_mcp.py - Evaluation of MCP with Google's ADK
    • evals_langchain_mcp.py - Evaluation of MCP with LangGraph
    • evals_pydantic_mcp.py - Evaluation of MCP with Pydantic-AI
  • agents_mcp_usage/multi_mcp/ - Contains advanced examples of multi-MCP usage:

    • multi_mcp_use/pydantic_mcp.py - Example of using multiple MCP servers with Pydantic-AI
    • eval_multi_mcp/evals_pydantic_mcp.py - Example of evaluating the use of multiple MCP servers with Pydantic-AI
    • mermaid_diagrams.py - Generates Mermaid diagrams for visualizing MCP architecture
  • Demo Python MCP Server

    • run_server.py - Simple MCP server that runs locally, implemented in Python

What is MCP?

The Model Context Protocol allows applications to provide context for LLMs in a standardised way, separating the concerns of providing context from the actual LLM interaction.

Learn more: https://modelcontextprotocol.io/introduction

Why MCP

By defining clear specifications for components like resources (data exposure), prompts (reusable templates), tools (actions), and sampling (completions), MCP simplifies the development process and fosters consistency.

A key advantage highlighted is flexibility; MCP allows developers to more easily switch between different LLM providers without needing to completely overhaul their tool and data integrations. It provides a structured approach, potentially reducing the complexity often associated with custom tool implementations for different models. While frameworks like Google Agent Development Kit, LangGraph, OpenAI Agents, or libraries like PydanticAI facilitate agent building, MCP focuses specifically on standardising the interface between the agent's reasoning (the LLM) and its capabilities (tools and data), aiming to create a more interoperable ecosystem.

Setup Instructions

  1. Clone this repository
  2. Install required packages:
    make install
    
  3. Set up your environment variables in a .env file:
    LOGFIRE_TOKEN=your_logfire_token
    GEMINI_API_KEY=your_gemini_api_key
    OPENAI_API_KEY=your_openai_api_key
    
  4. Run any of the sample scripts to see a simple MCP server being used via an Agent framework

About Logfire

Logfire is an observability platform from the team behind Pydantic that makes monitoring AI applications straightforward. Features include:

  • Simple yet powerful dashboard
  • Python-centric insights, including rich display of Python objects
  • SQL-based querying of your application data
  • OpenTelemetry support for leveraging existing tooling
  • Pydantic integration for analytics on validations

Logfire gives you visibility into how your code is running, which is especially valuable for LLM applications where understanding model behavior is critical.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
WindsurfThe new purpose-built IDE to harness magic
Amap Maps高德地图官方 MCP Server
DeepChatYour AI Partner on Desktop
Serper MCP ServerA Serper MCP Server
CursorThe AI Code Editor
Playwright McpPlaywright MCP server
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Tavily Mcp
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
ChatWiseThe second fastest AI chatbot™