stdio- Streamable HTTP
Protocol messages vs transport
The message layer and transport layer solve different problems.
The same tool call follows MCP’s JSON-RPC rules whether it travels through a local process stream or an HTTP endpoint.
stdio
The stdio transport uses a process’s standard input and standard output.
The client launches the MCP server as a child process. It writes MCP messages to the server’s stdin and reads MCP messages from the server’s stdout.
stdio when:
- The server runs on the same machine as the client
- The client can launch and manage the server process
- You want simple one-client-to-one-server process communication
- The server needs approved access to local files or developer tools
stderr. It must not write ordinary log text to stdout, because stdout is reserved for valid MCP messages.
Streamable HTTP
Streamable HTTP connects a client to an independent MCP server over HTTP. The server exposes one MCP endpoint that supports HTTPPOST and, when streaming is offered, GET. Server-Sent Events can carry multiple server messages over a stream.
- The server is hosted remotely
- Multiple users or clients need network access
- You need standard HTTP authentication and infrastructure
- The server must be deployed, monitored, and scaled independently
2024-11-05 protocol version. Legacy compatibility may still be required for older clients or servers.
Comparison
Read Local vs remote MCP for the broader deployment tradeoffs.
Transport lifecycle
After the transport connects, the client and server must agree on protocol behavior. Older MCP clients usually complete initialization like this:- The client sends an
initializerequest. - Both sides negotiate the protocol version and capabilities.
- The client sends an initialized notification.
- Normal requests and notifications begin.
- The connection eventually closes or shuts down.
Streamable HTTP security
A remote MCP endpoint should:- Use HTTPS
- Validate the
Originheader to prevent DNS rebinding attacks - Authenticate requests when the server is not public
- Authorize every requested capability
- Validate the negotiated protocol version
- Restrict redirects and protect credentials
- Apply rate limits and request-size limits
- Avoid returning sensitive information in errors
Custom transports
MCP implementations can support custom transports when both sides agree on message framing and delivery. A custom transport does not change MCP’s JSON-RPC message semantics, initialization, capability negotiation, or security responsibilities. It can reduce interoperability, so use a standard transport unless the environment has a clear requirement. See Custom MCP transport implementation for design considerations.How to choose
Choosestdio for a local server that the host launches and controls. Choose Streamable HTTP for a hosted server that clients reach over a network.
Transport choice affects deployment and connectivity. It does not determine whether a server exposes tools, resources, or prompts.