Lesson 13 / 25

Transports: stdio and HTTP

Choose between a local stdio server and a remote streamable HTTP server.

Local or remote

stdio runs the server as a child process of the host and talks over standard input and output: simple, local, one user, no network. Streamable HTTP runs the server as a web service that many clients can reach, which needs authentication, TLS and careful deployment. Use stdio for personal tools and HTTP for shared ones.

Switching the transport

The tools stay the same; only the last line changes. Option names can differ between SDK versions, so check the docs for yours.

# local: the host launches this process
mcp.run()

# remote: serve over HTTP
mcp.run(transport="streamable-http")

Bind HTTP servers carefully

For local testing bind to 127.0.0.1, not 0.0.0.0. A remote server without authentication lets anyone on the network run your tools.

Quick check: Which transport suits a personal tool launched by your desktop app?

  • stdio
  • Public HTTP without authentication
  • FTP
  • Email
Answer

stdio — stdio is simple and keeps the server local to the host.