Ch 3 — Transports: stdio & Streamable HTTP
Two built-in ways to move JSON-RPC messages between client and server
High Level
-
Click play or press Space to begin...
AWhat Is a Transport?The pipe that carries JSON-RPC messages
1swap_horiz
ClientSends JSON-RPC
requests
transport
cable
TransportCarries bytes
between processes
transport
dns
ServerReceives and
responds
2arrow_downward Transport 1: stdio — local process communication
Bstdio TransportTalk to a local process via stdin/stdout
laptop
HostSpawns server
as child process
stdin
terminal
Server ProcessReads stdin
writes stdout
stdout
3description
JSON LinesOne JSON message
per line
4arrow_downward Transport 2: Streamable HTTP — remote server communication
CStreamable HTTP TransportTalk to a remote server over HTTP + Server-Sent Events
laptop
ClientSends HTTP POST
with JSON-RPC
POST
cloud
HTTP ServerSingle /mcp
endpoint
SSE
5stream
SSE StreamServer pushes
events to client
6arrow_downward When to use which transport?
DChoosing a TransportLocal = stdio, Remote = Streamable HTTP
home
Local ServerSame machine
use stdio
vs
cloud
Remote ServerDifferent machine
use HTTP
vs
settings_suggest
CustomWebSocket, IPC...
implement yourself
7arrow_downward Sessions: maintaining state across HTTP requests
ESessions & StateHow HTTP maintains stateful connections
fingerprint
Session IDServer assigns
after initialize
sent via
badge
Mcp-Session-IdHTTP header on
every request
enables
sync
ReconnectionResume after
network drop
8arrow_downward The transport is invisible to the protocol layer
FTransport AbstractionThe protocol doesn’t care how bytes move
data_object
Protocol LayerJSON-RPC messages
tools, resources...
agnostic
layers
Transport Layerstdio, HTTP, or
anything custom
=
swap_vert
SwappableChange transport
without changing code