From example-skills
Guides building high-quality MCP servers in Python (FastMCP) or Node/TypeScript (MCP SDK) to enable LLMs to interact with external APIs/services via tools.
npx claudepluginhub joshuarweaver/cascade-code-general-misc-3 --plugin marcelleon-skills-zhThis skill uses the workspace's default tool permissions.
创建 MCP(Model Context Protocol)服务器,使 LLM 能够通过精心设计的工具与外部服务交互。MCP 服务器的质量通过它如何有效地使 LLM 完成现实世界任务来衡量。
Applies Acme Corporation brand guidelines including colors, fonts, layouts, and messaging to generated PowerPoint, Excel, and PDF documents.
Builds DCF models with sensitivity analysis, Monte Carlo simulations, and scenario planning for investment valuation and risk assessment.
Calculates profitability (ROE, margins), liquidity (current ratio), leverage, efficiency, and valuation (P/E, EV/EBITDA) ratios from financial statements in CSV, JSON, text, or Excel for investment analysis.
创建 MCP(Model Context Protocol)服务器,使 LLM 能够通过精心设计的工具与外部服务交互。MCP 服务器的质量通过它如何有效地使 LLM 完成现实世界任务来衡量。
创建高质量 MCP 服务器涉及四个主要阶段:
API 覆盖率 vs. 工作流工具: 平衡全面的 API 端点覆盖与专门的工作流工具。工作流工具对于特定任务可能更方便,而全面的覆盖率为代理提供了组合操作的灵活性。性能因客户端而异——一些客户端受益于组合基本工具的代码执行,而其他客户端使用更高级别的工作流效果更好。如果不确定,优先考虑全面的 API 覆盖率。
工具命名和可发现性:
清晰、描述性的工具名称帮助代理快速找到正确的工具。使用一致的前缀(例如,github_create_issue、github_list_repos)和面向操作的命名。
上下文管理: 代理受益于简洁的工具描述以及过滤/分页结果的能力。设计返回集中、相关数据的工具。一些客户端支持代码执行,这可以帮助代理高效地过滤和处理数据。
可操作的错误消息: 错误消息应该通过具体建议和后续步骤引导代理找到解决方案。
浏览 MCP 规范:
从站点地图开始查找相关页面:https://modelcontextprotocol.io/sitemap.xml
然后使用 .md 后缀获取特定页面的 markdown 格式(例如,https://modelcontextprotocol.io/specification/draft.md)。
需要查看的关键页面:
推荐技术栈:
加载框架文档:
对于 TypeScript(推荐):
https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md对于 Python:
https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md理解 API: 查看服务的 API 文档以识别关键端点、身份验证要求和数据模型。根据需要使用网络搜索和 WebFetch。
工具选择: 优先考虑全面的 API 覆盖率。列出要实现的端点,从最常见的操作开始。
有关项目设置,请参见特定语言的指南:
创建共享实用程序:
对于每个工具:
输入架构:
输出架构:
outputSchemastructuredContent(TypeScript SDK 功能)工具描述:
实现:
注释:
readOnlyHint: true/falsedestructiveHint: true/falseidempotentHint: true/falseopenWorldHint: true/false审查以下内容:
TypeScript:
npm run build 验证编译npx @modelcontextprotocol/inspectorPython:
python -m py_compile your_server.py有关详细的测试方法和质量检查清单,请参见特定语言的指南。
实现 MCP 服务器后,创建全面的评估来测试其有效性。
加载 ✅ 评估指南 以获取完整的评估指南。
使用评估来测试 LLM 是否可以有效地使用您的 MCP 服务器回答现实的、复杂的问题。
要创建有效的评估,请遵循评估指南中概述的流程:
确保每个问题是:
创建具有此结构的 XML 文件:
<evaluation>
<qa_pair>
<question>查找关于使用动物代号的 AI 模型发布的讨论。一个模型需要特定的安全名称,格式为 ASL-X。为以斑点野猫命名的模型确定的数字 X 是多少?</question>
<answer>3</answer>
</qa_pair>
<!-- 更多 qa_pairs... -->
</evaluation>
在开发过程中根据需要加载这些资源:
https://modelcontextprotocol.io/sitemap.xml 的站点地图开始,然后使用 .md 后缀获取特定页面https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md 获取https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md 获取🐍 Python 实现指南 - 完整的 Python/FastMCP 指南,包括:
@mcp.tool 的工具注册⚡ TypeScript 实现指南 - 完整的 TypeScript 指南,包括:
server.registerTool 的工具注册