Skip to main content
Welcome back. This lesson demonstrates streamable HTTP: a pattern that lets a remote server communicate with a client over HTTP using long-lived connections and event streams. For local processes you typically use STDIO, but when the server runs on a different host or region you use HTTP-based transports such as streamable HTTP. This demo contrasts two MCP protocol eras:
  • Legacy (sticky session): the server issues a session ID which the client must include in headers.
  • Modern (stateless): the client includes a _meta object inside every request body so the server has all client context without session affinity.
Below are the exact files and commands used in the demo so you can reproduce it locally.

Catalog — mcp.json

The inspector catalog exposes two server entries: one that represents the legacy protocol era, and another that uses the modern era. Both entries point to the same local HTTP endpoint for the demo server. mcp.json (catalog)
Note: Both entries intentionally point to the same http://127.0.0.1:8000/mcp endpoint. Running a local HTTP server makes it easy to simulate a remote service while preserving realistic network behavior.

Server implementation — server.py

This demo server exposes a single tool (get_shipment_status) that:
  • validates the ref input via regex,
  • reports progress with ctx.report_progress(...),
  • writes logs to stderr so you can see them in the server terminal,
  • returns a Shipment object or raises a ToolError if not found.
Server implementation (server.py)

Running the demo

  1. Start the server (terminal 1):
Example server startup output (cleaned):
  1. Start the MCP Inspector (terminal 2):
Inspector startup (cleaned):

Legacy era (sticky session) — behavior and examples

  • Protocol era: 2025-11-25.
  • The client sends an initialize handshake request with client info and protocol version.
  • The server responds and issues a session ID via response headers (MCP-Session-ID).
  • All subsequent requests from the client include the MCP-Session-ID header so the server can identify the session (sticky session).
Client initialize (example request body):
Server initialize response (example body):
Later request headers (legacy):
Example notification body (legacy):
This shows the sticky session requirement: the server-supplied session ID header must be included for the server to associate subsequent requests with the same session.

Modern era (stateless) — behavior and examples

  • Protocol era: 2026-07-28.
  • The modern protocol is stateless: every request includes a _meta object in the request body carrying protocol version, client identity, and capabilities.
  • The server does not return or require a session ID header; it reads the _meta content from each request to obtain client context.
Example server/discover request headers (modern):
Request body (modern) — _meta carries the client’s identity and capabilities:
Modern response (excerpt) — there is no MCP-Session-ID header:
The key difference: legacy servers rely on an out-of-band session ID returned by the server (sticky session). Modern servers are stateless — the client sends _meta in every request, so the server has all client context it needs without session affinity.

Quick comparison

Practical notes and tips

  • A single inspector instance can only connect to one server entry at a time when two entries point at the same hostname but represent different protocol eras — each entry encodes a distinct behavior the inspector must use.
  • Using localhost in the demo simulates a remote HTTP service while keeping the setup minimal and local.
  • The server logs to stderr. For streamable HTTP, servers maintain long-lived connections and event streams; this demo uses ctx.report_progress to demonstrate progress events on the stream.
References and further reading:
  • MCP Inspector: https://www.npmjs.com/package/@modelcontextprotocol/inspector
  • For general guidance on long-lived HTTP connections and server-sent events, see your platform’s docs for Uvicorn / ASGI servers.
That covers how streamable HTTP differs between the legacy (sticky session) and modern (stateless _meta) MCP protocol eras, and how this demo server and inspector illustrate both paradigms.

Watch Video