MCP Transports — Cheat Sheet
MCP Engineering course · M1
A transport is the channel a JSON-RPC message travels on between client and server. The protocol defines what they say; the transport, how it travels. This sheet covers the two current transports in revision 2026-07-28, stdio and stateless Streamable HTTP, and how a current server treats legacy traffic.
What changed in V2: the earlier version of this sheet taught sessions (Mcp-Session-Id), resumable streams and server-initiated messages as Streamable HTTP features. 2026-07-28 removed all three; they appear here only as legacy behaviour.
The key question
Does the host launch the server on the user's machine, or is it a service on the network?
| Situation | Transport | Baseline |
|---|---|---|
| Local tool for one user, launched by the host | stdio | No port; credentials from the environment; logs to stderr |
| Local HTTP for development | Streamable HTTP on 127.0.0.1 | Origin and Host checks; never 0.0.0.0 |
| Shared or remote service | Streamable HTTP over HTTPS | Origin checks, OAuth 2.1 resource server (L13), rate limits |
stdio (current, 2026-07-28)
The client launches the server as a subprocess and they exchange lines on stdin and stdout.
- Each message is one JSON-RPC request, notification or response, delimited by newlines, with no embedded newlines.
- On stdio, stdout carries only MCP messages. Log to stderr. One stray
print()to stdout corrupts the stream. The client may capture or ignore stderr and SHOULD NOT treat it as an error signal. - The server MUST NOT write JSON-RPC requests; input requests go inside
InputRequiredResult(L05). Metadata lives in_meta; there are no headers. - Cancellation: the client MUST send
notifications/cancelledwith the request'srequestId. The server SHOULD stop work and MUST NOT send further messages for it. - Shutdown: the client SHOULD close stdin, wait, then terminate (SIGTERM, then SIGKILL on POSIX). Servers SHOULD exit when stdin closes.
- stdio implementations SHOULD NOT use the OAuth framework; they take credentials from the environment.
Streamable HTTP (current, 2026-07-28)
The server exposes one MCP endpoint (for example https://example.com/mcp) that accepts POST.
- Every client message is a new POST whose body is a single JSON-RPC request or notification.
- The client MUST send
Accept: application/json, text/event-stream. - The server replies with one JSON object (
application/json) or an SSE stream scoped to that request (related notifications such asnotifications/progress, then the final response). The client MUST support both. - The server MUST NOT send independent requests on the stream. Long-lived change notifications come only on the response stream of a
subscriptions/listenrequest. - No sessions, no standalone GET stream, no resumption. If a stream breaks, the request is lost; the client MUST re-issue it with a new id.
- Cancellation: closing the SSE response stream is the signal; no
notifications/cancelledon HTTP.
Required headers on every POST
| Header | Value | Required for |
|---|---|---|
MCP-Protocol-Version | same as _meta io.modelcontextprotocol/protocolVersion | all requests |
Mcp-Method | the JSON-RPC method | all requests |
Mcp-Name | params.name or params.uri | tools/call, resources/read, prompts/get |
Headers mirror the body so gateways can route without parsing JSON. The server MUST reject a mismatch or missing required header with HTTP 400 and -32020 (HeaderMismatch). Do not mark secrets or personal data with x-mcp-header: intermediaries see headers.
Security baseline (Security & Endpoint section)
- Servers MUST validate
Originon all incoming connections and MUST return HTTP 403 if it is present and invalid. This is the defence against DNS rebinding (a web page reaching a local server). - When running locally, servers SHOULD bind to
127.0.0.1, not0.0.0.0. - Servers SHOULD authenticate all connections (OAuth 2.1, L13).
What the lab server returned (captured 2026-11-26)
Official Python SDK mcp 2.3.0 on 127.0.0.1 (as in the L11 lab):
| Variation | HTTP status | Body |
|---|---|---|
Correct server/discover | 200 | DiscoverResult (L06) |
Mcp-Name does not match the body's name | 400 | -32020 |
No Mcp-Method header | 400 | -32020 |
MCP-Protocol-Version: 2099-01-01 (and same in _meta) | 400 | -32022, "supported":["2026-07-28"] |
params without _meta | 400 | -32602 |
GET /mcp with MCP-Protocol-Version: 2026-07-28 | 405 | Allow: POST |
GET /mcp with no version header | 400 | -32600, "Missing session ID" (legacy path, below) |
Origin: http://evil.example | 403 | Invalid Origin header |
Host: evil.example:8000 (lab-l11) | 421 | DNS-rebinding protection |
The 403 is the spec's MUST; the 421 is extra SDK protection for loopback servers.
Legacy: what older clients send (interoperability)
- Legacy Streamable HTTP (2025-03-26 to 2025-11-25):
Mcp-Session-Idsessions (ended with DELETE), a standalone GET stream, server requests on SSE streams,Last-Event-IDresumption. A server supporting only 2026-07-28 SHOULD answer GET or DELETE with 405 and ignoreMcp-Session-IdandLast-Event-ID. - The labs' SDK is dual-era (an SDK compatibility layer): a request with no
MCP-Protocol-Versionheader, or a handshake-era one, takes the legacy path on the same/mcp. Modern requests stay stateless. - HTTP+SSE (2024-11-05) is deprecated since 2025-03-26: a GET stream announces a POST URL in an
endpointevent. New implementations SHOULD NOT adopt it (Claude Code also marks its SSE transport deprecated).
Glossary
- Transport: the channel messages travel on (stdio or Streamable HTTP).
- stdio: the host launches the server as a subprocess; messages are lines on stdin/stdout.
- Streamable HTTP: one POST endpoint; each response is JSON or a request-scoped SSE stream.
Mcp-Method/Mcp-Name: required headers that mirror the body for routing.- Origin validation: rejecting requests from foreign web origins with 403 (DNS-rebinding defence).
- Legacy: session-based Streamable HTTP and the deprecated HTTP+SSE transport.
To remember
- stdio: stdout carries only MCP messages; logs go to stderr; cancel with
notifications/cancelled. - Streamable HTTP is stateless (2026-07-28): POST only, request-scoped SSE, no
Mcp-Session-Id, no resumption. - Every POST needs
MCP-Protocol-Version,Mcp-Method(andMcp-Namefor calls/reads/gets); mismatch =400 -32020. - Invalid Origin → 403; bind
127.0.0.1locally; authenticate remote servers. - Sessions and HTTP+SSE are legacy/deprecated: interoperate with them, don't build on them.
Turning Point Academy · MCP Engineering course · Module 1 · Lesson 7 (L07) · V2, spec 2026-07-28