PydanticAI
PydanticAI has native MCP support via MCPServerStreamableHTTP. AllMCP works as a drop-in server.
Install
Section titled “Install”pip install 'pydantic-ai-slim[mcp]'Minimal example
Section titled “Minimal example”import asynciofrom pydantic_ai import Agentfrom pydantic_ai.mcp import MCPServerStreamableHTTP
allmcp = MCPServerStreamableHTTP( url="https://go.allmcp.co/mcp/", headers={"X-API-Key": "YOUR_API_KEY"},)
agent = Agent( "anthropic:claude-sonnet-4-6", toolsets=[allmcp],)
async def main(): async with agent: result = await agent.run("List all open deals in my CRM") print(result.output)
asyncio.run(main())Multi-user setup
Section titled “Multi-user setup”def make_agent(user_id: str) -> Agent: server = MCPServerStreamableHTTP( url=f"https://go.allmcp.co/mcp/?user_id={user_id}", headers={"X-API-Key": "YOUR_API_KEY"}, ) return Agent("anthropic:claude-sonnet-4-6", toolsets=[server])
async def handle_request(user_id: str, prompt: str) -> str: agent = make_agent(user_id) async with agent: result = await agent.run(prompt) return result.outputStreaming
Section titled “Streaming”PydanticAI supports streaming with MCP tools:
async def stream_response(): async with agent: async with agent.run_stream("Summarize my top 5 leads") as response: async for chunk in response.stream_text(): print(chunk, end="", flush=True)With a system prompt
Section titled “With a system prompt”agent = Agent( "anthropic:claude-sonnet-4-6", toolsets=[allmcp], system_prompt=( "You are a CRM assistant. When the user asks about contacts or deals, " "use the Bitrix24 tools. Always confirm before creating or updating records." ),)Multi-provider setup
Section titled “Multi-provider setup”Connect tools from AllMCP alongside other MCP servers:
from pydantic_ai.mcp import MCPServerStreamableHTTP
agent = Agent( "anthropic:claude-sonnet-4-6", toolsets=[ MCPServerStreamableHTTP( url="https://go.allmcp.co/mcp/", headers={"X-API-Key": "YOUR_ALLMCP_KEY"}, ), MCPServerStreamableHTTP(url="https://other-mcp-server.com"), ],)Next steps
Section titled “Next steps” Browse providers See every app you can connect and the tools each one exposes.