Agent(mcp_servers=[...]). Pydantic AI provides the client integration through MCPToolset.
HTTP servers
UseMCPToolset for an HTTP MCP server:
Subprocess servers
Pass a FastMCPStdioTransport to MCPToolset to start a server as a subprocess:
PATH, HOME, and the variables in env. See Pydantic AI’s MCP client documentation.
In-process FastMCP
Install the optional server package:Thread context keeps managed server connections available across calls and closes them on exit. See threads.