mcp-builder
Scaffolds new MCP servers with tool definitions, transport wiring, handler structure, and test harness for Python (FastMCP) or TypeScript (MCP SDK). Use when: 'build a new MCP server', 'scaffold an MCP integration', 'create tools for an external API', 'set up MCP transport and handlers'.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-25
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- mcp-builder
- tier
- 1
- model
- sonnet
- agents
- [ "primary" ]
- inputs
- [ { "name": "server_name", "type": "string", "required": true, "description": "Name of the MCP server to scaffold (used for directory and package naming)" }, { "name": "tools", "type": "string[]", "required": false, "description": "List of tool names to generate stubs for (e.g., list_items, create_item, search)" }, { "name": "transport", "type": "string", "required": false, "description": "Transport protocol: 'stdio' (default, for CLI integration) or 'sse' (for HTTP/server deployment)" } ]
- outputs
- [ { "name": "scaffold", "type": "ref", "format": "cas-ref", "description": "Complete MCP server scaffold with project structure, tool handlers, transport config, and test harness" } ]
- category
- system-health
- triggers
- [ "build a new MCP server", "scaffold an MCP integration", "create tools for an external API", "set up MCP transport and handlers" ]
- description
- Scaffolds new MCP servers with tool definitions, transport wiring, handler structure, and test harness for Python (FastMCP) or TypeScript (MCP SDK). Use when: 'build a new MCP server', 'scaffold an MCP integration', 'create tools for an external API', 'set up MCP transport and handlers'.
- tool_dependencies
- [ "file_system" ]
03 SKILL.md 正文
MCP Builder
Purpose: Scaffold production-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Produces a complete project structure with tool definitions, transport wiring, handler implementations, input validation, error handling, and an evaluation test harness.
I. When to Use
- Starting a new MCP server to integrate an external API or service
- Adding MCP tool access to an existing service
- Need a working scaffold with transport, validation, and tests from the start
- Building for either Python (FastMCP) or TypeScript (MCP SDK) targets
II. Agent-Centric Design Principles
MCP tools are used by AI agents, not humans. Design accordingly:
- Build for workflows, not API endpoints -- consolidate related operations (e.g.,
schedule_eventthat checks availability AND creates the event) - Optimize for limited context -- return high-signal information, not exhaustive data dumps; offer concise vs. detailed response formats
- Actionable error messages -- errors should guide agents toward correct usage ("Try filter='active_only' to reduce results")
- Natural task subdivisions -- tool names reflect how humans think about tasks, with consistent prefixes for discoverability
- Evaluation-driven development -- create realistic eval scenarios early; let agent feedback drive tool improvements
III. Workflow
Phase 1: Research and Planning
- Study the target API -- read all available documentation (endpoints, auth, rate limits, pagination, error codes, data models)
- Select high-value tools -- prioritize operations that enable complete workflows, not just individual API calls
- Plan shared utilities -- identify common patterns (API request helpers, pagination, error formatting, auth token management)
- Design input/output schemas -- Pydantic models for Python, Zod schemas for TypeScript; include constraints and descriptive field docs
Phase 2: Scaffold Generation
For each target language, generate the project structure:
Python (FastMCP):
{server_name}/
server.py # MCP server with @mcp.tool registrations
models.py # Pydantic input validation models
utils.py # Shared API request helpers, error formatting
requirements.txt # Dependencies (mcp, pydantic, httpx)
tests/
test_tools.py # Unit tests for each tool handler
eval.xml # Evaluation questions for agent testing
TypeScript (MCP SDK):
{server_name}/
src/
index.ts # MCP server with registerTool calls
schemas.ts # Zod input validation schemas
utils.ts # Shared helpers
package.json
tsconfig.json
tests/
tools.test.ts # Unit tests
eval.xml # Evaluation questions
Phase 3: Tool Implementation
For each tool in the tools list:
- Define input schema with proper constraints (min/max length, regex, ranges) and descriptive field docs with examples
- Write comprehensive docstring -- one-line summary, detailed purpose, parameter types with examples, return schema, usage examples
- Implement handler using shared utilities, async/await for I/O, proper error handling, response format options (JSON/Markdown)
- Add tool annotations --
readOnlyHint,destructiveHint,idempotentHint,openWorldHint
Phase 4: Transport Wiring
Configure the selected transport:
- stdio (default): reads from stdin, writes to stdout; suitable for CLI tool integration and local development
- sse: HTTP server with Server-Sent Events; suitable for remote deployment and multi-client scenarios
Phase 5: Test Harness
- Unit tests for each tool handler with mocked API responses
- Build verification --
python -m py_compile server.pyornpm run build - Evaluation harness -- 10 realistic questions that test whether an agent can accomplish real tasks using the tools
IV. Quality Checklist
- [ ] Every tool has a comprehensive docstring with examples
- [ ] Input validation catches malformed requests with actionable error messages
- [ ] No duplicated code between tool handlers (shared utilities extracted)
- [ ] Pagination is handled (not left to the caller)
- [ ] Character/token limits respected (truncation at 25,000 characters)
- [ ] All external calls have error handling with retry for transient failures
- [ ] Tool annotations set correctly (readOnly, destructive, idempotent, openWorld)
- [ ] Transport configured and tested (stdio or sse)
- [ ] Build passes without errors
- [ ] Evaluation harness with 10 questions created
V. Output
- Complete MCP server project scaffold at the specified location
- Contents: project structure, tool handler implementations, input validation schemas, shared utilities, transport configuration, test suite, evaluation harness
- Ready to run:
python server.py(Python) ornpm run build && node dist/index.js(TypeScript)
VI. Examples
Scenario 1: "Build an MCP server for the GitHub API" with tools=[list_repos, search_code, get_pull_request, create_issue] and transport=stdio --> Python scaffold with 4 tool handlers, Pydantic models for each input, shared GitHub API client with auth token management, pagination helper, Markdown response formatter, 10 eval questions testing real GitHub workflows.
Scenario 2: "Scaffold an MCP server for our internal inventory API" with server_name=inventory-mcp and transport=sse --> TypeScript scaffold with SSE transport, Zod schemas, placeholder tool stubs ready for implementation, HTTP server configuration, CORS setup for remote access.
Scenario 3: "Create an MCP server that wraps our Postgres database" with tools=[query, list_tables, describe_table] --> Python scaffold with read-only tool annotations, SQL injection prevention in input validation, result truncation at 25K characters, connection pooling in shared utilities.
VII. Edge Cases
- No tools specified: generate a minimal scaffold with one example tool (
hello_world) as a template; include comments showing how to add more - Target API requires OAuth flow: scaffold includes token refresh logic in shared utilities; document the manual auth setup step in README
- Server needs both stdio and SSE: scaffold both transport configurations; use environment variable to select at runtime
- Very large API surface (50+ endpoints): do not scaffold all 50; select the 8-12 highest-value workflow tools and document the rest as future additions
VIII. Anti-Patterns
- Wrapping every API endpoint as a separate tool -- consolidate into workflow-level tools that complete tasks, not individual HTTP calls
- Returning raw API responses without formatting -- agents have limited context; parse and summarize responses
- Skipping input validation -- unvalidated inputs produce cryptic API errors that agents cannot recover from
- Testing by running the server directly in the main process -- MCP servers block on stdin; use the evaluation harness or run in tmux
- Hardcoding API keys in the scaffold -- use environment variables; never commit credentials
04 同仓库更多 Skills
kata-test-echo
暂无简介
kata-plain
An ordinary prose skill; not dispatchable.
kata-broken
暂无简介
voice-before-structure
Read the project's design language and philosophy before writing structural artifacts. Ground manifests, READMEs, and descriptions in the project's voice, not boilerplate. Use when creating manifests or READMEs for established projects, writing ecosystem-level documentation, building plugin descriptions or marketplace metadata, or authoring metadata that carries a project's identity. Trigger phrases: 'write the manifest', 'create a README', 'describe this plugin', 'ground yourself in the philosophy', 'ecosystem-level work'.
system-prompt-archaeology
Produces a named ADA disposition preset (YAML) and a layered behavioral analysis (structural decomposition + evidence-cited classifications) from a system prompt. Use when: "analyze this system prompt", "extract disposition from prompt", "reverse-engineer agent behavior", "what patterns does this prompt use", "build a preset from this prompt".
session-lifecycle-automation
Designs and configures all three loops of solo-operator session automation — session bookends, background maintenance agents, and a delegation flywheel. Use when setting up a new workspace, recovering from the 44% zero-artifact session leak, or preparing to scale delegation across multiple concurrent agents.