Communication·
advanced
·14 min read·Nov 19, 2026·Updated Nov 24, 2026
·Independent maintainer·Verification Charter

Streamable HTTP Transport in MCP: Architecture

Build remote multi-client MCP servers using unified Streamable HTTP (/mcp) transport. Covers per-request metadata, stateless mode, subscriptions/listen, and reverse proxy configs.

MCPStreamable HTTPSSETypeScriptarchitectureCodexClaudeCursor
Interactive Tool
1-Click Export

Generate & Validate Multi-Client MCP Config

One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.

Open in Generator

Streamable HTTP Transport in MCP: Remote Multi-Client Architecture

Earlier MCP implementations used the now-deprecated HTTP+SSE transport: a long-lived event stream for server messages plus a separate HTTP POST endpoint for client requests. Paths such as /sse and /messages?sessionId=... were choices made by SDK examples, not names mandated by the specification. See the archived Multi-Client SSE guide. In production cloud deployments, that two-channel topology suffered from sticky-session load balancer drops, double-hop cold start latency, and inability to scale to zero on serverless runtimes.

The modern MCP transport specification standardizes remote communication around Streamable HTTP (StreamableHTTPServerTransport and WebStandardStreamableHTTPServerTransport). Streamable HTTP puts every JSON-RPC message on a single HTTP endpoint (/mcp). Important: revision 2026-07-28 removed protocol-level sessions, the Mcp-Session-Id header, and the standalone GET /mcp stream. Those mechanisms belonged to 2025-03-26 through 2025-11-25 and are described below only as legacy compatibility. See the official changelog (opens in a new tab) and Streamable HTTP spec (opens in a new tab).


1. Architectural Evolution: Legacy SSE vs. Unified Streamable HTTP

Under Streamable HTTP, a server exposes a single URI path (typically /mcp) that accepts POST requests. GET and DELETE to that path were part of older revisions and are no longer part of the core protocol:

diagram
Streamable HTTP MCP Server (/mcp)Reverse Proxy (Nginx / Cloudflare)AI Client (Claude / Cursor / Codex)Streamable HTTP MCP Server (/mcp)Reverse Proxy (Nginx / Cloudflare)AI Client (Claude / Cursor / Codex)alt[Fast Unary Tool Execution][Long-Running Streaming Tool Execution]No initialize handshake, no Mcp-Session-Id, no GET/DELETE endpointPOST /mcp (JSON-RPC request + MCP-Protocol-Version, Mcp-Method, Mcp-Name where applicable)1Forward POST /mcp2200 OK (Content-Type: application/json, resultType: complete)3200 OK (Content-Type: text/event-stream)4event: message (notifications/progress 50%)5event: message (Final JSON-RPC Result)6POST /mcp (subscriptions/listen, optional long-lived stream)7SSE: notifications/tools/list_changed (etc.)8

Core Protocol Mechanics

  1. ▸Unified POST /mcp Dispatch: Every client JSON-RPC request is its own HTTP POST to /mcp. The client must send Accept: application/json, text/event-stream, plus the MCP-Protocol-Version, Mcp-Method, and (where applicable) Mcp-Name headers that mirror fields in the body. The body's _meta.io.modelcontextprotocol/* fields are the source of truth.
  2. ▸Per-request JSON or SSE response: A fast call returns application/json; a long-running call may return Content-Type: text/event-stream carrying request-scoped notifications followed by the final response, on that same HTTP transaction.
  3. ▸No sessions; explicit subscriptions: Revision 2026-07-28 removed initialize, Mcp-Session-Id, and the standalone GET /mcp stream. Long-lived change notifications are obtained with a subscriptions/listen POST whose response is a long-lived SSE stream. Cancellation of a Streamable HTTP request is signalled by closing its response stream. (spec (opens in a new tab))

2. Prerequisites & Package Matrix

ComponentExample version baseline (not a hard minimum)Recommended versionPurpose
Node.jsv20.18.0 LTSv22.12.0 LTSServer runtime with native Web Streams
@modelcontextprotocol/server + @modelcontextprotocol/node + @modelcontextprotocol/express2.xLatest 2.xOfficial TypeScript SDK v2 packages, which implement the 2026-07-28 spec; the older @modelcontextprotocol/sdk (opens in a new tab) v1 line supports only versions through 2025-11-25
Express4.21+Latest 4.xHTTP routing and DNS-rebinding protection via createMcpExpressApp
Zod4.2.04.2.0+Tool input schema validation (zod/v4)

Install the current dependencies:

bash
npm install @modelcontextprotocol/server @modelcontextprotocol/node @modelcontextprotocol/express express zod
npm install -D typescript @types/express @types/node tsx

3. Production TypeScript Implementation (createMcpHandler)

Below is a stateless Streamable HTTP server for the current (2026-07-28) transport: one POST endpoint at /mcp, no session map, and no GET/DELETE handlers. createMcpHandler builds a fresh server for every request and validates the mirrored request headers itself, returning 400 Bad Request with -32020 HeaderMismatch on a mismatch (header rules (opens in a new tab)); createMcpExpressApp adds JSON parsing and Host/Origin checks for DNS-rebinding defense:

typescript
// server-streamable-http.ts
import { createMcpExpressApp } from "@modelcontextprotocol/express";
import { toNodeHandler } from "@modelcontextprotocol/node";
import { createMcpHandler, McpServer } from "@modelcontextprotocol/server";
import * as z from "zod/v4";

const handler = createMcpHandler(() => {
  const server = new McpServer({
    name: "enterprise-streamable-mcp",
    version: "2.0.0",
  });

  server.registerTool(
    "inspect_service_health",
    {
      description: "Check latency and connection pool metrics for an internal microservice.",
      inputSchema: z.object({
        serviceName: z.string().min(1).describe("Target microservice identifier"),
        environment: z.enum(["production", "staging"]).default("production"),
      }),
    },
    async ({ serviceName, environment }) => ({
      content: [
        {
          type: "text",
          text: JSON.stringify({
            service: serviceName,
            environment,
            status: "healthy",
            timestamp: new Date().toISOString(),
          }),
        },
      ],
    })
  );

  return server;
});

const app = createMcpExpressApp();
// Every JSON-RPC message is its own POST /mcp. No session, no GET/DELETE.
const nodeHandler = toNodeHandler(handler);
app.all("/mcp", (req, res) => void nodeHandler(req, res, req.body));

const PORT = Number(process.env.PORT || 3001);
app.listen(PORT, "127.0.0.1", () => {
  console.error(`Streamable HTTP MCP Server listening at http://127.0.0.1:${PORT}/mcp`);
});

This uses the v2 SDK entry point that speaks 2026-07-28. The older @modelcontextprotocol/sdk v1 packages (through 1.32.2) implement only protocol versions up to 2025-11-25; their StreamableHTTPServerTransport does not emit 2026-era results (SDK README (opens in a new tab), v2 migration guide (opens in a new tab)).


4. Multi-Host Client Configuration (url Schema)

Configure modern MCP clients with the url key pointing at the Streamable HTTP endpoint; do not use an endpoint property.

OpenAI Codex CLI (~/.codex/config.toml)

toml
[mcp_servers.remote_ops]
url = "https://mcp.internal.example.com/mcp"
bearer_token_env_var = "MCP_OPS_BEARER_TOKEN"

Cursor (.cursor/mcp.json) and other JSON clients accepting url

json
{
  "mcpServers": {
    "remote-ops": {
      "url": "https://mcp.internal.example.com/mcp",
      "headers": {
        "Authorization": "Bearer ${MCP_OPS_BEARER_TOKEN}"
      }
    }
  }
}

5. Reverse Proxy & CORS Hardening

1. CORS for browser clients

Browser-based hosts must be allowed to send Accept, Content-Type, MCP-Protocol-Version, Mcp-Method, and Mcp-Name. Under 2026-07-28 there is no Mcp-Session-Id response header to expose, so Access-Control-Expose-Headers no longer needs to list one; older clients that still send session headers must be handled by a compatibility layer. See the spec's security section (opens in a new tab).

2. Nginx Non-Buffered Location Block

When a Streamable HTTP response upgrades to text/event-stream for long-running progress updates, disable proxy chunk buffering:

nginx
location /mcp {
    proxy_pass http://127.0.0.1:3001/mcp;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_buffering off;
    proxy_cache off;
    proxy_read_timeout 300s;
}

proxy_read_timeout is the nginx directive; a bare read_timeout line is not valid nginx configuration. The spec also recommends that servers set X-Accel-Buffering: no on SSE responses so intermediaries do not buffer events (spec (opens in a new tab)).

3. Origin Validation & DNS Rebinding Defense

Local or internal Streamable HTTP servers listening on loopback interfaces (127.0.0.1) are vulnerable to DNS rebinding attacks if a malicious webpage issues cross-origin POST /mcp requests from a developer's browser. Always enforce two server-side middleware checks before routing requests to the MCP handler (createMcpHandler, or StreamableHTTPServerTransport in v1):

  1. ▸Strict Origin Header Allowlist: Reject any request carrying an Origin header that does not explicitly match your approved web host origins with HTTP 403 Forbidden.
  2. ▸Host Header Binding: Verify the HTTP Host header matches your expected domain or localhost:<port>, and bind local development servers exclusively to 127.0.0.1 rather than 0.0.0.0.

6. Stateless Serverless Mode (Cloudflare Workers & AWS Lambda)

Revision 2026-07-28 makes stateless operation the default protocol shape: createMcpHandler (or WebStandardStreamableHTTPServerTransport on v1 for legacy revisions) builds a fresh server instance per request. Every POST /mcp request instantiates a request-scoped handler, processes the JSON-RPC frame, returns the response, and releases memory. Compare this with the legacy stateful transport (still needed only to interoperate with 2025-03-26–2025-11-25 clients):

Operational PropertyLegacy stateful (Mcp-Session-Id, ≤ 2025-11-25)Current (2026-07-28, no sessions)
Load BalancingRequires session affinity or shared Redis event busStandard round-robin across any edge node or pod
Server-Initiated NotificationsLong-lived GET /mcp SSE streamsubscriptions/listen POST stream; request-scoped notifications stay on their own response
Scale-to-Zero ServerlessDifficult due to persistent memory socketsNative fit for Cloudflare Workers, AWS Lambda, Cloud Run
Memory FootprintScales linearly with concurrent sessionsConstant per active in-flight HTTP request

Troubleshooting Streamable HTTP Regressions

  • ▸400 Bad Request with -32020 HeaderMismatch: The MCP-Protocol-Version, Mcp-Method, or Mcp-Name header does not match the JSON-RPC body. Recent revisions require those mirrored headers on every POST; see server validation (opens in a new tab).
  • ▸400 Bad Request with -32022 UnsupportedProtocolVersion: The server does not support the requested version; retry using a version from the error's supported array.
  • ▸A broken SSE stream: 2026-07-28 removed Last-Event-ID resumability. Re-issue the request with a new request ID rather than trying to replay a lost stream. There is no session to re-initialize.

External References

Ready to Deploy?

Build your full agent toolstack in the Visual Generator

Combine MCP servers with databases, search APIs, and memory graphs in a single configuration file.

Customize in Generator
Developer Verification & Feedback
0 reports

Did this setup guide work with your AI host?

Help test this configuration across Claude, Cursor, and Codex CLI. Be the first to report:

Streamable HTTP Transport in MCP: Architecture FAQ

Why do browser MCP clients get HTTP 400 on their second Streamable HTTP request?

Browser CORS policies hide custom response headers from client JavaScript unless explicitly exposed. Your server must send 'Access-Control-Expose-Headers: Mcp-Session-Id' so the client can read the session ID returned by 'initialize' and attach it to subsequent POST /mcp requests.

Can Streamable HTTP MCP servers run on serverless platforms like Cloudflare Workers?

Yes. Using 'WebStandardStreamableHTTPServerTransport' in stateless mode (setting 'sessionIdGenerator: undefined'), each POST /mcp request is handled independently without in-memory sticky sessions, allowing true scale-to-zero edge deployment.

What happened to the 'endpoint' field in client MCP configurations?

Early 2025 clients used an 'endpoint' key for legacy SSE URLs. Modern MCP clients (Claude Desktop, Cursor, OpenAI Codex CLI) standardize on the 'url' key pointing directly to the unified '/mcp' Streamable HTTP route.

RT✓

Written by Rad Tome

Independent maintainer, MCP Codex

Specializing in Model Context Protocol (MCP) integrations, autonomous AI agent orchestration, and distributed developer toolchains. Researches and benchmarks production MCP client-server architectures across OpenAI Codex, Claude, and Cursor.

Editorial Integrity: Package names verified via npm registry API. Repositories verified via GitHub REST API.
Verification Charter →

Related Guides