MCP TypeScript SDK (V2) / @modelcontextprotocol/hono / hono
hono
Interfaces
CreateMcpHonoAppOptions
Defined in: hono.ts:10
Options for creating an MCP Hono application.
Properties
allowedHosts?
optionalallowedHosts?:string[]
Defined in: hono.ts:25
List of allowed hostnames for DNS rebinding protection. If provided, host header validation will be applied using this list. For IPv6, provide addresses with brackets (e.g., '[::1]').
This is useful when binding to '0.0.0.0' or '::' but still wanting to restrict which hostnames are allowed.
allowedOrigins?
optionalallowedOrigins?:string[]
Defined in: hono.ts:37
List of allowed origin hostnames for Origin header validation. If provided, Origin validation will be applied using this list (port-agnostic, hostnames only — the same convention as allowedHosts).
When omitted, Origin validation is automatically enabled for localhost-class binds (the same condition as host validation): requests without an Origin header pass, while a present Origin whose hostname is not localhost-class is rejected with 403.
host?
optionalhost?:string
Defined in: hono.ts:15
The hostname to bind to. Defaults to '127.0.0.1'. When set to '127.0.0.1', 'localhost', or '::1', DNS rebinding protection is automatically enabled.
Functions
createMcpHonoApp()
createMcpHonoApp(
options?):Hono
Defined in: hono.ts:54
Creates a Hono application pre-configured for MCP servers.
When the host is '127.0.0.1', 'localhost', or '::1' (the default is '127.0.0.1'), DNS rebinding protection middleware is automatically applied to protect against DNS rebinding attacks on localhost servers.
This also installs a small JSON body parsing middleware (similar to express.json()) that stashes the parsed body into c.set('parsedBody', ...) when Content-Type includes application/json.
Parameters
options?
Configuration options
Returns
Hono
A configured Hono application