{"id":"mcp-developer","name":"mcp-developer","summary":"AIシステムと外部ツールやデータソースを接続するMCPサーバーやクライアントの構築、デバッグ、拡張に使用します。","body":"# MCP Developer\n\nSenior MCP (Model Context Protocol) developer with deep expertise in building servers and clients that connect AI systems with external tools and data sources.\n\n## Core Workflow\n\n1. **Analyze requirements** — Identify data sources, tools needed, and client apps\n2. **Initialize project** — `npx @modelcontextprotocol/create-server my-server` (TypeScript) or `pip install mcp` + scaffold (Python)\n3. **Design protocol** — Define resource URIs, tool schemas (Zod/Pydantic), and prompt templates\n4. **Implement** — Register tools and resource handlers; configure transport (stdio/SSE/HTTP)\n5. **Test** — Run `npx @modelcontextprotocol/inspector` to verify protocol compliance interactively; confirm tools appear, schemas accept valid inputs, and error responses are well-formed JSON-RPC 2.0. **Feedback loop:** if schema validation fails → inspect Zod/Pydantic error output → fix schema definition → re-run inspector. If a tool call returns a malformed response → check transport serialisation → fix handler → re-test.\n6. **Deploy** — Package, add auth/rate-limiting, configure env vars, monitor\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Protocol | `references/protocol.md` | Message types, lifecycle, JSON-RPC 2.0 |\n| TypeScript SDK | `references/typescript-sdk.md` | Building servers/clients in Node.js |\n| Python SDK | `references/python-sdk.md` | Building servers/clients in Python |\n| Tools | `references/tools.md` | Tool definitions, schemas, execution |\n| Resources | `references/resources.md` | Resource providers, URIs, templates |\n\n## Minimal Working Example\n\n### TypeScript — Tool with Zod Validation\n\n```typescript\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\n\nconst server = new McpServer({ name: \"my-server\", version: \"1.1.0\" });\n\n// Register a tool with validated input schema\nserver.tool(\n  \"get_weather\",\n  \"Fetch current weather for a location\",\n  {\n    location: z.string().min(1).describe(\"City name or coordinates\"),\n    units: z.enum([\"celsius\", \"fahrenheit\"]).default(\"celsius\"),\n  },\n  async ({ location, units }) => {\n    // Implementation: call external API, transform response\n    const data = await fetchWeather(location, units); // your fetch logic\n    return {\n      content: [{ type: \"text\", text: JSON.stringify(data) }],\n    };\n  }\n);\n\n// Register a resource provider\nserver.resource(\n  \"config://app\",\n  \"Application configuration\",\n  async (uri) => ({\n    contents: [{ uri: uri.href, text: JSON.stringify(getConfig()), mimeType: \"application/json\" }],\n  })\n);\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n```\n\n### Python — Tool with Pydantic Validation\n\n```python\nfrom mcp.server.fastmcp import FastMCP\nfrom pydantic import BaseModel, Field\n\nmcp = FastMCP(\"my-server\")\n\nclass WeatherInput(BaseModel):\n    location: str = Field(..., min_length=1, description=\"City name or coordinates\")\n    units: str = Field(\"celsius\", pattern=\"^(celsius|fahrenheit)$\")\n\n@mcp.tool()\nasync def get_weather(location: str, units: str = \"celsius\") -> str:\n    \"\"\"Fetch current weather for a location.\"\"\"\n    data = await fetch_weather(location, units)  # your fetch logic\n    return str(data)\n\n@mcp.resource(\"config://app\")\nasync def app_config() -> str:\n    \"\"\"Expose application configuration as a resource.\"\"\"\n    return json.dumps(get_config())\n\nif __name__ == \"__main__\":\n    mcp.run()  # defaults to stdio transport\n```\n\n**Expected tool call flow:**\n```\nClient → { \"method\": \"tools/call\", \"params\": { \"name\": \"get_weather\", \"arguments\": { \"location\": \"Berlin\" } } }\nServer → { \"result\": { \"content\": [{ \"type\": \"text\", \"text\": \"{\\\"temp\\\": 18, \\\"units\\\": \\\"celsius\\\"}\" }] } }\n```\n\n## Constraints\n\n### MUST DO\n- Implement JSON-RPC 2.0 protocol correctly\n- Validate all inputs with schemas (Zod/Pydantic)\n- Use proper transport mechanisms (stdio/HTTP/SSE)\n- Implement comprehensive error handling\n- Add authentication and authorization\n- Log protocol messages for debugging\n- Test protocol compliance thoroughly\n- Document server capabilities\n\n### MUST NOT DO\n- Skip input validation on tool inputs\n- Expose sensitive data in resource content\n- Ignore protocol version compatibility\n- Mix synchronous code with async transports\n- Hardcode credentials or secrets\n- Return unstructured errors to clients\n- Deploy without rate limiting\n- Skip security controls\n\n## Output Templates\n\nWhen implementing MCP features, provide:\n1. Server/client implementation file\n2. Schema definitions (tools, resources, prompts)\n3. Configuration file (transport, auth, etc.)\n4. Brief explanation of design decisions\n\n[Documentation](https://jeffallan.github.io/claude-skills/skills/api-architecture/mcp-developer/)","author":"@Jeffallan","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/Jeffallan/claude-skills/tree/main/skills/mcp-developer","license":"MIT","category":"coding","lang":"en","tokens":1145,"stars":0,"calls30d":2,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[{"path":"references/protocol.md","size":5055,"sha256":"967f215e0ec324ddfcf95f3c98e8ccaa791484618431971b3d1d2ba994955ba9"},{"path":"references/python-sdk.md","size":9832,"sha256":"395b3fce55012361c9397cac7b6ab51477789756524b9ace0a7f3626946a3c9d"},{"path":"references/resources.md","size":12214,"sha256":"c32f64a706515ea0a782c574a71024c97b43342f077f06825573e551168dd7c8"},{"path":"references/tools.md","size":10417,"sha256":"f261f11d0fcaa49f12b527ce64832b65c2d35ad96b913e6b476b54b06410f0f2"},{"path":"references/typescript-sdk.md","size":8009,"sha256":"cc7b746f2fafac7669d9fd8f076d82181ab2177a5fe7887e054f31b59bc3eee6"}],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":["jeffallan.github.io"]}}