MCP ExplorerExplorer

Pydantic Mcp

@rectalogicon a year ago
9 MIT
FreeCommunity
AI Systems
Model Context Protocol tool calling support for Pydantic AI

Overview

What is Pydantic Mcp

pydantic-mcp is a tool that provides support for calling Model Context Protocol (MCP) servers within the Pydantic AI framework.

Use cases

Use cases for pydantic-mcp include summarizing documents, data processing tasks, and any application that requires leveraging the capabilities of Pydantic AI in conjunction with MCP servers.

How to use

To use pydantic-mcp, create an mcp.ClientSession and call tools = await mcptools(session) to retrieve a list of pydantic_ai.Tool instances for the supported tools.

Key features

Key features include seamless integration with Pydantic AI, support for MCP servers, and the ability to easily retrieve and utilize various tools through a simple client session.

Where to use

pydantic-mcp can be used in AI applications that require interaction with MCP servers, particularly in scenarios involving model context management and tool invocation.

Content

pydantic-mcp

PydanticAI now includes support for MCP servers, use that instead

PyPI - Version

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:

https://github.com/rectalogic/pydantic-mcp/blob/98c4e9abf31837cb48ebeb3eae6cb55b16c841e8/tests/demo.py#L15-L25

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.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers