[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-3f42730e-9c95-4016-8fbd-93eefdf207e2":3,"$fEoPQNBuz5WoYbDe3gKLaOcpbOkd0JkjSBkffjmWBqd4":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"3f42730e-9c95-4016-8fbd-93eefdf207e2","mcp-server-builder","设计和交付基于OpenAPI合约的成熟MCP（模型上下文协议）服务器，而不是手动编写的工具包装器。支持Python和TypeScript，模式验证，安全演进。用于将现有API公开为MCP服务器，为Claude或Codex或Cursor构建工具集成，或从头开始搭建MCP项目。","cat_coding_backend","mod_coding","alirezarezvani,coding","---\nname: \"mcp-server-builder\"\ndescription: \"Design and ship production-ready MCP (Model Context Protocol) servers from OpenAPI contracts instead of hand-written tool wrappers. Python and TypeScript support, schema validation, safe evolution. Use when exposing an existing API as an MCP server, building tool integrations for Claude or Codex or Cursor, or scaffolding an MCP project from scratch.\"\n---\n\n# MCP Server Builder\n\n**Tier:** POWERFUL  \n**Category:** Engineering  \n**Domain:** AI \u002F API Integration\n\n## Overview\n\nUse 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.\n\nThe workflow supports both Python and TypeScript MCP implementations and treats OpenAPI as the source of truth.\n\n## Core Capabilities\n\n- Convert OpenAPI paths\u002Foperations into MCP tool definitions\n- Generate starter server scaffolds (Python or TypeScript)\n- Enforce naming, descriptions, and schema consistency\n- Validate MCP tool manifests for common production failures\n- Apply versioning and backward-compatibility checks\n- Separate transport\u002Fruntime decisions from tool contract design\n\n## When to Use\n\n- You need to expose an internal\u002Fexternal REST API to an LLM agent\n- You are replacing brittle browser automation with typed tools\n- You want one MCP server shared across teams and assistants\n- You need repeatable quality checks before publishing MCP tools\n- You want to bootstrap an MCP server from existing OpenAPI specs\n\n## Key Workflows\n\n### 1. OpenAPI to MCP Scaffold\n\n1. Start from a valid OpenAPI spec.\n2. Generate tool manifest + starter server code.\n3. Review naming and auth strategy.\n4. Add endpoint-specific runtime logic.\n\n```bash\npython3 scripts\u002Fopenapi_to_mcp.py \\\n  --input openapi.json \\\n  --server-name billing-mcp \\\n  --language python \\\n  --output-dir .\u002Fout \\\n  --format text\n```\n\nSupports stdin as well:\n\n```bash\ncat openapi.json | python3 scripts\u002Fopenapi_to_mcp.py --server-name billing-mcp --language typescript\n```\n\n### 2. Validate MCP Tool Definitions\n\nRun validator before integration tests:\n\n```bash\npython3 scripts\u002Fmcp_validator.py --input out\u002Ftool_manifest.json --strict --format text\n```\n\nChecks include duplicate names, invalid schema shape, missing descriptions, empty required fields, and naming hygiene.\n\n### 3. Runtime Selection\n\n- Choose **Python** for fast iteration and data-heavy backends.\n- Choose **TypeScript** for unified JS stacks and tighter frontend\u002Fbackend contract reuse.\n- Keep tool contracts stable even if transport\u002Fruntime changes.\n\n### 4. Auth & Safety Design\n\n- Keep secrets in env, not in tool schemas.\n- Prefer explicit allowlists for outbound hosts.\n- Return structured errors (`code`, `message`, `details`) for agent recovery.\n- Avoid destructive operations without explicit confirmation inputs.\n\n### 5. Versioning Strategy\n\n- Additive fields only for non-breaking updates.\n- Never rename tool names in-place.\n- Introduce new tool IDs for breaking behavior changes.\n- Maintain changelog of tool contracts per release.\n\n## Script Interfaces\n\n- `python3 scripts\u002Fopenapi_to_mcp.py --help`\n  - Reads OpenAPI from stdin or `--input`\n  - Produces manifest + server scaffold\n  - Emits JSON summary or text report\n- `python3 scripts\u002Fmcp_validator.py --help`\n  - Validates manifests and optional runtime config\n  - Returns non-zero exit in strict mode when errors exist\n\n## Common Pitfalls\n\n1. Tool names derived directly from raw paths (`get__v1__users___id`)\n2. Missing operation descriptions (agents choose tools poorly)\n3. Ambiguous parameter schemas with no required fields\n4. Mixing transport errors and domain errors in one opaque message\n5. Building tool contracts that expose secret values\n6. Breaking clients by changing schema keys without versioning\n\n## Best Practices\n\n1. Use `operationId` as canonical tool name when available.\n2. Keep one task intent per tool; avoid mega-tools.\n3. Add concise descriptions with action verbs.\n4. Validate contracts in CI using strict mode.\n5. Keep generated scaffold committed, then customize incrementally.\n6. Pair contract changes with changelog entries.\n\n## Reference Material\n\n- [references\u002Fopenapi-extraction-guide.md](references\u002Fopenapi-extraction-guide.md)\n- [references\u002Fpython-server-template.md](references\u002Fpython-server-template.md)\n- [references\u002Ftypescript-server-template.md](references\u002Ftypescript-server-template.md)\n- [references\u002Fvalidation-checklist.md](references\u002Fvalidation-checklist.md)\n- [README.md](README.md)\n\n## Architecture Decisions\n\nChoose the server approach per constraint:\n\n- Python runtime: faster iteration, data pipelines, backend-heavy teams\n- TypeScript runtime: shared types with JS stack, frontend-heavy teams\n- Single MCP server: easiest operations, broader blast radius\n- Split domain servers: cleaner ownership and safer change boundaries\n\n## Contract Quality Gates\n\nBefore publishing a manifest:\n\n1. Every tool has clear verb-first name.\n2. Every tool description explains intent and expected result.\n3. Every required field is explicitly typed.\n4. Destructive actions include confirmation parameters.\n5. Error payload format is consistent across all tools.\n6. Validator returns zero errors in strict mode.\n\n## Testing Strategy\n\n- Unit: validate transformation from OpenAPI operation to MCP tool schema.\n- Contract: snapshot `tool_manifest.json` and review diffs in PR.\n- Integration: call generated tool handlers against staging API.\n- Resilience: simulate 4xx\u002F5xx upstream errors and verify structured responses.\n\n## Deployment Practices\n\n- Pin MCP runtime dependencies per environment.\n- Roll out server updates behind versioned endpoint\u002Fprocess.\n- Keep backward compatibility for one release window minimum.\n- Add changelog notes for new\u002Fremoved\u002Fchanged tool contracts.\n\n## Security Controls\n\n- Keep outbound host allowlist explicit.\n- Do not proxy arbitrary URLs from user-provided input.\n- Redact secrets and auth headers from logs.\n- Rate-limit high-cost tools and add request timeouts.\n","","imported","https:\u002F\u002Fgithub.com\u002Falirezarezvani\u002Fclaude-skills","user_system_seed","SkillOPIC",true,172,638,"2026-05-16 13:54:26",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"8cfcaddf-0dac-44aa-a821-225ffab4457e","1.0.0","mcp-server-builder.zip",10749,"uploads\u002Fskills\u002F3f42730e-9c95-4016-8fbd-93eefdf207e2\u002Fmcp-server-builder.zip","c8b6f18e67fbc90316b27055c4cf6b099bdde6680e681bf2d3842136ab88dde6","[{\"path\":\"README.md\",\"isDirectory\":false,\"size\":1240},{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":6067},{\"path\":\"references\u002Fopenapi-extraction-guide.md\",\"isDirectory\":false,\"size\":867},{\"path\":\"references\u002Fpython-server-template.md\",\"isDirectory\":false,\"size\":610},{\"path\":\"references\u002Ftypescript-server-template.md\",\"isDirectory\":false,\"size\":346},{\"path\":\"references\u002Fvalidation-checklist.md\",\"isDirectory\":false,\"size\":1338},{\"path\":\"scripts\u002Fmcp_validator.py\",\"isDirectory\":false,\"size\":5620},{\"path\":\"scripts\u002Fopenapi_to_mcp.py\",\"isDirectory\":false,\"size\":9542}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]