Sponsored by Deepsite.site

Simple MCP Server

Created By
Bloomingg8 months ago
Content

Simple MCP Server

A basic example of an MCP (Model Context Protocol) server built with TypeScript and @modelcontextprotocol/sdk.

This server provides a simple echo tool that repeats back any message sent to it.

Features

  • Built with TypeScript
  • Uses @modelcontextprotocol/sdk
  • Includes a basic echo tool
  • Configured for npm publishing
  • Communicates over stdio

Prerequisites

  • Node.js (version 16 or higher recommended)
  • npm (usually comes with Node.js)

Installation (as a developer)

  1. Clone the repository:
    git clone <repository-url>
    cd simple-mcp-server
    
  2. Install dependencies:
    npm install
    
  3. Build the server:
    npm run build
    

Running the Server Locally

After building, you can run the compiled server directly using Node:

node build/index.js

The server will start and listen for MCP communication over standard input/output. You'll see a message like "Simple MCP Server running on stdio" in your terminal's standard error.

Usage with an MCP Client (e.g., Claude Desktop)

To use this server with an MCP client like Claude for Desktop, you need to configure the client to launch this server.

  1. Build the server: Make sure you have run npm run build in the server's project directory.

  2. Find the absolute path: Get the absolute path to the compiled entry point, which is build/index.js within your project directory.

    • On macOS/Linux, you can use pwd in the build directory or combine pwd from the root with /build/index.js.
    • On Windows, navigate to the build directory in Explorer and copy the path, or use cd build and then cd in Command Prompt.
  3. Edit the client configuration: Open the MCP client's configuration file (e.g., claude_desktop_config.json for Claude Desktop).

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  4. Add the server entry: Add an entry for your server under mcpServers. Replace /ABSOLUTE/PATH/TO/YOUR/PROJECT/simple-mcp-server with the actual absolute path you found in step 2.

    {
      "mcpServers": {
        "simple-server": { // Use the name defined in src/index.ts
          "command": "node",
          "args": [
            "/ABSOLUTE/PATH/TO/YOUR/PROJECT/simple-mcp-server/build/index.js"
          ]
        }
        // ... other servers might be listed here
      }
    }
    
  5. Restart the client: Save the configuration file and restart your MCP client application.

Now, the client should be able to see and use the "simple-server" and its echo tool.

Publishing to npm (Optional)

  1. Make sure your package.json has the correct details (name, version, author, repository, etc.).
  2. Ensure you are logged into npm (npm login).
  3. Run the publish command:
    npm publish --access public # Use --access public for public packages
    

Once published, users could potentially use npx to run it, similar to the filesystem example, if the package.json were configured with a bin entry.

Development

  • Build: npm run build (compiles TypeScript to JavaScript in build/)
  • Watch: npm run build -- --watch (continuously watches for changes and recompiles)
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Amap Maps高德地图官方 MCP Server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Tavily Mcp
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop
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.
CursorThe AI Code Editor
WindsurfThe new purpose-built IDE to harness magic
ChatWiseThe second fastest AI chatbot™
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.
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.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Serper MCP ServerA Serper MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
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"
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Playwright McpPlaywright MCP server