typescript-sdk/packages/middleware
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Andy Fleming 81e4b2a412
Adds Fastify Middleware for v2 (#1536)
Co-authored-by: Felix Weinberger <fweinberger@anthropic.com>
Co-authored-by: Konstantin Konstantinov <KKonstantinov@users.noreply.github.com>
Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
2026-03-31 13:51:14 +00:00
..
express v2: limit public exports (#1680) 2026-03-25 20:25:01 +00:00
fastify Adds Fastify Middleware for v2 (#1536) 2026-03-31 13:51:14 +00:00
hono v2: limit public exports (#1680) 2026-03-25 20:25:01 +00:00
node v2: Web standards Request object in ctx (#1822) 2026-03-31 12:02:37 +01:00
README.md v2 ESlint fixes (#1403) 2026-01-20 12:21:53 +00:00

Middleware packages

The packages in packages/middleware/* are thin integration layers that help you expose an MCP server in a specific runtime, platform, or web framework.

They intentionally do not add new MCP features or “business logic”. MCP functionality (tools, resources, prompts, transports, auth primitives, etc.) lives in @modelcontextprotocol/server (and other core packages). Middleware packages should primarily:

  • adapt request/response types to the SDK (e.g. Node.js IncomingMessage/ServerResponse)
  • provide small framework helpers (e.g. wiring, body parsing hooks)
  • supply safe defaults for common deployment pitfalls (e.g. localhost DNS rebinding protection)

Packages

  • @modelcontextprotocol/express — Express helpers (app defaults + Host header validation for DNS rebinding protection).
  • @modelcontextprotocol/hono — Hono helpers (app defaults + JSON body parsing hook + Host header validation).
  • @modelcontextprotocol/node — Node.js Streamable HTTP transport wrapper for IncomingMessage/ServerResponse.

Typical usage

Most servers use:

  • @modelcontextprotocol/server for the MCP server implementation
  • one middleware package for framework/runtime integration (this folder)
  • (optionally) additional platform/framework dependencies (Express, Hono, etc.)