CSE Roadmap

Core tier · about 6 hours · 14 parts

Part 10 of 14 · 1 min read

Answering MCP-transport questions in an interview

When would you use stdio and when Streamable HTTP?

"stdio is for a server the host starts as a local subprocess: no network, no auth to design, but it runs with the user's permissions and costs a process per server. Streamable HTTP is for a shared or remote server: one endpoint, POST per message, replies as JSON or an event stream, and in the newer revision stateless, so it sits behind a load balancer. But it is exposed, so you validate Origin, bind locally for local use, authenticate, and check that mirrored headers match the body." Follow-up: "What dates a weak answer here?" Saying "stdio for local, HTTP for remote" and stopping, or claiming MCP uses WebSockets. A strong answer adds that cancellation differs by transport, a broken connection after the work is done needs idempotency keys, and notifications are never replayed.

How would you secure an MCP server that exposes internal data?

"The transport part is Origin validation, loopback binding for local use, authentication on every connection, and header validation against the body it mirrors. TLS covers anything non-local." Follow-up: "Is origin validation enough on its own?" No. The example shows it letting every program-sent request through regardless, because programs are not required to send an Origin header at all. It stops browsers acting for a hostile page, nothing else. The rest (tokens, scopes, tool poisoning) is module 5.