跳到正文
Skillpedia
连接器(MCP)29k · #9591

mcp-server-builder

它能做什么

这项技能帮助构建 MCP 服务器,让 AI 助手能通过清晰的工具使用 API。适合希望把内部或外部 API 连接到 AI 助手的开发者。

适用场景

  • ✓当你希望 AI 助手通过类型化工具使用现有的 REST API 时。
  • ✓当你想用与服务的正规连接,替代脆弱的浏览器自动化时。
  • ✓当你想在多个团队或助手之间共享一个 MCP 服务器的时候。

技能链接

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/skills/mcp-server-builder/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/alirezarezvani/claude-skills/blob/main/engineering/skills/mcp-server-builder/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请把我们公司的 OpenAPI 规范转换为我的助手可以使用的 MCP 服务器。”

每周 5 个新技能,1 分钟读完。

工作原理

它会读取 API 描述,为每个操作创建工具定义,生成 Python 或 TypeScript 的入门服务器,并检查结果是否存在常见问题。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

MCP Server Builder

Tier: POWERFUL · Category: Engineering · Domain: AI / API Integration

Overview

Use this skill to design and ship production-ready MCP servers from API contracts instead of hand-written one-off tool wrappers. It focuses on fast scaffolding, schema quality, validation, and safe evolution.

The workflow supports both Python and TypeScript MCP implementations and treats OpenAPI as the source of truth.

Core Capabilities

  • Convert OpenAPI paths/operations into MCP tool definitions
  • Generate starter server scaffolds (Python or TypeScript)
  • Enforce naming, descriptions, and schema consistency
  • Validate MCP tool manifests for common production failures
  • Apply versioning and backward-compatibility checks
  • Separate transport/runtime decisions from tool contract design

When to Use

  • You need to expose an internal/external REST API to an LLM agent
  • You are replacing brittle browser automation with typed tools
  • You want one MCP server shared across teams and assistants
  • You need repeatable quality checks before publishing MCP tools
  • You want to bootstrap an MCP server from existing OpenAPI specs

Key Workflows

1. OpenAPI to MCP Scaffold

  1. Start from a valid OpenAPI spec.
  2. Generate tool manifest + starter server code.
  3. Review naming and auth strategy.
  4. Add endpoint-specific runtime logic.
python3 scripts/openapi_to_mcp.py \
  --input openapi.json \
  --server-name billing-mcp \
  --language python \
  --output-dir ./out \
  --format text

Supports stdin as well:

cat openapi.json | python3 scripts/openapi_to_mcp.py --server-name billing-mcp --language typescript

2. Validate MCP Tool Definitions

Run validator before integration tests:

python3 scripts/mcp_validator.py --input out/tool_manifest.json --strict --format text

Checks include duplicate names, invalid schema shape, missing descriptions, empty required fields, and naming hygiene.

3. Runtime Selection

  • Choose Python for fast iteration and data-heavy backends.
  • Choose TypeScript for unified JS stacks and tighter frontend/backend contract reuse.
  • Keep tool contracts stable even if transport/runtime changes.

4. Harden for Production

Key items before publishing:

  • Keep secrets in env vars, not tool schemas
  • Prefer outbound host allowlists over open proxies
  • Use additive-only changes; never rename tool names in-place

Full hardening guidance: references/production-hardening-guide.md.

Script Interfaces

  • python3 scripts/openapi_to_mcp.py --help
    • Reads OpenAPI from stdin or --input
    • Produces manifest + server scaffold
    • Emits JSON summary or text report
  • python3 scripts/mcp_validator.py --help
    • Validates manifests and optional runtime config
    • Returns non-zero exit in strict mode when errors exist

Reference Material

常见问题

API 需要具备什么条件?

需要一份有效的 OpenAPI 规范,用来描述 API 的各个端点。

它能同时编写 Python 和 TypeScript 服务器吗?

能。该技能支持两种语言,并可为任一语言生成入门框架。

它会编写所有业务逻辑吗?

不会。入门代码生成后,你仍需为每个端点添加所需的逻辑。

详情

作者的原始描述

Use when exposing an API as an MCP server or scaffolding a new MCP server in Python or TypeScript, before hand-writing tool wrappers. Generates tools from OpenAPI with openapi_to_mcp.py and validates them with mcp_validator.py.

repo: alirezarezvani/claude-skills

热度

GitHub 星标
29k
排名
#9591
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能