New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@modelcontextprotocol/hono

Package Overview
Dependencies
Maintainers
5
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@modelcontextprotocol/hono

Hono adapters for the Model Context Protocol TypeScript server SDK - Hono middleware

latest
Source
npmnpm
Version
2.0.2
Version published
Weekly downloads
0
Maintainers
5
Weekly downloads
 
Created
Source

@modelcontextprotocol/hono

Hono adapters for the MCP TypeScript server SDK.

This package is a thin Hono integration layer for @modelcontextprotocol/server.

It does not implement MCP itself. Instead, it helps you:

  • create a Hono app with sensible defaults for MCP servers
  • parse JSON request bodies and expose them as c.get('parsedBody') for Streamable HTTP transports
  • add DNS rebinding protection via Host header validation (recommended for localhost servers)

Install

npm install @modelcontextprotocol/server @modelcontextprotocol/hono hono

Exports

  • createMcpHonoApp(options?)
  • hostHeaderValidation(allowedHostnames)
  • localhostHostValidation()

Usage

Streamable HTTP endpoint (Hono)

import { McpServer, WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/server';
import { createMcpHonoApp } from '@modelcontextprotocol/hono';

const app = createMcpHonoApp();
app.all('/mcp', async c => {
    // Stateless example: create a server and a transport per request.
    const server = new McpServer({ name: 'my-server', version: '1.0.0' });
    const transport = new WebStandardStreamableHTTPServerTransport({ sessionIdGenerator: undefined });
    await server.connect(transport);
    return transport.handleRequest(c.req.raw, { parsedBody: c.get('parsedBody') });
});

Host header validation (DNS rebinding protection)

import { localhostHostValidation } from '@modelcontextprotocol/hono';

const app = createMcpHonoApp();
app.use('*', localhostHostValidation());

Keywords

modelcontextprotocol

FAQs

Package last updated on 02 Oct 2026

Related posts