Files
nexus/wiki/sources/specialized-mcp-builder.md
2026-05-03 05:42:12 +08:00

5.2 KiB
Raw Blame History

title, type, tags, date, last_updated
title type tags date last_updated
MCP Builder Agent source
agent-personality
mcp
tool-design
ai-integration
2026-04-20 2026-05-29

Source File

Summary用中文描述

  • 核心主题AI Agent 的 MCPModel Context Protocol服务器开发专家——设计、构建、测试和部署 MCP 服务器,为 AI Agent 提供自定义工具、资源和提示词能力
  • 问题域:如何让 AI Agent 能够可靠地调用外部工具和 API同时保持开发者体验Developer Experience
  • 方法/机制:遵循 MCP SDK 规范TypeScript/Zod、Python/Pydantic设计 Agent 友好的工具接口,提供 Resources资源、Tools工具、Prompts提示词模板三种扩展方式通过真实 Agent 测试验证可用性
  • 结论/价值:工具命名和描述是 Agent 能否正确选用的关键;每个工具调用必须独立无状态;错误必须返回结构化消息而非堆栈跟踪

Key Claims用中文描述

  • 描述性工具命名 → Agent 能从名称推断用途,正确选用率 >90%
  • 类型化参数验证Zod/Pydantic → 边界层拦截非法输入,防止外部 API 污染
  • 结构化错误返回isError: true → Agent 知道何时重试或请求用户,而非虚构响应
  • 无状态工具设计 → 每次调用独立,不依赖调用顺序,确保分布式环境稳定
  • 真实 Agent 测试循环 → 通过完整调用链路验证,而非仅靠单元测试
  • 环境变量密钥管理 → API Key 和 Token 从环境变量读取,绝不硬编码
  • 单一职责工具原则get_userupdate_user 是两个工具,不是一个工具加 mode 参数
  • 可组合服务器架构 → 拆分为单一用途服务器,通过资源共享上下文,通过代理服务器聚合多后端

Key Quotes

"If an agent can't figure out how to use your tool from the name and description alone, it's not ready to ship." — MCP Builder 核心理念 "A tool that passes unit tests but confuses the agent is broken." — 测试理念,强调必须验证 Agent 的完整调用路径 "We return isError: true here so the agent knows to retry or ask the user, instead of hallucinating a response." — 错误处理设计哲学 "Call it search_orders_by_date not query — the agent needs to know what this does from the name alone." — 命名原则

Key Concepts

Key Entities

  • @modelcontextprotocol/sdkAnthropic 官方 MCP TypeScript SDK提供 McpServer、StdioServerTransport 等核心类
  • FastMCPPython MCP 服务器框架,基于 Pydantic 的类型验证
  • ZodTypeScript schema 声明和验证库MCP TypeScript SDK 内置支持
  • PydanticPython 数据验证库FastMCP 的核心依赖

Connections

Contradictions

  • lsp-index-engineer 存在张力:
    • 冲突点LSP 强调确定性分析(代码结构必须精确),而 MCP 服务器面对外部 API 时存在网络抖动、速率限制等不确定性
    • 当前观点MCP Builder 坚持无状态、幂等、Fail-Gracefully 设计,允许优雅降级
    • 对方观点LSP/Index Engineer 需要确定性结果,任何不确定的外部调用应被隔离和重试
    • 协调方案:在 MCP 服务器层面实现重试和熔断机制,结果仍以结构化形式返回给 LSP 层
  • 暂无其他已知冲突