- Legacy (sticky session): the server issues a session ID which the client must include in headers.
- Modern (stateless): the client includes a
_metaobject inside every request body so the server has all client context without session affinity.
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)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
refinput via regex, - reports progress with
ctx.report_progress(...), - writes logs to stderr so you can see them in the server terminal,
- returns a
Shipmentobject or raises aToolErrorif not found.
Running the demo
- Start the server (terminal 1):
- Start the MCP Inspector (terminal 2):
Legacy era (sticky session) — behavior and examples
- Protocol era:
2025-11-25. - The client sends an
initializehandshake 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-IDheader so the server can identify the session (sticky session).
Modern era (stateless) — behavior and examples
- Protocol era:
2026-07-28. - The modern protocol is stateless: every request includes a
_metaobject 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
_metacontent from each request to obtain client context.
server/discover request headers (modern):
_meta carries the client’s identity and capabilities:
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
localhostin 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_progressto demonstrate progress events on the stream.
- 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.
_meta) MCP protocol eras, and how this demo server and inspector illustrate both paradigms.