Skip to content

Model Context Protocol (MCP)

Pydantic AI supports Model Context Protocol (MCP) in two ways:

  1. Agents act as an MCP Client, connecting to MCP servers to use their tools, learn more …
  2. Agents can be used within MCP servers, learn more …

What is MCP?

The Model Context Protocol is a standardized protocol that allow AI applications (including programmatic agents like Pydantic AI, coding agents like cursor, and desktop applications like Claude Desktop) to connect to external tools and services using a common interface.

As with other protocols, the dream of MCP is that a wide range of applications can speak to each other without the need for specific integrations.

There is a great list of MCP servers at github.com/modelcontextprotocol/servers.

Some examples of what this means:

  • Pydantic AI could use a web search service implemented as an MCP server to implement a deep research agent
  • Cursor could connect to the Pydantic Logfire MCP server to search logs, traces and metrics to gain context while fixing a bug
  • Pydantic AI, or any other MCP client could connect to our Run Python MCP server to run arbitrary Python code in a sandboxed environment