Sponsored by Deepsite.site

MCP Server Template

Created By
antoniodevivo7 months ago
A lightweight and extensible MCP (Model Context Protocol) server implementation built with Express.js and TypeScript. This template provides a solid foundation for building AI-powered applications that can communicate with MCP-compatible clients through Server-Sent Events (SSE).
Content

MCP Server Template

A lightweight and extensible MCP (Model Context Protocol) server implementation built with Express.js and TypeScript. This template provides a solid foundation for building AI-powered applications that can communicate with MCP-compatible clients through Server-Sent Events (SSE).

Features

  • Express.js server with TypeScript support
  • Server-Sent Events (SSE) for real-time communication
  • MCP protocol implementation
  • Note management system
  • Docker support
  • Input validation using Zod

Prerequisites

  • Node.js 22 or higher
  • npm (Node Package Manager)
  • Docker (optional)

Installation

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

Running the Server

Local Development

npm start

The server will start on port 3123 by default.

Using Docker

Build the Docker image:

docker build -t mcp-template .

Run the container:

docker run -p 3123:3123 mcp-template

API Endpoints

MCP Endpoints

  • GET /mcp/sse - Establishes an SSE connection for MCP communication

Available Tools

  • add-note - Add a new note to the note store

    • Parameters:
      • noteTitle: string - The title of the note
      • noteContent: string - The content of the note
      • noteTags: string[] (optional) - Tags for the note
  • update-note - Update an existing note

    • Parameters:
      • noteId: string - The ID of the note to update
      • noteTitle: string - The new title of the note
      • noteContent: string - The new content of the note
      • noteTags: string[] (optional) - The new tags for the note
  • get-note - Retrieve a specific note

    • Parameters:
      • noteId: string - The ID of the note to retrieve
  • get-all-notes - Retrieve all notes from the store

    • Parameters: None
  • delete-note - Delete a note from the store

    • Parameters:
      • noteId: string - The ID of the note to delete

Input Validation

The server uses Zod for runtime type checking and input validation. All incoming requests are validated against predefined schemas before processing. This ensures type safety and data integrity throughout the application.

Environment Variables

  • PORT - Server port (default: 3123)
  • LOG_LEVEL - Logging level (default: "info")
  • DOCKER - Set to "true" when running in Docker
  • DEV - Set to "true" for development mode

Development

Project Structure

src/
├── config.ts         # Configuration settings
├── index.ts         # Application entry point
├── logger.ts        # Logging configuration
├── note-store.ts    # Note management system
└── server/
    └── routers/
        └── mcp.ts   # MCP router implementation

Building

npm run build

Linting

npm run lint

License

MIT

Author

Antonio De Vivo

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