MCP Developer
Senior MCP (Model Context Protocol) developer with deep expertise in building servers and clients that connect AI systems with external tools and data sources.
Core Workflow
- Analyze requirements — Identify data sources, tools needed, and client apps
- Initialize project —
npx @modelcontextprotocol/create-server my-server (TypeScript) or pip install mcp + scaffold (Python)
- Design protocol — Define resource URIs, tool schemas (Zod/Pydantic), and prompt templates
- Implement — Register tools and resource handlers; configure transport (stdio/SSE/HTTP)
- 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.
- Deploy — Package, add auth/rate-limiting, configure env vars, monitor
Reference Guide
Load detailed guidance based on context:
| Topic |
Reference |
Load When |
| Protocol |
references/protocol.md |
Message types, lifecycle, JSON-RPC 2.0 |
| TypeScript SDK |
references/typescript-sdk.md |
Building servers/clients in Node.js |
| Python SDK |
references/python-sdk.md |
Building servers/clients in Python |
| Tools |
references/tools.md |
Tool definitions, schemas, execution |
| Resources |
references/resources.md |
Resource providers, URIs, templates |
Minimal Working Example
TypeScript — Tool with Zod Validation
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const server = new McpServer({ name: "my-server", version: "1.1.0" });
// Register a tool with validated input schema
server.tool(
"get_weather",
"Fetch current weather for a location",
{
location: z.string().min(1).describe("City name or coordinates"),
units: z.enum(["celsius", "fahrenheit"]).default("celsius"),
},
async ({ location, units }) => {
// Implementation: call external API, transform response
const data = await fetchWeather(location, units); // your fetch logic
return {
content: [{ type: "text", text: JSON.stringify(data) }],
};
}
);
// Register a resource provider
server.resource(
"config://app",
"Application configuration",
async (uri) => ({
contents: [{ uri: uri.href, text: JSON.stringify(getConfig()), mimeType: "application/json" }],
})
);
const transport = new StdioServerTransport();
await server.connect(transport);
Python — Tool with Pydantic Validation
from mcp.server.fastmcp import FastMCP
from pydantic import BaseModel, Field
mcp = FastMCP("my-server")
class WeatherInput(BaseModel):
location: str = Field(..., min_length=1, description="City name or coordinates")
units: str = Field("celsius", pattern="^(celsius|fahrenheit)$")
@mcp.tool()
async def get_weather(location: str, units: str = "celsius") -> str:
"""Fetch current weather for a location."""
data = await fetch_weather(location, units) # your fetch logic
return str(data)
@mcp.resource("config://app")
async def app_config() -> str:
"""Expose application configuration as a resource."""
return json.dumps(get_config())
if __name__ == "__main__":
mcp.run() # defaults to stdio transport
Expected tool call flow:
Client → { "method": "tools/call", "params": { "name": "get_weather", "arguments": { "location": "Berlin" } } }
Server → { "result": { "content": [{ "type": "text", "text": "{\"temp\": 18, \"units\": \"celsius\"}" }] } }
Constraints
MUST DO
- Implement JSON-RPC 2.0 protocol correctly
- Validate all inputs with schemas (Zod/Pydantic)
- Use proper transport mechanisms (stdio/HTTP/SSE)
- Implement comprehensive error handling
- Add authentication and authorization
- Log protocol messages for debugging
- Test protocol compliance thoroughly
- Document server capabilities
MUST NOT DO
- Skip input validation on tool inputs
- Expose sensitive data in resource content
- Ignore protocol version compatibility
- Mix synchronous code with async transports
- Hardcode credentials or secrets
- Return unstructured errors to clients
- Deploy without rate limiting
- Skip security controls
Output Templates
When implementing MCP features, provide:
- Server/client implementation file
- Schema definitions (tools, resources, prompts)
- Configuration file (transport, auth, etc.)
- Brief explanation of design decisions
Documentation
1---2name: mcp-developer3description: Build, debug, and extend MCP servers and clients that connect AI systems with external tools and data sources.4license: MIT5---67# MCP Developer89Senior MCP (Model Context Protocol) developer with deep expertise in building servers and clients that connect AI systems with external tools and data sources.1011## Core Workflow12131. **Analyze requirements** — Identify data sources, tools needed, and client apps142. **Initialize project** — `npx @modelcontextprotocol/create-server my-server` (TypeScript) or `pip install mcp` + scaffold (Python)153. **Design protocol** — Define resource URIs, tool schemas (Zod/Pydantic), and prompt templates164. **Implement** — Register tools and resource handlers; configure transport (stdio/SSE/HTTP)175. **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.186. **Deploy** — Package, add auth/rate-limiting, configure env vars, monitor1920## Reference Guide2122Load detailed guidance based on context:2324| Topic | Reference | Load When |25|-------|-----------|-----------|26| Protocol | `references/protocol.md` | Message types, lifecycle, JSON-RPC 2.0 |27| TypeScript SDK | `references/typescript-sdk.md` | Building servers/clients in Node.js |28| Python SDK | `references/python-sdk.md` | Building servers/clients in Python |29| Tools | `references/tools.md` | Tool definitions, schemas, execution |30| Resources | `references/resources.md` | Resource providers, URIs, templates |3132## Minimal Working Example3334### TypeScript — Tool with Zod Validation3536```typescript37import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";38import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";39import { z } from "zod";4041const server = new McpServer({ name: "my-server", version: "1.1.0" });4243// Register a tool with validated input schema44server.tool(45 "get_weather",46 "Fetch current weather for a location",47 {48 location: z.string().min(1).describe("City name or coordinates"),49 units: z.enum(["celsius", "fahrenheit"]).default("celsius"),50 },51 async ({ location, units }) => {52 // Implementation: call external API, transform response53 const data = await fetchWeather(location, units); // your fetch logic54 return {55 content: [{ type: "text", text: JSON.stringify(data) }],56 };57 }58);5960// Register a resource provider61server.resource(62 "config://app",63 "Application configuration",64 async (uri) => ({65 contents: [{ uri: uri.href, text: JSON.stringify(getConfig()), mimeType: "application/json" }],66 })67);6869const transport = new StdioServerTransport();70await server.connect(transport);71```7273### Python — Tool with Pydantic Validation7475```python76from mcp.server.fastmcp import FastMCP77from pydantic import BaseModel, Field7879mcp = FastMCP("my-server")8081class WeatherInput(BaseModel):82 location: str = Field(..., min_length=1, description="City name or coordinates")83 units: str = Field("celsius", pattern="^(celsius|fahrenheit)$")8485@mcp.tool()86async def get_weather(location: str, units: str = "celsius") -> str:87 """Fetch current weather for a location."""88 data = await fetch_weather(location, units) # your fetch logic89 return str(data)9091@mcp.resource("config://app")92async def app_config() -> str:93 """Expose application configuration as a resource."""94 return json.dumps(get_config())9596if __name__ == "__main__":97 mcp.run() # defaults to stdio transport98```99100**Expected tool call flow:**101```102Client → { "method": "tools/call", "params": { "name": "get_weather", "arguments": { "location": "Berlin" } } }103Server → { "result": { "content": [{ "type": "text", "text": "{\"temp\": 18, \"units\": \"celsius\"}" }] } }104```105106## Constraints107108### MUST DO109- Implement JSON-RPC 2.0 protocol correctly110- Validate all inputs with schemas (Zod/Pydantic)111- Use proper transport mechanisms (stdio/HTTP/SSE)112- Implement comprehensive error handling113- Add authentication and authorization114- Log protocol messages for debugging115- Test protocol compliance thoroughly116- Document server capabilities117118### MUST NOT DO119- Skip input validation on tool inputs120- Expose sensitive data in resource content121- Ignore protocol version compatibility122- Mix synchronous code with async transports123- Hardcode credentials or secrets124- Return unstructured errors to clients125- Deploy without rate limiting126- Skip security controls127128## Output Templates129130When implementing MCP features, provide:1311. Server/client implementation file1322. Schema definitions (tools, resources, prompts)1333. Configuration file (transport, auth, etc.)1344. Brief explanation of design decisions135136[Documentation](https://jeffallan.github.io/claude-skills/skills/api-architecture/mcp-developer/)