MCP cover image
See in Github
2025-03-05

1

Github Watches

0

Github Forks

0

Github Stars

MCP Server Template

A comprehensive template for building Model Context Protocol (MCP) servers with TypeScript/Node.js.

Overview

This template provides a standardized structure and best practices for developing MCP servers. It includes:

  • TypeScript configuration with ES Modules
  • Standardized directory structure
  • Error handling utilities
  • Testing framework
  • Example implementations
  • Comprehensive documentation

Quick Start

# Clone this repository
git clone https://github.com/your-org/mcp-server-template.git my-mcp-server

# Navigate to the project directory
cd my-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Run the example server
npm start

Quick Start with LLMs

This template is designed to work seamlessly with AI assistants like Claude to help you develop your MCP server:

  1. Clone this repository:

    git clone https://github.com/your-org/mcp-server-template.git my-mcp-server
    cd my-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Copy the prompt from one of these files and paste it into your conversation with Claude or another LLM:

    • PROMPT_TEMPLATE.md - For task-specific assistance with your MCP server
    • AI_ASSISTANT_PROMPT.md - For setting up an AI assistant with deep MCP expertise
  4. Fill in the details about your specific MCP server requirements.

  5. Work with the LLM to implement your custom tools, resources, and other functionality.

  6. Test your implementation using the included test utilities:

    npm test
    
  7. Deploy your MCP server according to your needs.

Directory Structure

mcp-server-template/
├── package.json           # Configured for ES modules
├── tsconfig.json          # TypeScript configuration
├── README.md              # Documentation with usage examples
├── PROMPT_TEMPLATE.md     # Template for task-specific LLM assistance
├── AI_ASSISTANT_PROMPT.md # Role prompt for MCP development assistant
├── DEVELOPMENT_RULES.md   # Development guidelines
├── src/
│   ├── index.ts           # Main server implementation
│   ├── tools/             # Example tool implementations
│   │   └── example-tool.ts
│   ├── resources/         # Example resource implementations
│   │   └── example-resource.ts
│   └── utils/             # Helper utilities
│       └── error-handling.ts
├── tests/                 # Test scripts
│   └── server.test.js
├── docs/                  # Detailed documentation
│   ├── client-developers.md
│   ├── server-developers.md
│   ├── claude-users.md
│   └── mcp-reference.md
└── examples/              # Example implementations
    ├── weather-server/    # Weather API example
    ├── github-server/     # GitHub API example
    └── local-files-server/ # Local file system example

Features

MCP Server Implementation

The template includes a basic MCP server implementation with:

  • Protocol version negotiation
  • Capability declaration
  • Tool registration and execution
  • Resource management
  • Error handling
  • Logging

Tools and Resources

Example implementations of:

  • Basic tools with parameter validation
  • Resource definitions with URI templates
  • Prompt templates

Testing

The template includes a testing framework for:

  • Unit testing tools and resources
  • Integration testing with MCP clients
  • Mocking external dependencies

Documentation

Comprehensive documentation is available in the docs/ directory:

Development Rules

Please refer to DEVELOPMENT_RULES.md for guidelines on:

  • Module system usage
  • TypeScript best practices
  • Error handling patterns
  • Tool implementation rules
  • Resource implementation rules
  • Testing requirements
  • Security guidelines

Examples

The template includes several example implementations:

  • Weather Server: Demonstrates API integration with the National Weather Service
  • GitHub Server: Shows how to integrate with the GitHub API
  • Local Files Server: Illustrates filesystem access and management

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://jgadvisorycpa.com
  • This GPT assists in finding a top-rated business CPA - local or virtual. We account for their qualifications, experience, testimonials and reviews. Business operators provide a short description of your business, services wanted, and city or state.

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • apappascs
  • Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.

  • modelcontextprotocol
  • Serveurs de protocole de contexte modèle

  • Mintplex-Labs
  • L'application tout-en-un desktop et Docker AI avec chiffon intégré, agents AI, constructeur d'agent sans code, compatibilité MCP, etc.

  • ShrimpingIt
  • Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX

  • OffchainLabs
  • Aller la mise en œuvre de la preuve de la participation Ethereum

  • n8n-io
  • Plateforme d'automatisation de workflow à code équitable avec des capacités d'IA natives. Combinez le bâtiment visuel avec du code personnalisé, de l'auto-hôte ou du cloud, 400+ intégrations.

  • huahuayu
  • Une passerelle API unifiée pour intégrer plusieurs API d'explorateur de blockchain de type étherscan avec la prise en charge du protocole de contexte modèle (MCP) pour les assistants d'IA.

    Reviews

    2 (1)
    Avatar
    user_4UQAjdLk
    2025-04-18

    MCP-server-template is a fantastic boilerplate for setting up robust server applications quickly. Created by the talented deachne, it offers a clean and efficient starting point for any project. The code is well-organized and thoroughly commented, making it accessible even for those new to server-side development. Highly recommend checking it out at https://github.com/deachne/MCP-server-template.