veda.ng

Transports & Message Format

MCP uses JSON-RPC 2.0 over multiple transport layers. This module covers how messages flow between clients and servers. from local stdio to remote HTTP.

MCP Transport Layers

Same protocol, different delivery mechanisms

stdio
Standard input/output pipes
How it works

Host spawns server as child process. Messages via stdin/stdout.

Best for

Local development, CLI tools, Claude Desktop

Limitation

Same machine only, no network

SSE
Server-Sent Events over HTTP
How it works

Client POSTs to /messages, server streams via /sse endpoint.

Best for

Remote servers, multi-user, cloud hosting

Limitation

Requires persistent connection, two endpoints

Streamable HTTP
Single HTTP endpoint (newest)
How it works

Single endpoint, stateless by default, streams when needed.

Best for

Production, serverless (Vercel, Lambda, Workers)

Limitation

Newest transport, some clients still adopting

MCP is transport-agnostic: the same protocol works whether the server runs on your local machine or across the internet. Understanding the transport layer is essential because it determines how you deploy, test, and scale your servers.

Transport Comparison

Choosing the right communication layer for your MCP server

TransportLatencySetupSecurityBest For
stdio<1msZero configProcess isolationLocal development, CLI tools
HTTP/SSE~50msServer + URLAuth headers, TLSRemote servers, cloud deployment
Streamable HTTP~50msServer + URLAuth + streamingLong-running operations, file transfers