Skip to main content
Pass an MCP connection through Agent(mcp_servers=[...]). Pydantic AI provides the client integration through MCPToolset.

HTTP servers

Use MCPToolset for an HTTP MCP server:
The server must already be running.

Subprocess servers

Pass a FastMCP StdioTransport to MCPToolset to start a server as a subprocess:
The subprocess receives PATH, HOME, and the variables in env. See Pydantic AI’s MCP client documentation.

In-process FastMCP

Install the optional server package:
A Thread context keeps managed server connections available across calls and closes them on exit. See threads.