Mcp Builder

composio-community/awesome-claude-plugins/mcp-builder/skills/mcp-builder

作者 composio-communitye521f7ada8d89abea888e67b93b4dcfbb977041f無授權條款1.9K 個星標收錄於 2026年10月9日更新於 2026年10月9日儲存庫2 個月前更新

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).

僅含說明AI & Agents
AI 產生的概覽

指導建置 MCP 伺服器,透過設計良好的工具讓大型語言模型存取外部 API。

功能
這項技能是一份純指引文件,用來建立模型情境協定(MCP)伺服器,讓大型語言模型能與外部服務互動。內容分為四個階段:研究與以代理為中心的設計、以 Python(FastMCP)或 Node/TypeScript(MCP SDK)實作、程式碼品質審查,以及評估案例撰寫。涵蓋工具輸入結構、文件字串、標註、錯誤訊息,以及節省情境的回应設計。
適用情境
在建立 MCP 伺服器以整合外部 API 或服務時使用。它同時適用於 Python 與 Node/TypeScript 實作,目標是產出設計良好、以工作流程為導向的工具。
執行需求
這項技能未附帶任何指令碼。它提到需透過網路取得 MCP 協定與 SDK 文件;實作階段假定使用 Python 與 MCP Python SDK 及 Pydantic,或使用 Node/TypeScript 與 MCP TypeScript SDK 及 Zod。

MCP Server Development Guide

Overview

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.

High-Level Workflow

Creating a high-quality MCP server involves four main phases:

Phase 1: Deep Research and Planning

Agent-Centric Design Principles

Build for Workflows, Not Just API Endpoints:

  • Don't simply wrap existing API endpoints - build thoughtful, high-impact workflow tools
  • Consolidate related operations (e.g., schedule_event that both checks availability and creates event)
  • Focus on tools that enable complete tasks, not just individual API calls

Optimize for Limited Context:

  • Agents have constrained context windows - make every token count
  • Return high-signal information, not exhaustive data dumps
  • Provide "concise" vs "detailed" response format options
  • Default to human-readable identifiers over technical codes

Design Actionable Error Messages:

  • Error messages should guide agents toward correct usage patterns
  • Suggest specific next steps: "Try using filter='active_only' to reduce results"
  • Make errors educational, not just diagnostic
Study MCP Protocol Documentation

Fetch the latest MCP protocol documentation: Use WebFetch to load: https://modelcontextprotocol.io/llms-full.txt

For Python implementations:

  • Python SDK: https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md

For Node/TypeScript implementations:

  • TypeScript SDK: https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md

Phase 2: Implementation

Set Up Project Structure

For Python:

  • Create a single .py file or organize into modules if complex
  • Use the MCP Python SDK for tool registration
  • Define Pydantic models for input validation

For Node/TypeScript:

  • Create proper project structure
  • Set up package.json and tsconfig.json
  • Use MCP TypeScript SDK
  • Define Zod schemas for input validation
Implement Core Infrastructure First

Create shared utilities before implementing tools:

  • API request helper functions
  • Error handling utilities
  • Response formatting functions (JSON and Markdown)
  • Pagination helpers
  • Authentication/token management
Implement Tools Systematically

For each tool:

Define Input Schema:

  • Use Pydantic (Python) or Zod (TypeScript) for validation
  • Include proper constraints (min/max length, regex patterns)
  • Provide clear, descriptive field descriptions

Write Comprehensive Docstrings:

  • One-line summary of what the tool does
  • Detailed explanation of purpose and functionality
  • Explicit parameter types with examples
  • Complete return type schema
  • Usage examples

Add Tool Annotations:

  • readOnlyHint: true (for read-only operations)
  • destructiveHint: false (for non-destructive operations)
  • idempotentHint: true (if repeated calls have same effect)
  • openWorldHint: true (if interacting with external systems)

Phase 3: Review and Refine

Code Quality Review

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
  • Documentation: Every tool has comprehensive docstrings

Phase 4: Create Evaluations

Create comprehensive evaluations to test MCP server effectiveness.

Each evaluation 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
  • Verifiable: Single, clear answer that can be verified

Best Practices Summary

  1. Build for workflows, not just API endpoints
  2. Optimize for limited context windows
  3. Design actionable error messages
  4. Follow natural task subdivisions
  5. Use evaluation-driven development
  6. Study framework documentation thoroughly
  7. Implement core infrastructure first
  8. Add proper tool annotations
  9. Test with realistic scenarios

來源與署名

來源:composio-community/awesome-claude-plugins位於mcp-builder/skills/mcp-builder提交e521f7a

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架