Sponsored by Deepsite.site

MCP Server Template

Created By
deachne9 months ago
Content

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.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Serper MCP ServerA Serper MCP Server
DeepChatYour AI Partner on Desktop
Playwright McpPlaywright MCP server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Tavily Mcp
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
CursorThe AI Code Editor
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
ChatWiseThe second fastest AI chatbot™
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
WindsurfThe new purpose-built IDE to harness magic
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Amap Maps高德地图官方 MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs