mcp-developer
MCP Server Developer
⚠️ MANDATORY COMPLIANCE ⚠️
CRITICAL: The 5-step workflow outlined in this document MUST be followed in exact order for EVERY MCP server development task. Skipping steps or deviating from the procedure will result in incomplete or insecure server implementations. This is non-negotiable.
File Structure
- SKILL.md (this file): Main instructions and MANDATORY workflow
- examples.md: Usage scenarios with different MCP server types and integration patterns
- Memory: Project-specific memory accessed via
memoryStore.getSkillMemory("mcp-developer", "{project-name}"). See MemoryStore Interface.
Interface References
- ContextProvider:
contextProvider.getIndex("mcp")— Load MCP-related context. See ContextProvider Interface. - MemoryStore:
memoryStore.getSkillMemory("mcp-developer", "{project-name}")— Read/write project-specific MCP memory. See MemoryStore Interface. - Schemas: Validate configurations against
agent_config.schema.jsonandcontext_metadata.schema.json. See Schemas.
Focus Areas
MCP server development evaluates 7 critical dimensions:
- MCP Server Architecture: Design the server lifecycle including initialization, request handling, and graceful shutdown. Select the appropriate transport layer (stdio for local CLI tools, SSE for remote/web integrations). Implement robust session management for stateful interactions.
- Tool Registration: Define tools with precise JSON Schema input specifications, implement thorough input validation, and provide structured error responses. Each tool must have a clear name, description, and well-documented parameter schema.
- Resource Exposure: Expose application data as MCP resources with well-designed URI templates. Support appropriate content types (text, binary, JSON) and implement resource listing with pagination where needed.
- Prompt Templates: Create reusable prompt templates with typed parameters that guide AI assistants toward effective use of the server's tools and resources. Templates should encode best practices and common workflows.
- Security & Sandboxing: Implement input sanitization for all tool parameters, enforce permission boundaries to limit server capabilities, and apply rate limiting to prevent abuse. Never trust client input without validation.
- Testing & Debugging: Use MCP Inspector for interactive testing, write integration tests with mock clients, and verify protocol compliance. Test edge cases including malformed requests, timeouts, and concurrent access.
- Client Integration: Configure and connect the MCP server to Claude Desktop, VS Code, and other MCP-compatible clients. Handle transport negotiation, capability advertisement, and graceful degradation.
Note: The skill guides architecture, implementation, and testing of MCP servers. It does not deploy servers to production unless explicitly requested.
MANDATORY WORKFLOW (MUST FOLLOW EXACTLY)
⚠️ STEP 1: Analyze MCP Requirements (REQUIRED)
YOU MUST:
- Determine which tools the server needs to expose (actions the AI can perform)
- Determine which resources the server needs to expose (data the AI can read)
- Determine which prompt templates would guide effective server usage
- Identify the target AI clients (Claude Desktop, VS Code, custom integrations)
- Assess data sensitivity and security requirements for exposed capabilities
- Review any existing API or service that the MCP server will wrap
DO NOT PROCEED WITHOUT UNDERSTANDING THE REQUIREMENTS
⚠️ STEP 2: Design Server Architecture (REQUIRED)
YOU MUST:
- Choose transport layer:
stdio— for local CLI tools, subprocess-based integrations, low latencySSE(Server-Sent Events) — for remote/web integrations, multi-client support
- Define tool schemas: For each tool, specify name, description, and JSON Schema for
inputSchema - Define resource URIs: Design URI templates for each resource (e.g.,
db://tables/{table_name}/schema) - Define prompt templates: Design parameterized prompts for common workflows
- Plan security boundaries: Determine what the server is allowed to access and what is off-limits
- Plan error handling strategy: Define how validation errors, runtime errors, and permission errors are surfaced to clients
DO NOT PROCEED WITHOUT A CLEAR ARCHITECTURE
⚠️ STEP 3: Load Project Memory (REQUIRED)
YOU MUST:
- Use
memoryStore.getSkillMemory("mcp-developer", "{project-name}")to load project-specific MCP patterns. See MemoryStore Interface. - Check for existing server architecture decisions and tool registries
- Check for known integration patterns or client-specific workarounds
- If no memory exists, proceed with defaults and create memory entries after implementation
DO NOT PROCEED WITHOUT CHECKING PROJECT MEMORY
⚠️ STEP 4: Implement MCP Server (REQUIRED)
YOU MUST:
- Server setup: Initialize the MCP server with name, version, and capability declarations
- Tool implementation: Register each tool with its handler, input validation, and error handling
- Resource implementation: Register resource handlers with URI templates and content type negotiation
- Prompt implementation: Register prompt templates with parameter definitions and template rendering
- Error handling: Implement structured error responses following MCP error codes
- Testing: Write integration tests using MCP Inspector or mock client, verify each tool/resource/prompt
DO NOT PROCEED WITHOUT TESTING ALL ENDPOINTS
⚠️ STEP 5: Review & Output (REQUIRED)
YOU MUST validate the implementation against these criteria:
- Protocol compliance:
- Server responds correctly to
initializehandshake - All tools return valid
CallToolResultresponses - All resources return valid
ReadResourceResultresponses - Error responses use proper MCP error codes
- Server responds correctly to
- Security review:
- All tool inputs are validated against JSON Schema
- No unsanitized user input reaches system commands or queries
- Permission boundaries are enforced
- Documentation:
- Each tool has a clear description and input schema
- Each resource has a documented URI template
- Client configuration instructions are provided
- Output the final implementation to
/claudedocs/followingOUTPUT_CONVENTIONS.md - Update memory: Use
memoryStore.update("mcp-developer", "{project-name}", ...)to store architecture decisions, tool registries, and integration patterns. See MemoryStore Interface.
DO NOT SKIP VALIDATION
Compliance Checklist
Before completing ANY MCP server development task, verify:
- Step 1: Requirements analyzed — tools, resources, prompts, security needs identified
- Step 2: Architecture designed — transport chosen, schemas defined, security planned
- Step 3: Project memory checked for existing patterns and decisions
- Step 4: Server implemented with tools, resources, prompts, error handling, and tests
- Step 5: Implementation validated, output generated, memory updated
FAILURE TO COMPLETE ALL STEPS INVALIDATES THE IMPLEMENTATION
MCP Architecture Reference
Server Types
| Type | Transport | Use Case |
|---|---|---|
| Local tool server | stdio | CLI tools, file operations, local databases |
| Remote service server | SSE | Web APIs, cloud services, multi-client access |
| Hybrid server | stdio + SSE | Servers that support both local and remote clients |
Transport Options
| Transport | Pros | Cons |
|---|---|---|
| stdio | Low latency, simple setup, no network | Single client, local only |
| SSE | Multi-client, remote access, web-friendly | Higher latency, requires HTTP server |
Message Flow
Client Server
│ │
│── initialize ────────────────►│
│◄── initialize response ───────│
│── initialized notification ──►│
│ │
│── tools/list ────────────────►│
│◄── tools list response ───────│
│ │
│── tools/call ────────────────►│
│◄── call result ───────────────│
│ │
│── resources/list ────────────►│
│◄── resources list response ───│
│ │
│── resources/read ────────────►│
│◄── read result ───────────────│
│ │
│── shutdown ──────────────────►│
│◄── shutdown response ─────────│
Output File Naming Convention
Format: mcp_server_{server_name}.md
Where:
{server_name}= the name of the MCP server being developed
Examples:
mcp_server_database_query.mdmcp_server_file_manager.mdmcp_server_github_integration.md
Further Reading
Refer to official documentation:
- MCP Specification: https://spec.modelcontextprotocol.io/
- MCP TypeScript SDK: https://github.com/modelcontextprotocol/typescript-sdk
- MCP Python SDK: https://github.com/modelcontextprotocol/python-sdk
- MCP Inspector: https://github.com/modelcontextprotocol/inspector
- MCP Servers Repository: https://github.com/modelcontextprotocol/servers
Version History
- v1.0.0 (2026-02-12): Initial release
- Mandatory 5-step workflow for MCP server development
- 7 focus areas covering architecture, tools, resources, prompts, security, testing, and integration
- Transport layer guidance (stdio/SSE)
- MCP Inspector testing integration
- Project memory integration for architecture decisions and tool registries