Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-hono-stateless

MCP.Pizza Chef: mhart

mcp-hono-stateless is a stateless MCP server built with the Hono framework, leveraging Streamable HTTP for efficient data streaming. It is designed for easy deployment on Cloudflare Workers and other environments supporting Hono. This server adapts the official Express MCP example to Hono, using fetch-to-node for request and response conversion, enabling lightweight, scalable, and performant MCP server implementations.

Use This MCP server To

Deploy MCP server on Cloudflare Workers for scalable AI integrations Stream real-time context data to LLMs using Streamable HTTP Implement stateless MCP servers for lightweight, efficient AI workflows Convert Express MCP server examples to Hono framework easily Use fetch-to-node to handle HTTP requests in MCP server environments

README

Stateless Hono MCP Server

Deploy to Cloudflare

An example Hono MCP server using Streamable HTTP, based off the official Express example, using fetch-to-node to convert, deployable to Cloudflare Workers (and anywhere else Hono runs).

The only real changes to the Express example are:

- import express, { Request, Response } from 'express';
+ import { Hono } from 'hono';
+ import { toFetchResponse, toReqRes } from 'fetch-to-node';

// ...

- const app = express();
- app.use(express.json());
+ const app = new Hono();

- app.post('/mcp', async (req: Request, res: Response) => {
+ app.post('/mcp', async (c) => {
+   const { req, res } = toReqRes(c.req.raw);

    const server = getServer();
    try {
      const transport: StreamableHTTPServerTransport = new StreamableHTTPServerTransport({
        sessionIdGenerator: undefined,
      });
      await server.connect(transport);
-     await transport.handleRequest(req, res, req.body);
+     await transport.handleRequest(req, res, await c.req.json());
      res.on('close', () => {
        console.log('Request closed');
        transport.close();
        server.close();
      });
+     return toFetchResponse(res);
    } catch (error) {

Testing with an example MCP client

In one terminal:

npm start

In another:

node node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleStreamableHttp.js

This will try to connect to the MCP server running on port 3000. You can use connect <url>/mcp to connect to a different host or port.

Then you can run commands like list-prompts or list-tools to verify your MCP server is working.

Deploying

npm run deploy

Here's an example session against a Hono MCP server deployed on Cloudflare Workers:

> connect https://mcp-hono-stateless.michael.workers.dev/mcp
Connecting to https://mcp-hono-stateless.michael.workers.dev/mcp...
Transport created with session ID: undefined
Connected to MCP server

> list-tools
Available tools:
  - start-notification-stream: Starts sending periodic notifications for testing resumability

> list-prompts
Available prompts:
  - greeting-template: A simple greeting prompt template

> call-tool start-notification-stream
Calling tool 'start-notification-stream' with args: {}

Notification #1: info - Periodic notification #1 at 2025-04-22T16:20:50.178Z
>
Notification #2: info - Periodic notification #2 at 2025-04-22T16:20:50.278Z
>
Notification #3: info - Periodic notification #3 at 2025-04-22T16:20:50.378Z
>
Notification #4: info - Periodic notification #4 at 2025-04-22T16:20:50.478Z
>
Notification #5: info - Periodic notification #5 at 2025-04-22T16:20:50.578Z
>
Notification #6: info - Periodic notification #6 at 2025-04-22T16:20:50.678Z
>
Notification #7: info - Periodic notification #7 at 2025-04-22T16:20:50.778Z
>
Notification #8: info - Periodic notification #8 at 2025-04-22T16:20:50.878Z
>
Notification #9: info - Periodic notification #9 at 2025-04-22T16:20:50.978Z
>
Notification #10: info - Periodic notification #10 at 2025-04-22T16:20:51.078Z
> Tool result:
  Started sending periodic notifications every 100ms

mcp-hono-stateless FAQ

How does mcp-hono-stateless differ from the Express MCP server example?
It replaces Express with the lightweight Hono framework and uses fetch-to-node for HTTP conversion, enabling deployment on Cloudflare Workers.
Can mcp-hono-stateless be deployed outside Cloudflare Workers?
Yes, it can run anywhere the Hono framework is supported, including local servers and other edge platforms.
What is Streamable HTTP in the context of this MCP server?
Streamable HTTP allows the server to stream data efficiently to clients, improving real-time context delivery to LLMs.
Is mcp-hono-stateless stateful or stateless?
It is stateless, meaning it does not maintain session state between requests, which simplifies scaling and deployment.
What role does fetch-to-node play in this MCP server?
fetch-to-node converts Node.js HTTP requests and responses to the Fetch API format used by Hono, enabling compatibility.
How do I deploy mcp-hono-stateless to Cloudflare Workers?
Use the provided deploy button or follow Cloudflare Workers deployment guides with the Hono framework setup.
Does mcp-hono-stateless support JSON request bodies?
Yes, it supports JSON payloads similar to the Express example, handled via Hono middleware.
Can I extend mcp-hono-stateless with custom MCP endpoints?
Yes, you can add routes and handlers within the Hono app to expose additional MCP functionality.