M

MCP Builder

Guide for creating high-quality MCP servers to integrate external APIs and services

Home/Dev/MCP Builder

WhatIsIt

A comprehensive guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. MCP servers provide tools that allow LLMs to access external services and APIs. This skill covers both Python (FastMCP) and Node/TypeScript (MCP SDK) implementations, focusing on agent-centric design principles and evaluation-driven development.

HowToUse

Development follows a structured four-phase process:

Phase 1: Deep Research and Planning

  • Study agent-centric design principles (build for workflows, not just API endpoints)
  • Fetch and study MCP protocol documentation
  • Load framework documentation (Python SDK or TypeScript SDK)
  • Exhaustively study target API documentation
  • Create comprehensive implementation plan

Phase 2: Implementation

  • Set up proper project structure
  • Implement core infrastructure (API helpers, error handling, formatting)
  • Implement tools systematically with proper input validation (Pydantic/Zod)
  • Follow language-specific best practices
  • Add tool annotations (readOnlyHint, destructiveHint, etc.)

Phase 3: Review and Refine

  • Review code quality (DRY principle, composability, consistency)
  • Test and build (avoiding main process hangs)
  • Use quality checklists from language guides

Phase 4: Create Evaluations

  • Write 10 complex, realistic evaluation questions
  • Ensure questions are independent, read-only, and verifiable
  • Create XML evaluation file for testing

KeyFeatures

  • Agent-centric design principles - Build tools for complete workflows, not just API wrappers
  • Context optimization - Return high-signal information, avoid data dumps
  • Actionable error messages - Guide agents toward correct usage
  • Support for both Python (FastMCP) and TypeScript (MCP SDK)
  • Comprehensive documentation library with protocol specs and best practices
  • Input validation with Pydantic v2 (Python) or Zod (TypeScript)
  • Evaluation harness for testing LLM effectiveness with your tools
  • Pagination, filtering, and character limit strategies
  • Quality checklists ensuring production-ready code
ViewOnGitHub

GithubStats

Stars
5.3k
Forks
408
LastUpdate
Jan 15, 2025

Information

Author
Anthropic
License
Apache-2.0
Version
1.0.0

Categories

Dev

Tags

mcp
api
integration
python
typescript

Features

Featured
CodeExecution

RelatedSkills

MoreFrom