This is a comprehensive methodology for building production-grade MCP servers, covering the full lifecycle from design to deployment. You get concrete guidance on choosing between tools, resources, and prompts, structuring TypeScript and Python projects, and writing tool definitions that AI assistants can actually understand and use correctly. The security section is practical (parameterized queries, path validation, no console.log since it breaks stdio transport), and the testing strategy walks through unit tests, integration tests with the SDK client, and using MCP Inspector for interactive debugging. The deployment checklist and troubleshooting table are useful references when things go wrong. If you're moving past hello-world MCP examples and need to ship something reliable, this gives you the patterns and guardrails to do it right.

skills.sh installs
963
GitHub stars
8.5K
last updated
Aug 21, 2026

Install

$ npx -y skills add jnmetacode/superpowers-zh --skill mcp-builder --agent claude-code

Installs into .claude/skills of the current project.

Files

MCP 服务器构建

系统化设计、实现、测试和部署 Model Context Protocol 服务器的方法论。

1. 协议核心概念

MCP 定义三种原语:

  • Tools(工具):AI 助手主动调用的函数,有副作用。如搜索、创建、删除操作。
  • Resources(资源):AI 助手只读访问的数据源,用 URI 标识。如 users://{id}/profile。
  • Prompts(提示词模板):预定义交互模板,引导用户触发工作流。

选择原则: 执行操作 → Tool | 读取数据 → Resource | 引导交互 → Prompt

2. 项目结构规范

TypeScript

my-mcp-server/
├── src/
│   ├── index.ts          # 入口,注册 tools/resources
│   ├── tools/             # 按功能拆分
│   ├── resources/
│   └── lib/               # 客户端封装、校验逻辑
├── tests/
├── package.json
└── tsconfig.json

关键依赖:@modelcontextprotocol/sdk + zod

Python

my-mcp-server/
├── src/my_mcp_server/
│   ├── server.py
│   ├── tools/
│   └── lib/
├── tests/
└── pyproject.toml

关键依赖:mcp + pydantic

3. Tool 设计原则

命名

  • snake_case 格式,动词开头:search_users、create_issue、delete_file
  • 名称自解释,AI 助手靠名称选工具,模糊命名导致误调用

参数

  • 每个参数有类型约束和 .describe() 描述
  • 可选参数给默认值,减少 AI 决策负担
  • 用枚举代替布尔开关

Sponsors

Details

Repository
github.com/jnmetacode/superpowers-zh
Category
AI & Agent Building
First seen
Jun 3, 2026

More from jnmetacode/superpowers-zh

All 20
1aradotso avatarr16-voltagent-seo-content-marketing-agent-skillsaradotso/marketing-skillsr16 voltagent seo content marketing agent skills960skills.sh installs
2tencentcloudbase avatarai-model-webtencentcloudbase/skillsUse this skill when a browser/Web app (React, Vue, Angular, Next, Nuxt, static sites, SPAs, dashboards, AI chat UI) needs AI models via @cloudbase/js-sdk. Defau918skills.sh installs
3microsoft avataragent-sessions-layoutmicrosoft/vscodeAgents workbench layout — covers the fixed layout structure, grid configuration, part visibility, editor modal, titlebar, sidebar footer, and implementation req911skills.sh installs
4meshy-dev avatarmeshy-3d-agentmeshy-dev/meshy-3d-agentGenerate 3D models, textures, images, rig characters, animate them, and prepare for 3D printing using the Meshy AI API. Handles API key detection, task creation908skills.sh installs
5sunbigfly avatarppt-agentsunbigfly/ppt-agent-skillsppt agent895skills.sh installs
6mindrally avataropenai-api-developmentmindrally/skillsExpert guidance for OpenAI API development including GPT models, Assistants API, function calling, embeddings, and best practices for production applications.888skills.sh installs