Guide 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).
37k tokens
context cost
the whole folder, loaded on every use
10
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
3248
stars on the repo
on the repository, not the skill itself
Install
one command, takes just this skill from the repository
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.
Process
🚀 High-Level Workflow
Creating a high-quality MCP server involves four main phases:
Phase 1: Deep Research and Planning
1.1 Understand Agent-Centric Design Principles
Before diving into implementation, understand how to design tools for AI agents by reviewing these principles:
For Node/TypeScript: Load ⚡ TypeScript Implementation Guide and ensure the following:
Using server.registerTool properly
Zod schemas with .strict()
TypeScript strict mode enabled
No any types - use proper types
Explicit Promise<T> return types
Build process configured (npm run build)
Phase 3: Review and Refine
After initial implementation:
3.1 Code Quality Review
To ensure quality, review the code for:
DRY Principle: No duplicated code between tools
Composability: Shared logic extracted into functions
Consistency: Similar operations return similar formats
Error Handling: All external calls have error handling
Type Safety: Full type coverage (Python type hints, TypeScript types)
Documentation: Every tool has comprehensive docstrings/descriptions
3.2 Test and Build
Important: MCP servers are long-running processes that wait for requests over stdio/stdin or sse/http. Running them directly in your main process (e.g., python server.py or node dist/index.js) will cause your process to hang indefinitely.
Safe ways to test the server:
Use the evaluation harness (see Phase 4) - recommended approach
Run the server in tmux to keep it outside your main process
Use a timeout when testing: timeout 5s python server.py
Answer Verification: Solve each question yourself to verify answers
4.3 Evaluation Requirements
Each question must be:
Independent: Not dependent on other questions
Read-only: Only non-destructive operations required
Complex: Requiring multiple tool calls and deep exploration
Realistic: Based on real use cases humans would care about
Verifiable: Single, clear answer that can be verified by string comparison
Stable: Answer won't change over time
4.4 Output Format
Create an XML file with this structure:
<evaluation>
<qa_pair>
<question>Find discussions about AI model launches with animal codenames. One model needed a specific safety designation that uses the format ASL-X. What number X was being determined for the model named after a spotted wild cat?</question>
<answer>3</answer>
</qa_pair>
<!-- More qa_pairs... -->
</evaluation>
Reference Files
📚 Documentation Library
Load these resources as needed during development:
Core MCP Documentation (Load First)
MCP Protocol: Fetch from https://modelcontextprotocol.io/llms-full.txt - Complete MCP specification
📋 MCP Best Practices - Universal MCP guidelines including:
Server and tool naming conventions
Response format guidelines (JSON vs Markdown)
Pagination best practices
Character limits and truncation strategies
Tool development guidelines
Security and error handling standards
SDK Documentation (Load During Phase 1/2)
Python SDK: Fetch from https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md
TypeScript SDK: Fetch from https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md
Language-Specific Implementation Guides (Load During Phase 2)