http-mcp-server-example

jozso39/http-mcp-server-example

3.2

If you are the rightful owner of http-mcp-server-example and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

An example of MCP Server with Streamable HTTP Transport, serving as a boilerplate for counting letters in messages.

Tools
1
Resources
0
Prompts
0

An example of MCP Server with Streamable HTTP Transport

This project serves as an example and it can be used as a boilerplate. A Model Context Protocol (MCP) server that provides a single tool for counting letters in messages.

Prerequisites

  • Node.js 20.x or higher
  • npm or yarn
  • Docker (optional, for containerized deployment)

Installation

npm install

Development

For local development, use:

npm run dev

Build and run

For building and running locally, use:

npm run build
npm run start

The server will start on http://localhost:3000 (or the port specified in the PORT environment variable).

Manual testing

For trying out the MCP server and running the tools, use

npm run inspector

which will spin up a local MCP client on http://localhost:6274/... for you to open it in your browser. To test the MCP server, you have to change the Transport Type to Streamable HTTP and your URL must be http://localhost:3000/mcp

Docker

Build the Docker image

npm run docker:build

Run the Docker container

npm run docker:run

API Endpoints

MCP Endpoint

  • POST /mcp - Main MCP endpoint for tool invocations
  • GET /mcp - Returns 405 Method Not Allowed
  • DELETE /mcp - Returns 405 Method Not Allowed

Health Check

  • GET /health - Returns server health status