Packages

@modelcontextprotocol/hono

2.0.2 · 2 Oct 2026Apache-2.067.3k / weekRepositoryHomepagenpmAtom feed

3 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.

  1. 2.0.2

    2 Oct 2026
    • A Server or McpServer now serves one connection at a time, and a Streamable HTTP server transport without sessions (sessionIdGenerator: undefined) serves one request. An app that uses one server object, or one stateless transport, for every HTTP request fails on the second request after this upgrade. Build the server and the transport per request instead.

      What keeps working without a change:

      What fails now, how it shows, and what to change:

      What the caller sees when connect() or handleRequest() rejects depends on the host. Express 5, Fastify and Hono answer 500. A plain node:http listener without its own error handling gets an unhandled rejection, which ends the process.

      The README examples of @modelcontextprotocol/express, @modelcontextprotocol/fastify, @modelcontextprotocol/hono and @modelcontextprotocol/node, and the handler examples in the JSDoc of WebStandardStreamableHTTPServerTransport and NodeStreamableHTTPServerTransport, now build a server and a transport per request.

    • The license field of the package manifests is now Apache-2.0; the LICENSE file shipped in each package carries the full terms, including the MIT text for earlier contributions. No code change.

  2. 2.0.1

    23 Sep 2026
    • Read Streamable HTTP request bodies with a size limit. Every SDK-owned body read
      WebStandardStreamableHTTPServerTransport (and the Node transport built on it),
      createMcpHandler, toNodeHandler, and createMcpHonoApp's JSON pre-parse — now stops at
      4 MiB by default (the limit the legacy SSE transport already uses; the Express adapter and stdio
      bound their reads too) and answers 413 Payload Too Large before anything is parsed.
      toWebRequest (when it reads the Node stream itself) now rejects once the body exceeds the
      limit with an error whose name is 'RequestBodyTooLargeError' and status is 413, and
      toNodeHandler answers that with 413; hand-wired callers of toWebRequest should handle the
      rejection or pass a pre-parsed body, and isLegacyRequest reports such a request as non-legacy
      so the modern handler answers it. JSON-RPC batch arrays are limited to 100 messages; a longer
      batch is answered 400 / -32600 and none of it is dispatched.

      The limit is configurable with a new maxRequestBodySize option (bytes, default
      DEFAULT_MAX_REQUEST_BODY_SIZE = 4 MiB, exported from @modelcontextprotocol/server) on
      WebStandardStreamableHTTPServerTransportOptions, CreateMcpHandlerOptions (forwarded to its
      stateless legacy leg; isLegacyRequest and legacyStatelessFallback take the same option),
      CreateMcpHonoAppOptions, and ToNodeHandlerOptions / ToWebRequestOptions (the adapter's
      bound applies before the handler's, so raise both). The bounded reader is exported as
      readRequestBody for adapter authors. Hosts that pre-parse the body and pass it as
      parsedBody skip the SDK's read and its size limit entirely; the batch bound applies either way.

      createMcpHonoApp and createMcpExpressApp now run their Host/Origin validation before the
      JSON body parser, so a request from a disallowed Host or Origin with an invalid JSON body is
      answered 403 rather than 400, and its body is not read.

  3. 2.0.0

    27 Jul 2026
    • First beta release of SDK v2 with support for the MCP 2026-07-28 specification
      revision. See the migration guides for upgrading from v1
      (docs/migration/upgrade-to-v2.md) and adopting the 2026-07-28 revision
      (docs/migration/support-2026-07-28.md).

    • Ship CommonJS builds alongside ESM. Each package now emits both .mjs/.d.mts
      and .cjs/.d.cts (via tsdown format: ['esm', 'cjs']), and its exports map
      adds a require condition so require('@modelcontextprotocol/…') works from
      CommonJS consumers. Output extensions are normalized across all packages
      (@modelcontextprotocol/core moves from .js/.d.ts to .mjs/.d.mts); the
      public import paths are unchanged.

    • POSTs whose Content-Type media type is not application/json are now
      rejected with 415 Unsupported Media Type; the header is parsed instead of
      substring-matched. Previously any value merely containing the substring
      passed the check (for example text/plain; a=application/json), case
      variants were wrongly rejected, and the 2026-07-28 entry did not inspect
      Content-Type at all — requests with a missing or non-JSON header that used
      to be served on that path now also answer 415. Values with parameters
      (application/json; charset=utf-8, including malformed parameter sections
      like application/json;) continue to work. SDK clients always send the
      correct header and are unaffected.

      The new isJsonContentType(header) helper is exported for transport and
      framework-adapter authors — custom entries composing the exported building
      blocks (classifyInboundRequest, PerRequestHTTPServerTransport) must apply
      it themselves. The hono adapter's JSON body pre-parse and the client's
      response dispatch now use the same parsed-media-type comparison.