能力标签
Pydantic Resolve
🔌
MCP工具

Pydantic Resolve

基于 Python · 让 AI 助手直接操作你的系统与工具
英文名:pydantic-resolve
⭐ 326 Stars 🍴 13 Forks 💻 Python 📄 MIT 🏷 AI 8.0分
8.0AI 综合评分
bfffastapifullstackgraphqlmcppython
✦ AI Skill Hub 推荐

经 AI Skill Hub 精选评估,Pydantic Resolve 获评「强烈推荐」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.0 分,适合有一定技术背景的用户使用。

📚 深度解析

Pydantic Resolve 是一款基于 MCP(Model Context Protocol)标准协议的 AI 工具扩展。MCP 协议由 Anthropic 开发并开源,旨在建立 AI 模型与外部工具之间的标准化通信接口,目前已被 Claude Desktop、Claude Code、Cursor 等主流 AI 工具采纳。

通过安装 Pydantic Resolve,你的 AI 助手将获得额外的工具调用能力,可以用自然语言直接操控该工具的功能,无需学习复杂的命令行语法。MCP 工具的核心价值在于"一次配置,永久增强"——配置完成后,每次与 AI 对话时都可以无缝调用这些工具。

在技术实现上,MCP 工具通过标准的 JSON-RPC 协议与 AI 客户端通信,工具的功能以"工具列表"的形式暴露给 AI 模型,AI 可以按需调用。Pydantic Resolve 提供了结构化的工具调用接口,使 AI 模型能够精确地理解和使用每个功能点,显著降低 AI 在工具使用上的错误率。

与传统的 API 集成相比,MCP 工具的优势在于无需编写代码——用户只需在配置文件中添加几行 JSON,即可让 AI 获得全新能力。AI Skill Hub 将 Pydantic Resolve 评为 AI 评分 8.0 分,属于同类工具中的优质选择。

📋 工具概览

Python实现的MCP工具,提供清晰的架构设计

Pydantic Resolve 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。

GitHub Stars
⭐ 326
开发语言
Python
支持平台
Windows / macOS / Linux
维护状态
轻量级项目,按需更新
开源协议
MIT
AI 综合评分
8.0 分
工具类型
MCP工具
Forks
13

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

Python实现的MCP工具,提供清晰的架构设计

Pydantic Resolve 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。

📌 核心特色
  • 通过标准 MCP 协议与 Claude、Cursor 等主流 AI 客户端深度集成
  • 提供结构化工具调用接口,显著降低 AI 集成复杂度
  • 支持 Claude Desktop 和 Claude Code 无缝接入,开箱即用
  • 可与其他 MCP 工具组合叠加,构建完整 AI 工作站
  • 轻量无侵入设计,不影响现有系统架构
🎯 主要使用场景
  • 在 Claude Desktop 对话中直接调用本地工具,实现 AI 与系统的深度联动
  • 通过自然语言驱动复杂的多步骤自动化任务,代替繁琐手动操作
  • 将多个 MCP 工具组合使用,构建个人专属 AI 工作站
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/KLR-Pattern/pydantic-resolve

# 方式二:手动配置 claude_desktop_config.json
{
  "mcpServers": {
    "pydantic-resolve": {
      "command": "npx",
      "args": ["-y", "pydantic-resolve"]
    }
  }
}

# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
📋 安装步骤说明
  1. 确认已安装 Node.js(v18 或以上版本)
  2. 打开 Claude Desktop 或 Claude Code 的 MCP 配置文件
  3. 按「交给 Agent 安装 → Claude Desktop」标签中的 JSON 配置填入 mcpServers 字段
  4. 保存配置文件并重启 Claude 客户端
  5. 重启后,在对话中即可使用本工具
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 安装后在 Claude 对话中直接使用
# 示例:
用户: 请帮我用 Pydantic Resolve 执行以下任务...
Claude: [自动调用 Pydantic Resolve MCP 工具处理请求]

# 查看可用工具列表
# 在 Claude 中输入:"列出所有可用的 MCP 工具"
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
// claude_desktop_config.json 配置示例
{
  "mcpServers": {
    "pydantic_resolve": {
      "command": "npx",
      "args": ["-y", "pydantic-resolve"],
      "env": {
        // "API_KEY": "your-api-key-here"
      }
    }
  }
}

// 保存后重启 Claude Desktop 生效
📑 README 深度解析 真实文档 完整度 69/100 含工作流图 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

Pydantic Resolve

A progressive data-assembly framework for Python in Clean Architecture style — adopt each layer as you need it.

pypi PyPI Downloads Python Versions CI

中文版

Requirements: Python 3.10+, Pydantic v2

---

Install

pip install pydantic-resolve
pip install pydantic-resolve[mcp]  # with MCP support

Quick Start

The Example

Throughout the Quick Start, we build one API:

  • Sprint has many Task
  • Task has one owner (a User)
  • The API also needs derived fields like task_count and contributors

Each step adds one concept on top of the previous code.

The Same Example in ERD Mode

from typing import Optional

from pydantic import BaseModel
from pydantic_resolve import Relationship, base_entity, config_global_resolver


BaseEntity = base_entity()


class UserEntity(BaseModel, BaseEntity):
    id: int
    name: str


class TaskEntity(BaseModel, BaseEntity):
    __relationships__ = [
        Relationship(fk='owner_id', name='owner', target=UserEntity, loader=user_loader)
    ]
    id: int
    title: str
    owner_id: int


class SprintEntity(BaseModel, BaseEntity):
    __relationships__ = [
        Relationship(fk='id', name='tasks', target=list[TaskEntity], loader=task_loader)
    ]
    id: int
    name: str


diagram = BaseEntity.get_diagram()
AutoLoad = diagram.create_auto_load()
config_global_resolver(diagram)


class TaskView(TaskEntity):
    # Field name matches Relationship(name='owner') → AutoLoad is implicit
    owner: Optional[UserEntity] = None


class SprintView(SprintEntity):
    # Field name matches Relationship(name='tasks') → AutoLoad is implicit
    tasks: list[TaskView] = []
    task_count: int = 0

    def post_task_count(self):
        return len(self.tasks)

Compared with the Core API version:

  • resolve_owner disappears.
  • resolve_tasks disappears.
  • The relationship definitions live in one place.
  • post_* still works exactly the same.
  • When a View field's name matches a relationship name, Annotated[..., AutoLoad()] is optional (implicit AutoLoad). Use the explicit form only when the field name differs from the relationship name.

If you want to hide internal FK fields such as owner_id, add DefineSubset on top of the ERD setup:

from pydantic_resolve import DefineSubset


class TaskSummary(DefineSubset):
    __subset__ = (TaskEntity, ('id', 'title'))
    owner: Optional[UserEntity] = None  # implicit AutoLoad

GraphQL — from UseCase Services

Compose GraphQL queries over UseCaseService classes — the API surface is a set of business operations, not a graph of entities:

from pydantic_resolve import query
from pydantic_resolve.use_case import UseCaseService
from pydantic_resolve.use_case.manager import UseCaseAppConfig, UseCaseManager


class UserService(UseCaseService):
    """User management."""

    @query
    async def list_users(cls) -> list[UserSummary]:
        """Get all users."""
        ...


manager = UseCaseManager(
    apps=[UseCaseAppConfig(name="blog", services=[UserService])]
)
app = manager.get_app("blog")
result = await app.compose("{ listUsers { id name } }")

Use this when the API is operation-first (RPC-style) rather than entity-graph-first.

MCP — from UseCase Services

Expose UseCase operations to AI agents via the same compose surface:

from pydantic_resolve.use_case import (
    UseCaseAppConfig,
    create_use_case_graphql_mcp_server,
)

mcp = create_use_case_graphql_mcp_server(
    apps=[UseCaseAppConfig(name="blog", services=[UserService, PostService])],
)
mcp.run()

The MCP server uses a 4-layer progressive disclosure (list_appsdescribe_compose_schemadescribe_compose_methodcompose_query) so the agent can discover operations and shape queries without flooding its tool list.

Step 4: Coordinate Parent and Child *(optional)*

When parent and child nodes need to share data without hard-coding references to each other, two helpers cover the two directions.

4a. ExposeAs — parent → child

Send a value from an ancestor down to its descendants.

from typing import Annotated

from pydantic_resolve import ExposeAs


class SprintView(BaseModel):
    id: int
    name: Annotated[str, ExposeAs('sprint_name')]  # visible to all descendants
    tasks: List[TaskView] = []

    def resolve_tasks(self, loader=Loader(task_loader)):
        return loader.load(self.id)


class TaskView(BaseModel):
    id: int
    title: str
    owner_id: int
    owner: Optional[UserView] = None
    full_title: str = ""

    def resolve_owner(self, loader=Loader(user_loader)):
        return loader.load(self.owner_id)

    def post_full_title(self, ancestor_context):
        return f"{ancestor_context['sprint_name']} / {self.title}"

Use this when a child needs context from an ancestor (sprint name, permissions, locale).

4b. SendTo + Collector — child → parent

Aggregate values from many descendants up to one ancestor.

from typing import Annotated

from pydantic_resolve import Collector, SendTo


class SprintView(BaseModel):
    id: int
    name: str
    tasks: List[TaskView] = []
    contributors: list[UserView] = []

    def resolve_tasks(self, loader=Loader(task_loader)):
        return loader.load(self.id)

    def post_contributors(self, collector=Collector('contributors')):
        return collector.values()


class TaskView(BaseModel):
    id: int
    title: str
    owner_id: int
    owner: Annotated[Optional[UserView], SendTo('contributors')] = None

    def resolve_owner(self, loader=Loader(user_loader)):
        return loader.load(self.owner_id)

Use this when a parent needs to aggregate values from many descendants (all contributors, all tags, all attachments).

---

Adoption Path

1. Interface Adapters First

Start with resolve_* and post_* on one endpoint. You gain immediate N+1 protection without changing your architecture.

Frameworks & Integrations

The library exposes your data through two entry points — ERD mode (data-model-first) and UseCase mode (operation-first). Both can power GraphQL, MCP, and admin tools:

flowchart LR entity["Entity + ERD
Enterprise Business Rules"] graphql["GraphQL"] usecase["UseCase Service
business operations"] graphql_uc["GraphQL"] api["REST API"] mcp_uc["MCP Service"] mcp_gen["MCP Service"] entity --> graphql entity --> usecase usecase --> api usecase --> graphql_uc graphql_uc --> mcp_uc graphql --> mcp_gen

Cost vs Benefit

QuestionHand-written Core APIER Diagram + AutoLoad
First endpointFasterSlower
Upfront setupLowMedium
Reusing the same relation in many modelsRepetitiveCentralized
Changing a relationship laterUpdate many resolve_* methodsUpdate one ERD declaration
GraphQL / MCP generationSeparate workNatural extension

ERD mode asks for more discipline up front:

  • Define entity classes.
  • Declare relationships explicitly.
  • Create AutoLoad from the same diagram used by the resolver.

That setup cost is real. The payoff is that relationship knowledge converges into one place — every Response is just a different view of the same Entity graph. The same ERD also powers GraphQL queries, MCP services, and admin tools.

Comparisons

Entity-First (pydantic-resolve) vs ORM-First (traditional FastAPI)

DimensionORM-FirstEntity-First
Type source of truthORM modelEntity (Pydantic)
Relationship wiringRepeated per endpointCentralized in ERD
Data assemblyManual in Service/RouteAutomatic via Resolver
N+1 preventionManual eager loadingBuilt-in DataLoader batching
Multi-data sourceScattered conversion codeUnified Loader interface
API contract stabilityTied to DB schemaIndependent of DB

pydantic-resolve vs GraphQL

FeatureGraphQLpydantic-resolve
**N+1 Prevention**Manual DataLoader setupBuilt-in automatic batching
**Type Safety**Separate schema filesNative Pydantic types
**Learning Curve**Steep (Schema, Resolvers, Loaders)Moderate (Loader/batch pattern required)
**Debugging**Complex introspectionStandard Python debugging
**Integration**Requires dedicated serverWorks with any framework
**Query Flexibility**Any client can query anythingExplicit API contracts
Note: pydantic-resolve borrows the DataLoader batch pattern from GraphQL ecosystems but stays inside your existing REST framework. If you already use strawberry or ariadne and are happy with it, pydantic-resolve may be redundant for you.

---

🇨🇳 中文文档镜像 AI 翻译 2026-06-18
英文原文章节由系统翻译为中文摘要,便于快速理解。完整原文见上方 "📑 README 深度解析"。
📌 简介

pydantic-resolve 是一个专为 Python 设计的整洁架构(Clean Architecture)工具库。它允许开发者定义业务实体并声明它们之间的关系,通过框架自动完成数据的组装。它旨在解决传统开发中手动处理数据关联时产生的复杂性,让你的代码从繁琐的 N+1 查询组装逻辑中解脱出来,实现业务逻辑与数据获取层的优雅分离。

⚡ 功能介绍

该框架的核心优势在于“声明式数据��装”。通过在 Pydantic 模型中定义 resolve 方法,你可以声明哪些字段需要额外加载,而无需在业务逻辑层手动编写复杂的映射和循环。这不仅能有效防止 N+1 查询问题,还能将 Interface Adapter(接口适配器)逻辑内聚在模型中,使 Application Business Rules(应用业务规则)更加纯粹。

🛠 安装步骤(Docker/pip/源码)

你可以通过 pip 轻松安装 pydantic-resolve。基础版本使用 `pip install pydantic-resolve` 即可;如果你的项目需要支持 MCP(Model Context Protocol),请使用 `pip install pydantic-resolve[mcp]` 进行安装。

🚀 使用教程

在 Quick Start 示例中,我们将构建一个包含 Sprint、Task 和 User 关系的 API。通过定义模型关系,框架能够自动处理复杂的嵌套结构(如 Sprint 包含多个 Task,而 Task 关联特定的 User),并支持生成如 task_count 等派生字段。此外,你还可以通过 ERD 模式将关系逻辑从模型中抽离到实体图中,实现更高级的数据建模。

⚙️ 配置说明(含 MCP / env)

项目支持通过 ERD 模式进行关系建模,并提供全局 Resolver 配置。对于需要集成到不同生态系统的开发者,pydantic-resolve 的设计不仅支持 REST API,还能驱动 GraphQL 查询、MCP services 以及各类 Admin 工具,确保配置���一致性与扩展性。

🔌 API 说明

API 设计遵循整洁架构原则。通过使用 `resolve_*` 方法,你可以将模型中缺失的字段(需要从数据库或外部服务获取的数据)定义为 Interface Adapter。这种方式允许你在不改变现有架构的前提下,通过在 Endpoint 上直接应用 resolve 逻辑,快速获得 N+1 查询保护,实现数据填充的自动化。

🎯 aiskill88 AI 点评 A 级 2026-06-06

高质量的Python MCP工具,架构清晰

📚 实用指南(长尾问题)
适合谁
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
  • 跨境业务、多语言内容运营团队
最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • Python 依赖冲突:建议用 venv / uv 隔离环境
部署方案
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台
相关搜索
pydantic-resolve 中文教程pydantic-resolve 安装报错怎么办pydantic-resolve MCP 配置pydantic-resolve Agent 工作流pydantic-resolve 与同类工具对比pydantic-resolve 最佳实践pydantic-resolve 适合谁用

⚡ 核心功能

👥 适合谁
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
  • 跨境业务、多语言内容运营团队
⭐ 最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • Python 依赖冲突:建议用 venv / uv 隔离环境

👥 适合人群

Claude Desktop / Claude Code 用户AI 工具开发者需要扩展 AI 能力的专业人士自动化工程师

🎯 使用场景

  • 在 Claude Desktop 对话中直接调用本地工具,实现 AI 与系统的深度联动
  • 通过自然语言驱动复杂的多步骤自动化任务,代替繁琐手动操作
  • 将多个 MCP 工具组合使用,构建个人专属 AI 工作站

⚖️ 优点与不足

✅ 优点
  • +MIT 协议,可免费商用
  • +标准化 MCP 协议,生态互联性强
  • +与 Claude 官方生态无缝对接
  • +即插即用,配置简单快捷
⚠️ 不足
  • 依赖 Claude 客户端,非 Claude 用户无法使用
  • MCP 协议仍在持续演进,接口可能变更
  • 需要一定的配置步骤
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。

🔗 相关工具推荐

📰 相关 AI 新闻
🍿 AI 圈相关吃瓜
🗺️ 相关解决方案
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合

❓ 常见问题 FAQ

pydantic-resolve 是一款Python开发的AI辅助工具。开源MCP工具:pydantic-resolve is a Pythonic clean architecture implementation。⭐326 · Python 主要应用场景包括:快速构建MCP应用。
💡 AI Skill Hub 点评

AI Skill Hub 点评:Pydantic Resolve 的核心功能完整,质量优秀。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。

⬇️ 获取与下载
⬇ 下载源码 ZIP

✅ MIT 协议 · 可免费商用 · 直接从 aiskill88 服务器下载,无需跳转 GitHub

📚 深入学习 Pydantic Resolve
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 pydantic-resolve
原始描述 开源MCP工具:pydantic-resolve is a Pythonic clean architecture implementation。⭐326 · Python
Topics bfffastapifullstackgraphqlmcppython
GitHub https://github.com/KLR-Pattern/pydantic-resolve
License MIT
语言 Python
🔗 原始来源
🐙 GitHub 仓库  https://github.com/KLR-Pattern/pydantic-resolve 🌐 官方网站  https://klr-pattern.github.io/pydantic-resolve/

收录时间:2026-06-06 · 更新时间:2026-06-06 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。

📺 订阅 AI Skill Hub Daily Telegram 频道
每天 8 条精选 AI Skill、MCP、Agent 与自动化工具推送
加入频道 →