mcp-builder
Scannednpx machina-cli add skill ComposioHQ/awesome-claude-plugins/mcp-builder --openclawMCP 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_eventthat 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
.pyfile 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.jsonandtsconfig.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
- Build for workflows, not just API endpoints
- Optimize for limited context windows
- Design actionable error messages
- Follow natural task subdivisions
- Use evaluation-driven development
- Study framework documentation thoroughly
- Implement core infrastructure first
- Add proper tool annotations
- Test with realistic scenarios
Source
git clone https://github.com/ComposioHQ/awesome-claude-plugins/blob/master/mcp-builder/skills/mcp-builder/SKILL.mdView on GitHub Overview
Provides a practical blueprint for building MCP servers that let LLMs access external services through well-designed tools. It covers planning, implementation, and review across Python (FastMCP) and Node/TypeScript (MCP SDK), ensuring robust, reusable tooling.
How This Skill Works
Outlines four phases: deep research and planning, implementation, review, and evaluations. Emphasizes workflow-focused tool design, input validation with Pydantic or Zod, comprehensive docstrings, and tool annotations to guide safe, actionable interactions with external systems.
When to Use It
- When creating an MCP server to integrate external APIs or services.
- When using Python (FastMCP) or Node/TypeScript MCP SDK and needing a solid project structure.
- When you require shared infra like API helpers, error handling, and response formatting.
- When tool design should produce actionable error messages and clear usage guidance.
- When building scalable, evaluable MCP servers with documented tools and evaluations.
Quick Start
- Step 1: Set up a Python or TypeScript MCP project and fetch the MCP protocol/docs.
- Step 2: Define a tool with input validation (Pydantic or Zod) and write comprehensive docstrings.
- Step 3: Register the tool with the MCP SDK, add error handling, and run local tests.
Best Practices
- Focus on workflows and task-completion tools, not just endpoint wrappers.
- Keep token usage efficient by returning high-signal responses and offering concise/detailed formats.
- Define input schemas with strict validation (Pydantic or Zod) and descriptive fields.
- Provide thorough tool docstrings and explicit tool annotations (readOnlyHint, idempotentHint, etc.).
- Build shared utilities first, enforce DRY, and ensure consistency and robust error handling.
Example Use Cases
- Weather data fetch tool that consolidates API calls and formats responses for LLMs.
- Calendar scheduling tool that checks availability and creates events in one workflow.
- Payment status checker that queries external payment APIs and returns succinct results.
- User lookup/creation tool with validation and safe error messages for identity operations.
- Content moderation helper that fetches external signals and returns interpretable moderation guidance.