Mcp_proxy_pydantic_agent
Example for exposing MCP servers to Pydantic Agents
Overview
Mcp_proxy_pydantic_agent is a project that demonstrates how to integrate Model Context Protocol (MCP) servers with Pydantic.AI, allowing for seamless interaction between different language models.
To use this project, clone the repository, synchronize the environment using the 'uv' package manager, and run the client script to start interacting with the MCP servers.
- Integration of MCP servers with Pydantic.AI - Demonstration using multiple language models (gpt-4o and sonnet) - Example interactions with the server for real-time queries
- Querying real-time information like weather and time across different locations.
- Demonstrating the capabilities of Pydantic.AI in handling language model interactions.
- Educational purposes for understanding MCP and Pydantic integration.
Add to your AI client
Use these steps to connect Mcp_proxy_pydantic_agent in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"mcp-proxy-pydantic-agent-p2c2e": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-proxy-pydantic-agent-p2c2e"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"mcp-proxy-pydantic-agent-p2c2e": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-proxy-pydantic-agent-p2c2e"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"mcp-proxy-pydantic-agent-p2c2e": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-proxy-pydantic-agent-p2c2e"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"mcp-proxy-pydantic-agent-p2c2e": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-proxy-pydantic-agent-p2c2e"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mcp-proxy-pydantic-agent-p2c2e": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-proxy-pydantic-agent-p2c2e"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mcp-proxy-pydantic-agent-p2c2e": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-proxy-pydantic-agent-p2c2e"
]
}
}
}FAQ
What do I need to run this project?
You need to clone the repository, have the 'uv' package manager installed, and set your OpenAI and Anthropic API keys.
Can I modify the code for my own models?
Yes! You can modify the code to suit your specific models and requirements.
Is there any documentation available?
Yes, the project includes references to additional resources for further understanding.