Skip to main content
Glama
stefanInterWeb

Node.js MCP Server

Node.js MCP Server

A small, stateless Model Context Protocol server built with Node.js, Express and the official MCP SDK. It is intended as a practical starting point: every tool has validated parameters, and the integration suite talks to a real local server through the MCP client transport.

Requirements

  • Node.js 18 or newer

  • npm

Related MCP server: mcp-tools-server

Run locally

npm install
npm start

The server listens on port 3000 by default. Override it with PORT=8080 npm start.

Endpoints:

  • GET /health - HTTP health check

  • POST /mcp - stateless Streamable HTTP MCP endpoint

Example tools

Tool

What it demonstrates

getCurrentTime

Defaults, locale and IANA timezone parameters, structured output

formatText

Enum operations, optional decoration, bounded repeat count

calculate

Numeric parameters, rounding and an MCP tool error

Every successful call returns text containing JSON, structuredContent, and isError: false. Expected tool failures still use HTTP 200 and return JSON such as {"error":"Division by zero is not allowed."} in the text content with isError: true.

Example arguments:

{
  "operation": "divide",
  "a": 10,
  "b": 3,
  "precision": 3
}

Integration tests

npm test

The Mocha suite starts index.mjs as a child process on an available local port, waits until it is ready, connects with the official MCP client, exercises the health endpoint and tools, then shuts the process down in teardown. Chai is used for assertions.

MCP client URL

http://localhost:3000/mcp

The example is stateless: every MCP request gets a fresh server and transport.

License

MIT

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    A deployable MCP server for Cloudflare Workers or Azure Functions that provides example tools (time, echo, math), prompt templates for code assistance, and configuration resources. Enables AI assistants to interact with edge-deployed services through the Model Context Protocol.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    A general-purpose MCP server with utility tools including datetime information, safe math calculations, text statistics, JSON extraction, knowledge base search, and HTTP GET requests. It demonstrates server-side MCP implementation and can be connected to Claude Desktop or LangGraph agents.
    MIT