Guide protocol/

stdio vs Streamable HTTP: choosing an MCP transport

When to run an MCP server as a subprocess, when to put it behind an HTTP endpoint, and what the 2026-07-28 spec requires of each.

Published
Read
6 min
Source
Markdown

Short answer

MCP defines two standard transports. With stdio, the client launches the server as a subprocess and exchanges newline-delimited JSON-RPC over stdin and stdout, and the server reads credentials from its environment. With Streamable HTTP, the server exposes one endpoint, such as https://example.com/mcp, the client sends every message as an HTTP POST, and authorization follows MCP's OAuth-based flow. Use stdio when the server needs your files, local tools or hardware; otherwise the MCP docs say to use the remote version.

Checked against: stdio spec, Streamable HTTP spec, Authorization spec, Local Server Security and Claude Code MCP docs, December 6, 2026.

Run by us: no. Commands are copied from Anthropic’s Claude Code docs; HTTP examples are copied from the MCP specification.

What is the difference between stdio and Streamable HTTP?

stdio runs the MCP server as a child process of the client, while Streamable HTTP runs it as an independent process behind one HTTP endpoint that can serve many clients.

stdio Streamable HTTP
Who starts the server The client, as a subprocess The operator; it runs independently
Framing One JSON-RPC message per line on stdin and stdout One JSON-RPC message per HTTP POST to the MCP endpoint
Server replies Lines on stdout A JSON object or an SSE stream scoped to that request
Typical clients per server One Many
Credentials From the environment OAuth-based authorization (optional, SHOULD conform when used)
Request metadata In the body only In the body, mirrored into HTTP headers
Cancel a request Send notifications/cancelled Close that request’s response stream
Shut down Close the server’s stdin, wait, then terminate Server runs as an independent process

These rules come from the MCP specification as of December 6, 2026 (revision 2026-07-28). The transports overview calls a transport a “binding”: it changes framing and delivery, not what messages mean. A tools/call is the same JSON on both.

How does a stdio server talk to its client?

A stdio server reads JSON-RPC from stdin, writes JSON-RPC to stdout, and must write nothing else to stdout.

In Claude Code, a stdio server is a command. This is Anthropic’s example:

claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
  -- npx -y airtable-mcp-server

Everything after -- is the server’s own command line. The Claude Code docs say that without it, Claude Code “would try to parse the server’s flags” as its own options.

The stdio spec sets these rules:

  • Messages are delimited by newlines and MUST NOT contain embedded newlines.
  • The server MUST NOT write anything to stdout that isn’t a valid MCP message. Logs go to stderr.
  • The client SHOULD NOT assume stderr output means an error.
  • The server MUST NOT send JSON-RPC requests on stdout. When it needs input, it returns an InputRequiredResult.
  • To shut down, the client closes the server’s stdin, waits, and then terminates the process, typically SIGTERM and then SIGKILL on POSIX.
  • If the server crashes, the client SHOULD restart it. In-flight requests are lost and can be retried.

A stdio server has no network listener, which is why the MCP security best practices tell developers of local servers to use stdio “to limit access to just the MCP client.” It is not a sandbox, though. The Local Server Security guide says “the client and a stdio server share one trust domain.”

What does a Streamable HTTP request look like?

A Streamable HTTP request is a POST to the MCP endpoint whose headers repeat the protocol version, method and tool name from the body.

POST /mcp HTTP/1.1
Host: example.com
Content-Type: application/json
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: get_weather

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_weather",
    "arguments": {
      "location": "Seattle, WA"
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientInfo": {
        "name": "ExampleClient",
        "version": "1.0.0"
      },
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

The Streamable HTTP spec requires:

  • An Accept header listing both application/json and text/event-stream. The client must handle either response type.
  • MCP-Protocol-Version and Mcp-Method on every POST, plus Mcp-Name for tools/call, resources/read and prompts/get.
  • 202 Accepted with no body when the server accepts a notification.
  • Validation of the Origin header on every connection, with 403 Forbidden for an invalid one, to block DNS rebinding.

The headers exist so load balancers and gateways can route without parsing the body. A tool can also mark a parameter with x-mcp-header to have it mirrored as Mcp-Param-{name}. The spec says not to mark passwords, API keys, tokens or PII that way, because intermediaries see headers.

How do I add each kind of server to a client?

You add a stdio server as a command and a Streamable HTTP server as a URL.

claude mcp add --transport http notion https://mcp.notion.com/mcp
claude mcp add --transport http secure-api https://api.example.com/mcp \
  --header "Authorization: Bearer your-token"

Those are Anthropic’s Claude Code examples for HTTP servers, the second with a static header. For servers that use OAuth, run /mcp inside Claude Code and “follow the steps in your browser to log in.” The docs also state that “The SSE (Server-Sent Events) transport is deprecated.”

A project-scoped server is written to .mcp.json in the project root:

{
  "mcpServers": {
    "shared-server": {
      "type": "http",
      "url": "https://example.com/mcp"
    }
  }
}

Claude Code asks for approval in interactive sessions before using project-scoped servers from .mcp.json. For per-client commands and scopes, see the Claude Code MCP config guide.

How does authentication differ between the two?

A stdio server reads credentials from its environment, while a Streamable HTTP server can challenge the client and send it through an OAuth flow.

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource",
                         scope="files:read"

That 401 is the Authorization spec’s example. The client fetches the protected resource metadata, finds the authorization server, and sends the user through a browser login. Then it puts the token in an Authorization: Bearer header on every request.

The spec says stdio implementations “SHOULD NOT follow this specification, and instead retrieve credentials from the environment.” For HTTP, the MCP server acts as an OAuth 2.1 resource server. It must check that each token was issued for it, and it “MUST NOT accept or transit any other tokens.” See token passthrough and the MCP OAuth flow guide.

Which transport should I choose?

Choose stdio only when the server needs something on your machine; otherwise, choose a remote Streamable HTTP server.

Situation Transport Basis
Server reads your working tree, drives a local tool or reaches hardware stdio Local Server Security
Server only wraps an internet API Streamable HTTP, remote Local Server Security
The Claude API’s MCP connector must reach it Streamable HTTP or SSE, publicly exposed Anthropic
OpenAI’s Responses API must reach it Streamable HTTP or HTTP/SSE, public, or private through Secure MCP Tunnel OpenAI
Many users share one deployment Streamable HTTP Architecture overview
A local server must listen on a port HTTP bound to 127.0.0.1, with Origin checks and auth Streamable HTTP spec

The MCP project’s rule of thumb: “If unsure: when a server needs none of your files, local tools, or local network, use its remote version and skip the local install entirely.” Its reasoning is that a remote server “runs no code on your machine” and “is patched in one place.”

Anthropic’s MCP connector documentation says “Local STDIO servers cannot be connected directly.” The last row has a caveat too: the Local Server Security guide warns that “Binding to 127.0.0.1 is not an authentication boundary.”

What breaks, and how do I fix it?

Most transport failures map to a specific rule in the spec.

Symptom Likely cause Fix
Client can’t parse a stdio server’s output Server prints logs or banners to stdout Log to stderr only
Claude Code rejects a flag meant for the server Missing -- separator Put the server command after --
HTTP 403 on every request Origin header fails validation Allow the client’s origin on the server
HTTP 400 with error -32020 (HeaderMismatch) Missing or mismatched Mcp-* headers Send headers that match the body; on Mcp-Param mismatch, re-run tools/list and retry
HTTP 400 with UnsupportedProtocolVersionError Client asked for a version the server doesn’t support Retry with a version from the server’s supported list
HTTP 405 on GET or DELETE Client built for 2025-11-25 or earlier, which used sessions and a GET stream Upgrade the client, or run a server that also implements the older revision
SSE events arrive late through a proxy Proxy buffering Server sends X-Accel-Buffering: no

Revision 2026-07-28 removed sessions, the standalone GET stream and stream resumability from Streamable HTTP (changelog). A server that supports only this revision SHOULD answer GET or DELETE with 405, ignore Mcp-Session-Id, and ignore Last-Event-ID. The older HTTP+SSE transport from 2024-11-05 has been deprecated since 2025-03-26.

Sources

  1. Transports overview (specification 2026-07-28)Model Context Protocol modelcontextprotocol.io
  2. stdio (specification 2026-07-28)Model Context Protocol modelcontextprotocol.io
  3. Streamable HTTP (specification 2026-07-28)Model Context Protocol modelcontextprotocol.io
  4. Authorization (specification 2026-07-28)Model Context Protocol modelcontextprotocol.io
  5. Key Changes (revision 2026-07-28)Model Context Protocol modelcontextprotocol.io
  6. Architecture overviewModel Context Protocol modelcontextprotocol.io
  7. Local Server SecurityModel Context Protocol modelcontextprotocol.io
  8. Security Best PracticesModel Context Protocol modelcontextprotocol.io
  9. Connect Claude Code to tools via MCPAnthropic code.claude.com
  10. MCP connectorAnthropic platform.claude.com
  11. MCP servers (Connectors and MCP)OpenAI developers.openai.com

Changelog

  • First published.

Cite this page

Agents for Devs. "stdio vs Streamable HTTP: choosing an MCP transport." Published Dec 6, 2026. https://agentsfordevs.com/guides/mcp-transports
Cite one section