Sponsored by Deepsite.site

MCP Server

Created By
iamtraction7 months ago
A sample Node.js MCP Server template that you can use to create your own MCP servers.
Content

MCP Server

A TypeScript template repository for creating Model Context Protocol (MCP) servers with support for both stdio (Standard Input/Output) and SSE (Server-Sent Events) transports. This template provides a solid foundation for building MCP servers with a well-organized structure and essential features.

Features

  • 🚀 Built with TypeScript for type safety and better developer experience
  • 🔄 Supports both stdio and SSE transports
  • 📦 Includes example prompts, resources, and tools
  • ⚡ Uses FastMCP for rapid development

Prerequisites

  • Node.js
  • npm or yarn package manager

Getting Started

  1. Create a repo from this template

    Click Use this template > Create a new repository

    screenshot

  2. Clone your repository

    git clone https://github.com/iamtraction/node-mcp-server.git
    cd node-mcp-server
    
  3. Install dependencies

    npm install
    
  4. Start development server

    npm run dev
    

Project Structure

src/
├── prompts/     # MCP prompts
├── resources/   # MCP resources
├── tools/       # MCP tools
└── server.ts    # Main server file

Available Scripts

  • npm run dev - Start development server with hot reload
  • npm run build - Build the TypeScript code
  • npm run start - Start the production server
  • npm run watch - Watch for TypeScript changes
  • npm run lint - Run ESLint to check code quality and style

Adding New Features

Adding a Prompt

Create a new file in src/prompts/ and add it to server.ts. Learn more about MCP Prompts:

import myPrompt from "./prompts/my-prompt.js";
server.addPrompt(myPrompt);

Adding a Resource

Create a new file in src/resources/ and add it to server.ts. Learn more about MCP Resources:

import myResource from "./resources/my-resource.js";
server.addResource(myResource);

Adding a Tool

Create a new file in src/tools/ and add it to server.ts. Learn more about MCP Tools:

import myTool from "./tools/my-tool.js";
server.addTool(myTool);

Configuration

The server can be configured in server.ts. By default, it runs on port 3000 with SSE transport. You can modify the configuration in the server.start() options.:

server.start({
    transportType: "httpStream", // or "stdio"
    httpStream: {
        port: 3000,
    },
});

Learn more about Transports.

Using the MCP Server

stdio Server Setup

{
    "mcpServers": {
        "example-server": {
            "command": "node",
            "args": [ "dist/server.js" ]
         }
    }
}

SSE Server Setup

{
    "mcpServers": {
        "example-server": {
            "url": "https://example-server.com/sse"
         }
    }
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Showcase

Have you built something cool with this template? Add it to the showcase!

To add your project to the showcase:

  1. Edit this README.md file
  2. Add your project to the list above using this format:
    - [Your Project Name](link-to-your-project) - Brief description
    
  3. Submit a pull request

License

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

Acknowledgments

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