Pydantic Resolve
build declarative and ai native application from day 1
What is Pydantic Resolve?
Pydantic Resolve is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to build declarative and ai native application from day 1
build declarative and ai native application from day 1
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- build declarative and ai native application from day 1
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx pydantic-resolveConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Pydantic Resolve
Pydantic Resolve is a Python framework that simplifies building declarative, AI-native data layers by automatically batching and resolving nested relational data through Pydantic v2 models. Its MCP integration — available via pip install pydantic-resolve[mcp] — lets developers expose their entity relationship diagram as an MCP server with a single create_mcp_server() call, allowing AI agents to traverse complex data graphs (users, posts, comments, tasks) using natural language without writing one-off query endpoints. It is particularly useful for full-stack Python applications using FastAPI, GraphQL, or async ORMs where N+1 query problems and scattered data-fetching logic are common pain points.
Prerequisites
- Python 3.10 or higher
- Pydantic v2 installed
- pip for installing pydantic-resolve and the optional mcp extra
- An MCP-compatible client such as Claude Desktop (for the MCP server feature)
Install pydantic-resolve with MCP support
Install the base package plus the mcp extra, which adds the create_mcp_server() helper and the MCP SDK dependency.
pip install pydantic-resolve
pip install "pydantic-resolve[mcp]"Define your entity models with resolve_ methods
Create Pydantic models with resolve_ methods that load related data. Pydantic Resolve automatically batches these into efficient bulk queries to avoid N+1 problems.
from pydantic import BaseModel
from pydantic_resolve import Loader
from typing import Optional
async def user_loader(user_ids: list[int]):
# batch fetch users by id
return {uid: await fetch_user(uid) for uid in user_ids}
class TaskView(BaseModel):
id: int
owner_id: int
owner: Optional[dict] = None
def resolve_owner(self, loader=Loader(user_loader)):
return loader.load(self.owner_id)Expose your data graph as an MCP server
Use create_mcp_server() with your entity relationship diagram to spin up an MCP server. AI agents can then query your data graph through the MCP protocol.
from pydantic_resolve import AppConfig, create_mcp_server
mcp = create_mcp_server(apps=[AppConfig(name="blog", er_diagram=diagram)])
mcp.run()Configure Claude Desktop to connect to the MCP server
Add the pydantic-resolve MCP server to your claude_desktop_config.json. Since it is a Python script, use the Python binary from your virtual environment.
{
"mcpServers": {
"pydantic-resolve": {
"command": "/path/to/venv/bin/python",
"args": ["/path/to/your/mcp_server.py"]
}
}
}Resolve nested data in your application code
Use the Resolver class to trigger batch resolution of nested models. This is the core usage pattern outside of the MCP context, for building BFF (backend for frontend) APIs.
from pydantic_resolve import Resolver
tasks = [TaskView(id=1, owner_id=42), TaskView(id=2, owner_id=43)]
resolved = await Resolver().resolve(tasks)
# owner field is populated via batched loaderPydantic Resolve Examples
Client configuration
Claude Desktop configuration pointing to a pydantic-resolve MCP server script in a local Python virtual environment.
{
"mcpServers": {
"pydantic-resolve": {
"command": "/Users/yourname/myproject/venv/bin/python",
"args": ["/Users/yourname/myproject/mcp_server.py"]
}
}
}Prompts to try
Example prompts for an MCP server built with pydantic-resolve exposing a blog entity relationship diagram.
- "List all blog posts by user Alice including the comment count on each post."
- "Show me the top 5 most commented posts and their authors."
- "Get all tasks assigned to user ID 42 along with their sprint and project details."
- "List all posts published in the last 30 days with their tags."
- "Show me all users who have commented more than 10 times this month."Troubleshooting Pydantic Resolve
ImportError: cannot import name 'create_mcp_server' from 'pydantic_resolve'
You need the mcp extra: run pip install "pydantic-resolve[mcp]". The create_mcp_server function is only available when the MCP SDK is installed alongside the base package.
N+1 queries still occurring despite using Loader
Ensure your loader function accepts a list of ids and returns results for all of them in a single batch call. If each loader call only fetches one record, the batching is not being triggered — verify you are using Loader(your_loader_fn) not calling the function directly.
Pydantic v1 compatibility errors
Pydantic Resolve v5+ requires Pydantic v2. Run pip install "pydantic>=2.0" to upgrade. If your project depends on Pydantic v1, consider pinning to an older version of pydantic-resolve compatible with v1, or migrate your models to v2 syntax.
Frequently Asked Questions about Pydantic Resolve
What is Pydantic Resolve?
Pydantic Resolve is a Model Context Protocol (MCP) server that build declarative and ai native application from day 1 It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Pydantic Resolve?
Follow the installation instructions on the Pydantic Resolve GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Pydantic Resolve?
Pydantic Resolve works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Pydantic Resolve free to use?
Yes, Pydantic Resolve is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Pydantic Resolve Alternatives — Similar Developer Tools Servers
Looking for alternatives to Pydantic Resolve? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Pydantic Resolve in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Pydantic Resolve?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.