[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EMA77JPAYRM5QJN40PZNSM":3,"skill-same:01M6EMA77JPAYRM5QJN40PZNSM":127},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6EMA77JPAYRM5QJN40PZNSM","mcp-builder",null,"Comprehensive guide for building Model Context Protocol (MCP) servers with support for tools, resources, prompts, and authentication. Use when: (1) Creating custom MCP servers, (2) Integrating external APIs with Claude, (3) Building tool servers for specialized domains, (4) Creating resource providers for documentation, (5) Implementing authentication and security","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"mcp builder","MCP","builder","resources","domains","use","guide","context","specialized","model","tool","Providers","Tools","mcp servers","protocol","authentication","documentation","support","model context protocol","security","2026-11-10 10:12:30",false,"---\nname: mcp-builder\ndescription: \"Comprehensive guide for building Model Context Protocol (MCP) servers with support for tools, resources, prompts, and authentication. Use when: (1) Creating custom MCP servers, (2) Integrating external APIs with Claude, (3) Building tool servers for specialized domains, (4) Creating resource providers for documentation, (5) Implementing authentication and security\"\n---\n\n# MCP Builder - Model Context Protocol Server Development\n\n## What is MCP?\n\nModel Context Protocol (MCP) is an open standard created by Anthropic that enables AI assistants like Claude to securely connect to external data sources and tools. Think of it as a universal adapter that allows Claude to interact with any system, API, or data source through a standardized interface.\n\n**Key Benefits:**\n- **Standardization**: One protocol for all integrations\n- **Security**: Built-in authentication and permission controls\n- **Flexibility**: Support for tools, resources, and prompts\n- **Scalability**: Designed for production workloads\n- **Modularity**: Create reusable MCP servers for different domains\n\n## Architecture Overview\n\nMCP follows a client-server architecture:\n\n```\n┌─────────────┐         ┌─────────────┐         ┌──────────────┐\n│   Claude    │ ←──MCP──→ │ MCP Server  │ ←──────→ │ External API │\n│  (Client)   │         │  (Your Code) │         │  Database    │\n└─────────────┘         └─────────────┘         └──────────────┘\n```\n\n**Components:**\n- **Client**: Claude Desktop, Claude Code, or custom applications\n- **Server**: Your MCP implementation (Python, TypeScript, etc.)\n- **Transport**: Communication channel (stdio, HTTP, SSE)\n- **Protocol**: Standardized message format (JSON-RPC 2.0)\n\nFor detailed protocol specification, see [Protocol Specification Reference](.\u002Freferences\u002Fprotocol-specification.md).\n\n## Core Components\n\n### 1. Tools: Exposing Functions Claude Can Call\n\nTools are the primary way to give Claude new capabilities. Each tool is a function that Claude can invoke with specific arguments.\n\n**Tool Definition Structure:**\n```python\n{\n    \"name\": \"tool_name\",\n    \"description\": \"Clear description of what this tool does\",\n    \"inputSchema\": {\n        \"type\": \"object\",\n        \"properties\": {\n            \"param1\": {\n                \"type\": \"string\",\n                \"description\": \"Description of parameter\"\n            }\n        },\n        \"required\": [\"param1\"]\n    }\n}\n```\n\n**Key Principles:**\n- **Clear naming**: Use descriptive, action-oriented names (e.g., `search_database`, not `db_query`)\n- **Comprehensive descriptions**: Explain what the tool does, when to use it, and what it returns\n- **Strong schemas**: Use JSON Schema to validate inputs and guide Claude\n- **Error handling**: Return clear error messages when things go wrong\n\nFor complete schema design patterns and best practices, see [Tool Schema Reference](.\u002Freferences\u002Ftool-schemas.md).\n\n### 2. Resources: Providing Data\u002FDocumentation Access\n\nResources allow Claude to access files, documentation, or structured data. Unlike tools (which perform actions), resources provide information.\n\n**Resource Types:**\n- **Static**: Fixed content (e.g., documentation files)\n- **Dynamic**: Generated on-demand (e.g., database queries)\n- **Templates**: Parameterized resources (e.g., user profiles)\n\n**Resource URI Patterns:**\n```\nfile:\u002F\u002F\u002Fpath\u002Fto\u002Ffile.txt          # Local file\nhttp:\u002F\u002Fexample.com\u002Fapi\u002Fdocs       # HTTP resource\ncustom:\u002F\u002Fdatabase\u002Fusers\u002F123       # Custom scheme\ntemplate:\u002F\u002Freport\u002F{user_id}       # Template resource\n```\n\n### 3. Prompts: Reusable Prompt Templates\n\nPrompts are pre-defined message templates that users can invoke. They help standardize common workflows and best practices.\n\n**Prompt Definition:**\n```python\n{\n    \"name\": \"code_review\",\n    \"description\": \"Comprehensive code review checklist\",\n    \"arguments\": [\n        {\n            \"name\": \"language\",\n            \"description\": \"Programming language\",\n            \"required\": True\n        }\n    ]\n}\n```\n\n### 4. Authentication Methods\n\nMCP supports multiple authentication methods:\n- **No Authentication** (development only)\n- **API Key Authentication** (simple, medium security)\n- **OAuth 2.0** (third-party, high security)\n- **Bearer Token** (API-to-API, high security)\n\nFor complete security implementation guides, see [Security Best Practices](.\u002Freferences\u002Fsecurity-guide.md).\n\n## Server Implementation Workflow\n\n### Phase 1: Project Setup\n\nCreate your MCP server project:\n\n```bash\n# Create project directory\nmkdir my-mcp-server\ncd my-mcp-server\n\n# Initialize Python project\nuv init\nuv add mcp\n\n# Create server file\ntouch server.py\n```\n\n### Phase 2: Basic Server Structure\n\n**Minimal working server:**\n\n```python\nfrom mcp.server import Server\nfrom mcp.server.stdio import stdio_server\nfrom mcp.types import Tool, TextContent\nimport asyncio\n\napp = Server(\"my-mcp-server\")\n\n@app.list_tools()\nasync def list_tools():\n    return [\n        Tool(\n            name=\"my_tool\",\n            description=\"Description of what this tool does\",\n            inputSchema={\n                \"type\": \"object\",\n                \"properties\": {\n                    \"param\": {\"type\": \"string\"}\n                },\n                \"required\": [\"param\"]\n            }\n        )\n    ]\n\n@app.call_tool()\nasync def call_tool(name: str, arguments: dict):\n    if name == \"my_tool\":\n        param = arguments[\"param\"]\n        result = f\"Processed: {param}\"\n        return [TextContent(type=\"text\", text=result)]\n\nasync def main():\n    async with stdio_server() as (read_stream, write_stream):\n        await app.run(read_stream, write_stream, app.create_initialization_options())\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### Phase 3: Tool Registration and Handlers\n\n**Registration Pattern:**\n```python\n@app.list_tools()\nasync def list_tools():\n    return [\n        Tool(\n            name=\"calculator_add\",\n            description=\"Add two numbers\",\n            inputSchema={\n                \"type\": \"object\",\n                \"properties\": {\n                    \"a\": {\"type\": \"number\", \"description\": \"First number\"},\n                    \"b\": {\"type\": \"number\", \"description\": \"Second number\"}\n                },\n                \"required\": [\"a\", \"b\"]\n            }\n        )\n    ]\n```\n\n**Handler Pattern:**\n```python\n@app.call_tool()\nasync def call_tool(name: str, arguments: dict):\n    if name == \"calculator_add\":\n        return await handle_calculator_add(arguments)\n    else:\n        raise ValueError(f\"Unknown tool: {name}\")\n\nasync def handle_calculator_add(arguments: dict):\n    a = arguments[\"a\"]\n    b = arguments[\"b\"]\n    result = a + b\n    return [TextContent(type=\"text\", text=f\"{a} + {b} = {result}\")]\n```\n\n### Phase 4: Resource Implementation\n\n**Static and dynamic resource examples:**\n```python\nfrom mcp.types import Resource, ResourceContents, TextResourceContents\n\n@app.list_resources()\nasync def list_resources():\n    return [Resource(uri=\"file:\u002F\u002F\u002Fdocs\u002Freadme.md\", name=\"README\",\n                     description=\"Documentation\", mimeType=\"text\u002Fmarkdown\")]\n\n@app.read_resource()\nasync def read_resource(uri: str):\n    if uri.startswith(\"file:\u002F\u002F\"):\n        with open(uri[7:], 'r') as f:\n            return ResourceContents(contents=[TextResourceContents(\n                uri=uri, mimeType=\"text\u002Fmarkdown\", text=f.read())])\n```\n\nSee [Resource Server Example](.\u002Fexamples\u002Fresource-server.md) for complete implementation.\n\n### Phase 5: Error Handling and Testing\n\n**Error Response Pattern:**\n```python\nasync def call_tool(name: str, arguments: dict):\n    try:\n        return [TextContent(type=\"text\", text=await execute_tool(name, arguments))]\n    except ValueError as e:\n        return [TextContent(type=\"text\", text=f\"Invalid input: {str(e)}\", isError=True)]\n    except Exception as e:\n        logger.exception(\"Unexpected error\")\n        return [TextContent(type=\"text\", text=f\"Error: {type(e).__name__}\", isError=True)]\n```\n\n**Testing:**\n\n```bash\n# Test with MCP inspector\nnpx @modelcontextprotocol\u002Finspector python server.py\n```\n\nSee [Testing and Debugging Guide](.\u002Freferences\u002Ftesting-debugging.md) for comprehensive strategies.\n\n### Phase 6: Claude Desktop Integration\n\n**Configuration:** Edit `claude_desktop_config.json`:\n- macOS: `~\u002FLibrary\u002FApplication Support\u002FClaude\u002F`\n- Windows: `%APPDATA%\\Claude\u002F`\n- Linux: `~\u002F.config\u002FClaude\u002F`\n\n```json\n{\n  \"mcpServers\": {\n    \"my-server\": {\n      \"command\": \"python\",\n      \"args\": [\"\u002Fabsolute\u002Fpath\u002Fto\u002Fserver.py\"],\n      \"env\": {\"API_KEY\": \"your-key\"}\n    }\n  }\n}\n```\n\n## Best Practices\n\n### Tool Schema Design\n\n**Use descriptive names:**\n```python\n# ✅ Good\n\"search_customer_by_email\"\n\"calculate_shipping_cost\"\n\n# ❌ Bad\n\"search\"\n\"calc\"\n```\n\n**Provide comprehensive descriptions:**\n```python\n# ✅ Good\ndescription=\"\"\"\nSearch for customers by email address. Returns customer profile including:\n- Contact information\n- Order history\n- Account status\n\"\"\"\n\n# ❌ Bad\ndescription=\"Search customers\"\n```\n\n**Use enums for fixed options:**\n```python\n# ✅ Good\n\"status\": {\n    \"type\": \"string\",\n    \"enum\": [\"pending\", \"approved\", \"rejected\"],\n    \"description\": \"Application status\"\n}\n```\n\n### Error Handling Strategies\n\nCategorize errors with custom exceptions and provide actionable messages:\n\n```python\nclass ValidationError(Exception): pass\nclass AuthenticationError(Exception): pass\n\nasync def call_tool(name: str, arguments: dict):\n    try:\n        return await execute_tool(name, arguments)\n    except ValidationError as e:\n        return [TextContent(type=\"text\", text=f\"Invalid input: {str(e)}\", isError=True)]\n```\n\n### Security Considerations\n\nAlways validate inputs and use environment variables for secrets:\n\n```python\n# Input validation\ndef validate_url(url: str) -> bool:\n    if urlparse(url).scheme not in ['http', 'https']:\n        raise ValidationError(\"Only HTTP\u002FHTTPS URLs allowed\")\n\n# Secrets management\nAPI_KEY = os.getenv(\"API_KEY\")  # ✅ Good\n# API_KEY = \"sk-1234\"  # ❌ Bad - Never hardcode!\n```\n\n### Performance Optimization\n\nUse connection pooling and parallel async operations:\n\n```python\n# ✅ Parallel execution\nresults = await asyncio.gather(*[fetch_user_data(uid) for uid in user_ids])\n\n# ❌ Sequential execution (slow)\nfor user_id in user_ids:\n    result = await fetch_user_data(user_id)\n```\n\n## Common Pitfalls\n\n### Schema Validation Errors\n\n**Missing required validation:**\n```python\n# ❌ Bad: No validation\nasync def handle_create_user(arguments: dict):\n    username = arguments[\"username\"]  # Will crash if missing!\n\n# ✅ Good: Validate inputs\nasync def handle_create_user(arguments: dict):\n    if \"username\" not in arguments:\n        return [TextContent(type=\"text\", text=\"Error: username required\", isError=True)]\n    username = arguments[\"username\"]\n```\n\n### Authentication Issues\n\n**Insecure storage:**\n```python\n# ❌ Bad: Hardcoded API key\nAPI_KEY = \"sk-1234567890abcdef\"\n\n# ✅ Good: Environment variables\nAPI_KEY = os.getenv(\"API_KEY\")\nif not API_KEY:\n    raise ValueError(\"API_KEY environment variable required\")\n```\n\n### Transport Configuration\n\n**Path issues:**\n```python\n# ❌ Bad: Relative path\n{\n  \"command\": \"python\",\n  \"args\": [\"server.py\"]  # Won't work!\n}\n\n# ✅ Good: Absolute path\n{\n  \"command\": \"python\",\n  \"args\": [\"\u002FUsers\u002Fusername\u002Fprojects\u002Fmcp-server\u002Fserver.py\"]\n}\n```\n\n### Error Propagation\n\n**Silent failures:**\n```python\n# ❌ Bad: Silent failure\nasync def call_tool(name: str, arguments: dict):\n    try:\n        return await execute_tool(name, arguments)\n    except Exception:\n        return [TextContent(type=\"text\", text=\"Something went wrong\")]\n\n# ✅ Good: Descriptive errors\nasync def call_tool(name: str, arguments: dict):\n    try:\n        return await execute_tool(name, arguments)\n    except ValueError as e:\n        return [TextContent(type=\"text\", text=f\"Invalid input: {str(e)}\", isError=True)]\n    except Exception as e:\n        logger.exception(\"Unexpected error\")\n        return [TextContent(type=\"text\", text=f\"Error: {type(e).__name__}\", isError=True)]\n```\n\n**Not marking errors:**\n```python\n# ❌ Bad\nreturn [TextContent(type=\"text\", text=\"Error: Failed\")]\n\n# ✅ Good\nreturn [TextContent(type=\"text\", text=\"Error: Failed\", isError=True)]\n```\n\n## Additional Resources\n\n### Official Documentation\n- MCP Specification: https:\u002F\u002Fmodelcontextprotocol.io\u002F\n- Python SDK: https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Fpython-sdk\n- TypeScript SDK: https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Ftypescript-sdk\n\n### Detailed References\n- [Protocol Specification](.\u002Freferences\u002Fprotocol-specification.md) - Complete protocol details, message formats, transport mechanisms\n- [Tool Schema Guide](.\u002Freferences\u002Ftool-schemas.md) - Comprehensive schema patterns and validation\n- [Security Best Practices](.\u002Freferences\u002Fsecurity-guide.md) - Authentication, authorization, input validation, secrets management\n- [Testing and Debugging](.\u002Freferences\u002Ftesting-debugging.md) - Unit tests, integration tests, MCP inspector usage, debugging techniques\n- [Production Deployment](.\u002Freferences\u002Fproduction-deployment.md) - Production configuration, monitoring, scaling, Docker deployment\n\n### Complete Examples\n- [Simple Calculator Server](.\u002Fexamples\u002Fsimple-calculator-server.md) - Basic arithmetic tools\n- [REST API Wrapper](.\u002Fexamples\u002Frest-api-wrapper.md) - GitHub API integration\n- [Database Server](.\u002Fexamples\u002Fdatabase-server.md) - Safe database query access\n- [Resource Server](.\u002Fexamples\u002Fresource-server.md) - Static and dynamic resources\n\n### Tools\n- MCP Inspector: https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Finspector\n- Claude Desktop: https:\u002F\u002Fclaude.ai\u002Fdownload\n\n## Quick Reference\n\n### Server Template (Python)\n```python\nfrom mcp.server import Server\nfrom mcp.server.stdio import stdio_server\nfrom mcp.types import Tool, TextContent\nimport asyncio\n\napp = Server(\"my-server\")\n\n@app.list_tools()\nasync def list_tools():\n    return [Tool(name=\"my_tool\", description=\"...\", inputSchema={...})]\n\n@app.call_tool()\nasync def call_tool(name: str, arguments: dict):\n    if name == \"my_tool\":\n        return [TextContent(type=\"text\", text=\"Result\")]\n\nasync def main():\n    async with stdio_server() as (read_stream, write_stream):\n        await app.run(read_stream, write_stream, app.create_initialization_options())\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### Common Patterns\n\n**Error handling:**\n```python\nreturn [TextContent(type=\"text\", text=\"Error message\", isError=True)]\n```\n\n**Async operations:**\n```python\nresults = await asyncio.gather(*tasks)\n```\n\n**Input validation:**\n```python\nif \"required_param\" not in arguments:\n    return [TextContent(type=\"text\", text=\"Missing parameter\", isError=True)]\n```\n\n---\n\n**End of MCP Builder Skill Guide**\n\nFor complete working examples and detailed technical references, explore the `examples\u002F` and `references\u002F` directories.\n","# MCP Builder - Model Context Protocol Server Development\n\n## What is MCP?\n\nModel Context Protocol (MCP) is an open standard created by Anthropic that enables AI assistants like Claude to securely connect to external data sources and tools. Think of it as a universal adapter that allows Claude to interact with any system, API, or data source through a standardized interface.\n\n**Key Benefits:**\n- **Standardization**: One protocol for all integrations\n- **Security**: Built-in authentication and permission controls\n- **Flexibility**: Support for tools, resources, and prompts\n- **Scalability**: Designed for production workloads\n- **Modularity**: Create reusable MCP servers for different domains\n\n## Architecture Overview\n\nMCP follows a client-server architecture:\n\n```\n┌─────────────┐         ┌─────────────┐         ┌──────────────┐\n│   Claude    │ ←──MCP──→ │ MCP Server  │ ←──────→ │ External API │\n│  (Client)   │         │  (Your Code) │         │  Database    │\n└─────────────┘         └─────────────┘         └──────────────┘\n```\n\n**Components:**\n- **Client**: Claude Desktop, Claude Code, or custom applications\n- **Server**: Your MCP implementation (Python, TypeScript, etc.)\n- **Transport**: Communication channel (stdio, HTTP, SSE)\n- **Protocol**: Standardized message format (JSON-RPC 2.0)\n\nFor detailed protocol specification, see [Protocol Specification Reference](.\u002Freferences\u002Fprotocol-specification.md).\n\n## Core Components\n\n### 1. Tools: Exposing Functions Claude Can Call\n\nTools are the primary way to give Claude new capabilities. Each tool is a function that Claude can invoke with specific arguments.\n\n**Tool Definition Structure:**\n```python\n{\n    \"name\": \"tool_name\",\n    \"description\": \"Clear description of what this tool does\",\n    \"inputSchema\": {\n        \"type\": \"object\",\n        \"properties\": {\n            \"param1\": {\n                \"type\": \"string\",\n                \"description\": \"Description of parameter\"\n            }\n        },\n        \"required\": [\"param1\"]\n    }\n}\n```\n\n**Key Principles:**\n- **Clear naming**: Use descriptive, action-oriented names (e.g., `search_database`, not `db_query`)\n- **Comprehensive descriptions**: Explain what the tool does, when to use it, and what it returns\n- **Strong schemas**: Use JSON Schema to validate inputs and guide Claude\n- **Error handling**: Return clear error messages when things go wrong\n\nFor complete schema design patterns and best practices, see [Tool Schema Reference](.\u002Freferences\u002Ftool-schemas.md).\n\n### 2. Resources: Providing Data\u002FDocumentation Access\n\nResources allow Claude to access files, documentation, or structured data. Unlike tools (which perform actions), resources provide information.\n\n**Resource Types:**\n- **Static**: Fixed content (e.g., documentation files)\n- **Dynamic**: Generated on-demand (e.g., database queries)\n- **Templates**: Parameterized resources (e.g., user profiles)\n\n**Resource URI Patterns:**\n```\nfile:\u002F\u002F\u002Fpath\u002Fto\u002Ffile.txt          # Local file\nhttp:\u002F\u002Fexample.com\u002Fapi\u002Fdocs       # HTTP resource\ncustom:\u002F\u002Fdatabase\u002Fusers\u002F123       # Custom scheme\ntemplate:\u002F\u002Freport\u002F{user_id}       # Template resource\n```\n\n### 3. Prompts: Reusable Prompt Templates\n\nPrompts are pre-defined message templates that users can invoke. They help standardize common workflows and best practices.\n\n**Prompt Definition:**\n```python\n{\n    \"name\": \"code_review\",\n    \"description\": \"Comprehensive code review checklist\",\n    \"arguments\": [\n        {\n            \"name\": \"language\",\n            \"description\": \"Programming language\",\n            \"required\": True\n        }\n    ]\n}\n```\n\n### 4. Authentication Methods\n\nMCP supports multiple authentication methods:\n- **No Authentication** (development only)\n- **API Key Authentication** (simple, medium security)\n- **OAuth 2.0** (third-party, high security)\n- **Bearer Token** (API-to-API, high security)\n\nFor complete security implementation guides, see [Security Best Practices](.\u002Freferences\u002Fsecurity-guide.md).\n\n## Server Implementation Workflow\n\n### Phase 1: Project Setup\n\nCreate your MCP server project:\n\n```bash\n# Create project directory\nmkdir my-mcp-server\ncd my-mcp-server\n\n# Initialize Python project\nuv init\nuv add mcp\n\n# Create server file\ntouch server.py\n```\n\n### Phase 2: Basic Server Structure\n\n**Minimal working server:**\n\n```python\nfrom mcp.server import Server\nfrom mcp.server.stdio import stdio_server\nfrom mcp.types import Tool, TextContent\nimport asyncio\n\napp = Server(\"my-mcp-server\")\n\n@app.list_tools()\nasync def list_tools():\n    return [\n        Tool(\n            name=\"my_tool\",\n            description=\"Description of what this tool does\",\n            inputSchema={\n                \"type\": \"object\",\n                \"properties\": {\n                    \"param\": {\"type\": \"string\"}\n                },\n                \"required\": [\"param\"]\n            }\n        )\n    ]\n\n@app.call_tool()\nasync def call_tool(name: str, arguments: dict):\n    if name == \"my_tool\":\n        param = arguments[\"param\"]\n        result = f\"Processed: {param}\"\n        return [TextContent(type=\"text\", text=result)]\n\nasync def main():\n    async with stdio_server() as (read_stream, write_stream):\n        await app.run(read_stream, write_stream, app.create_initialization_options())\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### Phase 3: Tool Registration and Handlers\n\n**Registration Pattern:**\n```python\n@app.list_tools()\nasync def list_tools():\n    return [\n        Tool(\n            name=\"calculator_add\",\n            description=\"Add two numbers\",\n            inputSchema={\n                \"type\": \"object\",\n                \"properties\": {\n                    \"a\": {\"type\": \"number\", \"description\": \"First number\"},\n                    \"b\": {\"type\": \"number\", \"description\": \"Second number\"}\n                },\n                \"required\": [\"a\", \"b\"]\n            }\n        )\n    ]\n```\n\n**Handler Pattern:**\n```python\n@app.call_tool()\nasync def call_tool(name: str, arguments: dict):\n    if name == \"calculator_add\":\n        return await handle_calculator_add(arguments)\n    else:\n        raise ValueError(f\"Unknown tool: {name}\")\n\nasync def handle_calculator_add(arguments: dict):\n    a = arguments[\"a\"]\n    b = arguments[\"b\"]\n    result = a + b\n    return [TextContent(type=\"text\", text=f\"{a} + {b} = {result}\")]\n```\n\n### Phase 4: Resource Implementation\n\n**Static and dynamic resource examples:**\n```python\nfrom mcp.types import Resource, ResourceContents, TextResourceContents\n\n@app.list_resources()\nasync def list_resources():\n    return [Resource(uri=\"file:\u002F\u002F\u002Fdocs\u002Freadme.md\", name=\"README\",\n                     description=\"Documentation\", mimeType=\"text\u002Fmarkdown\")]\n\n@app.read_resource()\nasync def read_resource(uri: str):\n    if uri.startswith(\"file:\u002F\u002F\"):\n        with open(uri[7:], 'r') as f:\n            return ResourceContents(contents=[TextResourceContents(\n                uri=uri, mimeType=\"text\u002Fmarkdown\", text=f.read())])\n```\n\nSee [Resource Server Example](.\u002Fexamples\u002Fresource-server.md) for complete implementation.\n\n### Phase 5: Error Handling and Testing\n\n**Error Response Pattern:**\n```python\nasync def call_tool(name: str, arguments: dict):\n    try:\n        return [TextContent(type=\"text\", text=await execute_tool(name, arguments))]\n    except ValueError as e:\n        return [TextContent(type=\"text\", text=f\"Invalid input: {str(e)}\", isError=True)]\n    except Exception as e:\n        logger.exception(\"Unexpected error\")\n        return [TextContent(type=\"text\", text=f\"Error: {type(e).__name__}\", isError=True)]\n```\n\n**Testing:**\n\n```bash\n# Test with MCP inspector\nnpx @modelcontextprotocol\u002Finspector python server.py\n```\n\nSee [Testing and Debugging Guide](.\u002Freferences\u002Ftesting-debugging.md) for comprehensive strategies.\n\n### Phase 6: Claude Desktop Integration\n\n**Configuration:** Edit `claude_desktop_config.json`:\n- macOS: `~\u002FLibrary\u002FApplication Support\u002FClaude\u002F`\n- Windows: `%APPDATA%\\Claude\u002F`\n- Linux: `~\u002F.config\u002FClaude\u002F`\n\n```json\n{\n  \"mcpServers\": {\n    \"my-server\": {\n      \"command\": \"python\",\n      \"args\": [\"\u002Fabsolute\u002Fpath\u002Fto\u002Fserver.py\"],\n      \"env\": {\"API_KEY\": \"your-key\"}\n    }\n  }\n}\n```\n\n## Best Practices\n\n### Tool Schema Design\n\n**Use descriptive names:**\n```python\n# ✅ Good\n\"search_customer_by_email\"\n\"calculate_shipping_cost\"\n\n# ❌ Bad\n\"search\"\n\"calc\"\n```\n\n**Provide comprehensive descriptions:**\n```python\n# ✅ Good\ndescription=\"\"\"\nSearch for customers by email address. Returns customer profile including:\n- Contact information\n- Order history\n- Account status\n\"\"\"\n\n# ❌ Bad\ndescription=\"Search customers\"\n```\n\n**Use enums for fixed options:**\n```python\n# ✅ Good\n\"status\": {\n    \"type\": \"string\",\n    \"enum\": [\"pending\", \"approved\", \"rejected\"],\n    \"description\": \"Application status\"\n}\n```\n\n### Error Handling Strategies\n\nCategorize errors with custom exceptions and provide actionable messages:\n\n```python\nclass ValidationError(Exception): pass\nclass AuthenticationError(Exception): pass\n\nasync def call_tool(name: str, arguments: dict):\n    try:\n        return await execute_tool(name, arguments)\n    except ValidationError as e:\n        return [TextContent(type=\"text\", text=f\"Invalid input: {str(e)}\", isError=True)]\n```\n\n### Security Considerations\n\nAlways validate inputs and use environment variables for secrets:\n\n```python\n# Input validation\ndef validate_url(url: str) -> bool:\n    if urlparse(url).scheme not in ['http', 'https']:\n        raise ValidationError(\"Only HTTP\u002FHTTPS URLs allowed\")\n\n# Secrets management\nAPI_KEY = os.getenv(\"API_KEY\")  # ✅ Good\n# API_KEY = \"sk-1234\"  # ❌ Bad - Never hardcode!\n```\n\n### Performance Optimization\n\nUse connection pooling and parallel async operations:\n\n```python\n# ✅ Parallel execution\nresults = await asyncio.gather(*[fetch_user_data(uid) for uid in user_ids])\n\n# ❌ Sequential execution (slow)\nfor user_id in user_ids:\n    result = await fetch_user_data(user_id)\n```\n\n## Common Pitfalls\n\n### Schema Validation Errors\n\n**Missing required validation:**\n```python\n# ❌ Bad: No validation\nasync def handle_create_user(arguments: dict):\n    username = arguments[\"username\"]  # Will crash if missing!\n\n# ✅ Good: Validate inputs\nasync def handle_create_user(arguments: dict):\n    if \"username\" not in arguments:\n        return [TextContent(type=\"text\", text=\"Error: username required\", isError=True)]\n    username = arguments[\"username\"]\n```\n\n### Authentication Issues\n\n**Insecure storage:**\n```python\n# ❌ Bad: Hardcoded API key\nAPI_KEY = \"sk-1234567890abcdef\"\n\n# ✅ Good: Environment variables\nAPI_KEY = os.getenv(\"API_KEY\")\nif not API_KEY:\n    raise ValueError(\"API_KEY environment variable required\")\n```\n\n### Transport Configuration\n\n**Path issues:**\n```python\n# ❌ Bad: Relative path\n{\n  \"command\": \"python\",\n  \"args\": [\"server.py\"]  # Won't work!\n}\n\n# ✅ Good: Absolute path\n{\n  \"command\": \"python\",\n  \"args\": [\"\u002FUsers\u002Fusername\u002Fprojects\u002Fmcp-server\u002Fserver.py\"]\n}\n```\n\n### Error Propagation\n\n**Silent failures:**\n```python\n# ❌ Bad: Silent failure\nasync def call_tool(name: str, arguments: dict):\n    try:\n        return await execute_tool(name, arguments)\n    except Exception:\n        return [TextContent(type=\"text\", text=\"Something went wrong\")]\n\n# ✅ Good: Descriptive errors\nasync def call_tool(name: str, arguments: dict):\n    try:\n        return await execute_tool(name, arguments)\n    except ValueError as e:\n        return [TextContent(type=\"text\", text=f\"Invalid input: {str(e)}\", isError=True)]\n    except Exception as e:\n        logger.exception(\"Unexpected error\")\n        return [TextContent(type=\"text\", text=f\"Error: {type(e).__name__}\", isError=True)]\n```\n\n**Not marking errors:**\n```python\n# ❌ Bad\nreturn [TextContent(type=\"text\", text=\"Error: Failed\")]\n\n# ✅ Good\nreturn [TextContent(type=\"text\", text=\"Error: Failed\", isError=True)]\n```\n\n## Additional Resources\n\n### Official Documentation\n- MCP Specification: https:\u002F\u002Fmodelcontextprotocol.io\u002F\n- Python SDK: https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Fpython-sdk\n- TypeScript SDK: https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Ftypescript-sdk\n\n### Detailed References\n- [Protocol Specification](.\u002Freferences\u002Fprotocol-specification.md) - Complete protocol details, message formats, transport mechanisms\n- [Tool Schema Guide](.\u002Freferences\u002Ftool-schemas.md) - Comprehensive schema patterns and validation\n- [Security Best Practices](.\u002Freferences\u002Fsecurity-guide.md) - Authentication, authorization, input validation, secrets management\n- [Testing and Debugging](.\u002Freferences\u002Ftesting-debugging.md) - Unit tests, integration tests, MCP inspector usage, debugging techniques\n- [Production Deployment](.\u002Freferences\u002Fproduction-deployment.md) - Production configuration, monitoring, scaling, Docker deployment\n\n### Complete Examples\n- [Simple Calculator Server](.\u002Fexamples\u002Fsimple-calculator-server.md) - Basic arithmetic tools\n- [REST API Wrapper](.\u002Fexamples\u002Frest-api-wrapper.md) - GitHub API integration\n- [Database Server](.\u002Fexamples\u002Fdatabase-server.md) - Safe database query access\n- [Resource Server](.\u002Fexamples\u002Fresource-server.md) - Static and dynamic resources\n\n### Tools\n- MCP Inspector: https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Finspector\n- Claude Desktop: https:\u002F\u002Fclaude.ai\u002Fdownload\n\n## Quick Reference\n\n### Server Template (Python)\n```python\nfrom mcp.server import Server\nfrom mcp.server.stdio import stdio_server\nfrom mcp.types import Tool, TextContent\nimport asyncio\n\napp = Server(\"my-server\")\n\n@app.list_tools()\nasync def list_tools():\n    return [Tool(name=\"my_tool\", description=\"...\", inputSchema={...})]\n\n@app.call_tool()\nasync def call_tool(name: str, arguments: dict):\n    if name == \"my_tool\":\n        return [TextContent(type=\"text\", text=\"Result\")]\n\nasync def main():\n    async with stdio_server() as (read_stream, write_stream):\n        await app.run(read_stream, write_stream, app.create_initialization_options())\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### Common Patterns\n\n**Error handling:**\n```python\nreturn [TextContent(type=\"text\", text=\"Error message\", isError=True)]\n```\n\n**Async operations:**\n```python\nresults = await asyncio.gather(*tasks)\n```\n\n**Input validation:**\n```python\nif \"required_param\" not in arguments:\n    return [TextContent(type=\"text\", text=\"Missing parameter\", isError=True)]\n```\n\n---\n\n**End of MCP Builder Skill Guide**\n\nFor complete working examples and detailed technical references, explore the `examples\u002F` and `references\u002F` directories.\n",{"name":5,"description":7},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill mcp-builder",{"tool":59,"command":60},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill mcp-builder",{"tool":62,"command":63},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill mcp-builder","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002FSKILL.md",true,[67,73,79,83,87,91,95,99,103,107,111,115,119,123],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"examples\u002Fadvanced-server.py","SCRIPT","脚本",29330,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Fexamples\u002Fadvanced-server.py",{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"examples\u002Fdatabase-server.md","REFERENCE","参考文档",8016,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Fexamples\u002Fdatabase-server.md",{"path":80,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":81,"sourceHtmlUrl":82},"examples\u002Fresource-server.md",6186,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Fexamples\u002Fresource-server.md",{"path":84,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":85,"sourceHtmlUrl":86},"examples\u002Fresource-server.py",23272,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Fexamples\u002Fresource-server.py",{"path":88,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":89,"sourceHtmlUrl":90},"examples\u002Frest-api-wrapper.md",5866,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Fexamples\u002Frest-api-wrapper.md",{"path":92,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":93,"sourceHtmlUrl":94},"examples\u002Fsimple-calculator-server.md",3628,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Fexamples\u002Fsimple-calculator-server.md",{"path":96,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":97,"sourceHtmlUrl":98},"examples\u002Fsimple-server.py",10079,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Fexamples\u002Fsimple-server.py",{"path":100,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":101,"sourceHtmlUrl":102},"README.md",10176,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002FREADME.md",{"path":104,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":105,"sourceHtmlUrl":106},"references\u002Fproduction-deployment.md",10489,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Freferences\u002Fproduction-deployment.md",{"path":108,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":109,"sourceHtmlUrl":110},"references\u002Fprotocol-specification.md",3120,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Freferences\u002Fprotocol-specification.md",{"path":112,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":113,"sourceHtmlUrl":114},"references\u002Fsecurity-guide.md",7894,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Freferences\u002Fsecurity-guide.md",{"path":116,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":117,"sourceHtmlUrl":118},"references\u002Ftesting-debugging.md",9592,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Freferences\u002Ftesting-debugging.md",{"path":120,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":121,"sourceHtmlUrl":122},"references\u002Ftool-schemas.md",5700,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Freferences\u002Ftool-schemas.md",{"path":124,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":125,"sourceHtmlUrl":126},"skill-report.json",13364,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fautumnsgrove\u002Fmcp-builder\u002Fskill-report.json",[128,136,144,153,159,165],{"skillNo":129,"name":130,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[28,134,135],"model hierarchy","model hierarchy skill",{"skillNo":137,"name":138,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[20,142,143],"zoom","zoom mcp",{"skillNo":145,"name":146,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":149,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[150,151,152,142],"sdk","zoom apps sdk","apps",{"skillNo":154,"name":155,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[155],{"skillNo":160,"name":161,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[161],{"skillNo":166,"name":167,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":168,"categories":169,"keywords":170,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[167]]