About pydantic-mcp
pydantic-mcp adapts MCP server tools into Pydantic AI tool instances for applications using Pydantic AI. Its README notes that PydanticAI now includes MCP server support and recommends using that instead.
Key features
- 01Load MCP tools into Pydantic AI
- 02Use tools from an MCP ClientSession
Use cases
- 01Making MCP server tools available to Pydantic AI
- 02Running the included file-reading demo
MCP support
It connects through an MCP ClientSession, retrieves the supported server tools, and exposes them as pydantic_ai.Tool instances.
Details
From the project READMEpydantic-mcp
PydanticAI now includes support for MCP servers, use that instead
Model Context Protocol tool calling support for Pydantic AI.
Just create an mcp.ClientSession and call tools = await mcptools(session)
to get a list of pydantic_ai.Tool instances for the supported tools.
Example:
Demo
You can run the demo against Groq llama-3.1-8b-instant:
$ export GROQ_API_KEY=xxx
$ uv run tests/demo.py "Read and summarize the file ./LICENSE"
Secure MCP Filesystem Server running on stdio
Allowed directories: [ '/users/aw/projects/rectalogic/pydantic-mcp' ]
The file ./LICENSE is a MIT License agreement. It states that the software is provided "as is" without warranty and that the authors and copyright holders are not liable for any claims, damages, or other liability arising from the software or its use.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.