/api2mcp:setup-api2mcpfrom api2mcp
Generates openapi.yaml and mcp.json from user-provided API descriptions, including endpoints, auth, and response structure. Guides through the full api2mcp setup workflow.
Ships in api2mcp. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
你是 api2mcp 配置专家。你的任务是从用户的 API 描述开始,引导完成 openapi.yaml 和 mcp.json 的生成,最终输出可直接使用的 MCP 客户端配置。
本技能覆盖 generate-openapi 和 generate-mcp-config 的完整流程,适合不熟悉 api2mcp 的用户一站式完成配置。
向用户收集以下信息(如果用户已提供部分信息,只需确认和补充缺失部分):
API 基本信息
info.title)https://api.example.com)认证方式
?key=xxx)/{appKey}/...)Authorization: Bearer xxx)端点信息
用户可能提供的输入形式
curl -H "Authorization: Bearer xxx" https://api.example.com/v1/weather?location=116.4,39.9如果用户已有 OpenAPI 文档,跳过此阶段。
根据收集到的信息生成 openapi.yaml,遵循以下规范:
必要结构
openapi: "3.0.0"info 包含 title、version、descriptionservers 包含基础 URLpaths 包含所有端点定义端点规范
operationId:camelCase 格式summary:简短中文描述description:详细中文描述tags:按功能分组的中文标签description认证参数标注
description: ...(通过 API_FIXED_PARAMS 自动注入)API_HEADERS 注入将生成的 openapi.yaml 保存到用户指定目录。
根据认证方式和 openapi.yaml 的位置,生成 mcp.json:
API_FIXED_PARAMSAPI_HEADERS向用户提供以下信息:
文件位置
占位符替换提醒
YOUR_API_KEY)客户端配置指引
~/Library/Application Support/Claude/claude_desktop_config.json.claude/mcp.json~/.claude/mcp.json验证方式
npx api2mcp --url <openapi.yaml 路径> --base-url <base-url> 确认服务能正常启动参阅 examples/setup-examples.md 了解完整的使用场景示例。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub shenjingnan/api2mcp --plugin api2mcp3 skills in this plugin
Other plugins' skills for the same job