Cover image
Try Now
2025-04-03

Un modèle pour construire des serveurs MCP (Protocole de contexte modèle) pour Claude et autres assistants d'IA

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

MCP Server Template 🚀

A clean template for building Model Context Protocol (MCP) servers.

What is MCP?

The Model Context Protocol (MCP) is an open standard developed by Anthropic that enables AI systems like Claude to interact seamlessly with various data sources and tools, facilitating secure, two-way connections.

This template provides a starting point for building your own MCP server that can be used with Claude Desktop, Cursor, or any other MCP client.

Template Features

This template includes:

  • Basic server structure with the MCP SDK
  • Example tool definitions with commented placeholders
  • Error handling setup
  • Environment variable configuration via dotenv

Prerequisites 🔧

Before you begin, ensure you have:

  • Your API key for whatever service you're wrapping (if applicable)
  • Node.js (v20 or higher)
  • An MCP client like Claude Desktop or Cursor

Installation ⚡

  1. Clone this template repository:
git clone https://github.com/yourusername/mcp-server-template.git
cd mcp-server-template
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Customization Guide 🔧

To customize this template for your own MCP server:

  1. Update package.json with your server name and details
  2. Modify src/index.ts to:
    • Define your API response interface
    • Add your actual tools and their schemas
    • Implement the tool functionality
    • Update the formatting logic

Key Files to Modify

  • src/index.ts: The main server implementation
  • package.json: Package metadata and dependencies
  • .env: Create this file to store your API keys (make sure to add to .gitignore)

Running Your Server 🖥️

You can run your server directly with:

npm run build
node build/index.js

Integrating with MCP Clients

Configuring the Claude Desktop app

For macOS:

# Create the config file if it doesn't exist
touch "$HOME/Library/Application Support/Claude/claude_desktop_config.json"

# Open the config file in TextEdit
open -e "$HOME/Library/Application Support/Claude/claude_desktop_config.json"

For Windows:

code %APPDATA%\Claude\claude_desktop_config.json

Add your server configuration:

{
  "mcpServers": {
    "your-server-name": {
      "command": "node",
      "args": ["/path/to/your/build/index.js"],
      "env": {
        "YOUR_API_KEY": "your-api-key-here"
      }
    }
  }
}

Configuring Cursor

  1. Open Cursor Settings
  2. Navigate to Features > MCP Servers
  3. Click on the "+ Add New MCP Server" button
  4. Fill out the following information:
    • Name: Enter a nickname for the server (e.g., "your-server-name")
    • Type: Select "command" as the type
    • Command: Enter the command to run the server:
      env YOUR_API_KEY=your-api-key node /path/to/your/build/index.js
      

Template Structure Explained

  • Server Setup: The template creates a basic MCP server with stdio transport
  • Tool Definitions: Example tool schemas with commented placeholders
  • Error Handling: Basic error handling setup with console logging
  • Request Handling: Template for handling tool requests with switch/case structure

Contributing

Feel free to use this template as a starting point for your own MCP server. If you improve the template, please consider contributing back via pull requests!

Acknowledgments ✨

相关推荐

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

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

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

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

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

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

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

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

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

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

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

  • jae-jae
  • MCP Server pour récupérer le contenu de la page Web à l'aide du navigateur sans tête du dramwright.

  • HiveNexus
  • Un bot de chat IA pour les petites et moyennes équipes, soutenant des modèles tels que Deepseek, Open AI, Claude et Gemini. 专为中小团队设计的 Ai 聊天应用 , 支持 Deepseek 、 Open Ai 、 Claude 、 Gemini 等模型。

  • ravitemer
  • Un puissant plugin Neovim pour gérer les serveurs MCP (Protocole de contexte modèle)

  • patruff
  • Pont entre les serveurs Olllama et MCP, permettant aux LLM locaux d'utiliser des outils de protocole de contexte de modèle

  • Sysc4lls
  • Lecteur de documentation IDA (Sort-of) MCP Server

    Reviews

    3 (1)
    Avatar
    user_mBUxABT5
    2025-04-16

    I recently started using mcp-template by 3dyuval and I'm thoroughly impressed! It's incredibly well-structured and has significantly streamlined my workflow. The user-friendly design and clear documentation make it accessible even for beginners. Highly recommend checking it out at https://github.com/3dyuval/mcp-template.