By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
You've got JSON-RPC messages to send between a host and an MCP server, but the protocol doesn't care how those bytes actually move. MCP defines two standard transports, and picking the wrong one means either rebuilding your architecture or dealing with unnecessary complexity. The choice depends on where your server runs and who needs to reach it.
The JSON-RPC message format stays the same. What changes is the underlying mechanism: how bytes leave one process and arrive at another. MCP gives you two options, each optimized for different deployment patterns.
The host launches your server as a child process. Communication happens over stdin and stdout. Each JSON-RPC message is one line of JSON terminated by a newline, so your messages cannot contain raw newlines. Anything else you print to stdout breaks the stream immediately.
Use stderr for logging. Credentials usually come from environment variables set by the host. This transport is built for local tools, file operations, and development workflows where the server and host live on the same machine.
Expose a single HTTP endpoint. Clients POST each JSON-RPC request to it. The response is either a plain JSON body or an event stream (SSE) when you need to send progress updates or partial results first.
Requests carry standard headers Mcp-Method and Mcp-Name, so gateways and load balancers can route and rate-limit without parsing the request body. There are no protocol sessions—any server instance can handle any request. This means you can scale behind a normal load balancer.
Long-lived notifications use subscriptions. If a response stream breaks, the request is lost and the client resends it with a new id. No protocol sessions also means no session affinity required.
The older HTTP+SSE transport with two endpoints is deprecated. If a tutorial tells you to expose /sse and /messages separately, it is out of date.
Validate the Origin header on incoming requests to block DNS-rebinding attacks from malicious web pages. When running locally, bind to 127.0.0.1, not 0.0.0.0. Authenticate every request and use TLS in production.
| Question | stdio | Streamable HTTP |
|---|---|---|
| Who runs it? | The user's host, locally | You, as a service |
| Users | One | Many |
| Auth | Environment / OS user | OAuth, tokens |
| Scaling | One process per user | Horizontal, load balanced |
| Typical use | Filesystem, git, local DB tools | SaaS integrations, shared company tools |
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.