MCP Express Server

April 10, 2025 ยท View on GitHub

A Model Context Protocol (MCP) server implemented with Node.js, Express, and TypeScript.

Features

  • Implements MCP tools, resources, and prompts
  • Supports both StdioServerTransport for command-line usage
  • Express HTTP server for testing and debugging

Available MCP Capabilities

Tools

  • echo - Echoes back a message
  • getCurrentTime - Returns the current time in ISO format

Resources

  • example://resource - A simple example resource

Prompts

  • greeting - A simple greeting prompt template

Setup

# Install dependencies
npm install

# Build the TypeScript code
npm run build

Running the Server

Using StdioServerTransport (for MCP Clients)

npm start

Running the Express Server for Testing

npm run dev

Adding to Cursor

To add this server to Cursor, add the following to your ~/.cursor/mcp.json file:

{
  "mcpServers": {
    "Express MCP Server": {
      "command": "node",
      "args": ["path/to/dist/index.js"],
      "transport": "stdio"
    }
  }
}

Replace path/to/dist/index.js with the actual path to your built index.js file.

Testing API Endpoints

  • Health check: http://localhost:3000/health
  • Server info: http://localhost:3000/info

Development

# Run in development mode
npm run dev