$npx -y skills add ECNU-ICALK/AutoSkill --skill mcp-builderGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
| 1 | # MCP Server Development Guide |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | To create high-quality MCP (Model Context Protocol) servers that enable LLMs to effectively interact with external services, use this skill. An MCP server provides tools that allow LLMs to access external services and APIs. The quality of an MCP server is measured by how well it enables LLMs to accomplish real-world tasks using the tools provided. |
| 6 | |
| 7 | --- |
| 8 | |
| 9 | # Process |
| 10 | |
| 11 | ## 🚀 High-Level Workflow |
| 12 | |
| 13 | Creating a high-quality MCP server involves four main phases: |
| 14 | |
| 15 | ### Phase 1: Deep Research and Planning |
| 16 | |
| 17 | #### 1.1 Understand Agent-Centric Design Principles |
| 18 | |
| 19 | Before diving into implementation, understand how to design tools for AI agents by reviewing these principles: |
| 20 | |
| 21 | **Build for Workflows, Not Just API Endpoints:** |
| 22 | - Don't simply wrap existing API endpoints - build thoughtful, high-impact workflow tools |
| 23 | - Consolidate related operations (e.g., `schedule_event` that both checks availability and creates event) |
| 24 | - Focus on tools that enable complete tasks, not just individual API calls |
| 25 | - Consider what workflows agents actually need to accomplish |
| 26 | |
| 27 | **Optimize for Limited Context:** |
| 28 | - Agents have constrained context windows - make every token count |
| 29 | - Return high-signal information, not exhaustive data dumps |
| 30 | - Provide "concise" vs "detailed" response format options |
| 31 | - Default to human-readable identifiers over technical codes (names over IDs) |
| 32 | - Consider the agent's context budget as a scarce resource |
| 33 | |
| 34 | **Design Actionable Error Messages:** |
| 35 | - Error messages should guide agents toward correct usage patterns |
| 36 | - Suggest specific next steps: "Try using filter='active_only' to reduce results" |
| 37 | - Make errors educational, not just diagnostic |
| 38 | - Help agents learn proper tool usage through clear feedback |
| 39 | |
| 40 | **Follow Natural Task Subdivisions:** |
| 41 | - Tool names should reflect how humans think about tasks |
| 42 | - Group related tools with consistent prefixes for discoverability |
| 43 | - Design tools around natural workflows, not just API structure |
| 44 | |
| 45 | **Use Evaluation-Driven Development:** |
| 46 | - Create realistic evaluation scenarios early |
| 47 | - Let agent feedback drive tool improvements |
| 48 | - Prototype quickly and iterate based on actual agent performance |
| 49 | |
| 50 | #### 1.3 Study MCP Protocol Documentation |
| 51 | |
| 52 | **Fetch the latest MCP protocol documentation:** |
| 53 | |
| 54 | Use WebFetch to load: `https://modelcontextprotocol.io/llms-full.txt` |
| 55 | |
| 56 | This comprehensive document contains the complete MCP specification and guidelines. |
| 57 | |
| 58 | #### 1.4 Study Framework Documentation |
| 59 | |
| 60 | **Load and read the following reference files:** |
| 61 | |
| 62 | - **MCP Best Practices**: [📋 View Best Practices](./reference/mcp_best_practices.md) - Core guidelines for all MCP servers |
| 63 | |
| 64 | **For Python implementations, also load:** |
| 65 | - **Python SDK Documentation**: Use WebFetch to load `https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md` |
| 66 | - [🐍 Python Implementation Guide](./reference/python_mcp_server.md) - Python-specific best practices and examples |
| 67 | |
| 68 | **For Node/TypeScript implementations, also load:** |
| 69 | - **TypeScript SDK Documentation**: Use WebFetch to load `https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md` |
| 70 | - [⚡ TypeScript Implementation Guide](./reference/node_mcp_server.md) - Node/TypeScript-specific best practices and examples |
| 71 | |
| 72 | #### 1.5 Exhaustively Study API Documentation |
| 73 | |
| 74 | To integrate a service, read through **ALL** available API documentation: |
| 75 | - Official API reference documentation |
| 76 | - Authentication and authorization requirements |
| 77 | - Rate limiting and pagination patterns |
| 78 | - Error responses and status codes |
| 79 | - Available endpoints and their parameters |
| 80 | - Data models and schemas |
| 81 | |
| 82 | **To gather comprehensive information, use web search and the WebFetch tool as needed.** |
| 83 | |
| 84 | #### 1.6 Create a Comprehensive Implementation Plan |
| 85 | |
| 86 | Based on your research, create a detailed plan that includes: |
| 87 | |
| 88 | **Tool Selection:** |
| 89 | - List the most valuable endpoints/operations to implement |
| 90 | - Prioritize tools that enable the most common and important use cases |
| 91 | - Consider which tools work together to enable complex workflows |
| 92 | |
| 93 | **Shared Utilities and Helpers:** |
| 94 | - Identify common API request patterns |
| 95 | - Plan pagination helpers |
| 96 | - Design filtering and formatting utilities |
| 97 | - Plan error handling strategies |
| 98 | |
| 99 | **Input/Output Design:** |
| 100 | - Define input validation models (Pydantic for Python, Zod for TypeScript) |
| 101 | - Design consistent response formats (e.g., JSON or Markdown), and configurable levels of detail (e.g., Detailed or Concise) |
| 102 | - Plan for large-scale usage (thousands of users/resources) |
| 103 | - Implement character limits and truncation strategies (e.g., 25,000 tokens) |
| 104 | |
| 105 | **Error Handling Strategy:** |
| 106 | - Plan g |