Transport Config

MCP interview question · Medium difficulty

How do you configure stdio, local, and remote transports on an MCP client?medium

Status
✓
Type
applied
Topic
transport-config
Frequency
common
Tags
mcp, transports, stdio, streamable-http, MultiServerMCPClient
Answer

MultiServerMCPClient takes a dict keyed by server name: a stdio server gets transport: "stdio" plus a command and args to spawn a subprocess; a local HTTP server gets transport: "streamable_http" with a localhost URL; a remote third-party server gets the same streamable_http transport pointed at their hosted URL, with an Authorization header for auth.

Explanation

The three configs differ only in how the client reaches the process, not in how tools are used afterward — client.get_tools() auto-discovers tools the same way regardless of transport. stdio has no port and no network; the client owns the subprocess's lifecycle, which suits local scripts and dev tools. streamable_http (local) is for a service you run yourself, like a Dockerized microservice. streamable_http (remote) is for a vendor-hosted server such as GitHub's or Stripe's MCP endpoint, where you supply a bearer token instead of running anything yourself.

Follow-upWhat's the practical difference between running streamable_http locally versus stdio for a service you own?
Follow-upWhy would a client need an Authorization header for a remote MCP server but not for stdio?
Follow-upIf you see transport: "sse" in a config, what should you assume about when that code was written?