Skip to content

Commit 7d3ea3b

Browse files
committed
docs: say out loud that mcp.run() is a stdio server, on the host page
"Connect to a real host" showed a server file ending in mcp.run() and never said what that call does, which is the one fact the whole page stands on: with no arguments it is a STDIO server -- it blocks, reads protocol messages on stdin, writes them on stdout, and never opens a port. That is why every host on the page is configured with a command rather than an address. Running your server explains this, but a reader lands on this page from the Get started sequence (or a search) without having read that one. The same page now also answers the two questions a reader has next, in one note: this is the LOCAL story (to serve people who don't have your file, you hand out a URL -- Running your server, then Deploy & scale), and a host is just an application with an MCP client inside, so your own Python can play that part (Client transports launches the same file with stdio_client). Client transports points back the other way.
1 parent 01128d6 commit 7d3ea3b

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

docs/client/transports.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Two things to notice:
7272

7373
## stdio
7474

75-
A **stdio** server is a subprocess. The client launches it, writes JSON-RPC to its stdin and reads JSON-RPC from its stdout. It is how a desktop host runs a server on your machine.
75+
A **stdio** server is a subprocess. The client launches it, writes JSON-RPC to its stdin and reads JSON-RPC from its stdout. It is how a desktop host runs a server on your machine — a host *is* this code plus a UI, and **[Connect to a real host](../get-started/real-host.md)** is the same relationship seen from the host's side, as a config file.
7676

7777
Describe the process with `StdioServerParameters`, turn it into a transport with `stdio_client`, and hand *that* to `Client`:
7878

docs/get-started/real-host.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ Which means connecting to a host is one act: you tell it **the command that star
1010
--8<-- "docs_src/real_host/tutorial001.py"
1111
```
1212

13-
Two tools and a resource, one file. Two things about that file matter to every host below:
13+
Two tools and a resource, one file. Three things about that file matter to every host below:
1414

15+
* `mcp.run()` with no arguments starts a **stdio** server: it blocks, reads protocol messages on stdin, and writes them on stdout. That is the transport every host on this page speaks — the host starts your file as a child process and owns those two pipes — and it is why connecting is only ever "here is the command". You never pick a port, and nothing listens on one.
1516
* `run()` is under `if __name__ == "__main__":`. Everything below **imports** this file rather than executing it, so an unguarded `run()` would start a server the moment anything loaded the module.
1617
* The server object is a module-level global named `mcp`. That's the name `mcp run` looks for (`server` and `app` also work). Call it something else and you name it explicitly: `mcp run server.py:bookshop`.
1718

@@ -39,6 +40,19 @@ It is also the command `mcp install` writes into Claude Desktop's config for you
3940
`uv` with the absolute path from `which uv` (macOS/Linux) or `where uv` (Windows). That is
4041
exactly what `mcp install` writes.
4142

43+
!!! note "This page is the local story"
44+
Everything here runs your server on the machine the host is on: the host launches your
45+
file, over stdio. That is exactly right for a personal or single-machine tool. To give a
46+
server to people who do *not* have your file, you hand out a **URL**, not a command — the
47+
same `mcp` object served over Streamable HTTP. **[Running your server](../run/index.md)**
48+
is that decision in one table, and **[Deploy & scale](../run/deploy.md)** is the road from
49+
there to a real hostname.
50+
51+
And a host is nothing more than an application with an MCP client inside it, so your own
52+
Python can play the host's part: **[Client transports](../client/transports.md)** launches
53+
this same file as a subprocess with `stdio_client(...)`, and **[Testing](testing.md)**
54+
connects to it in memory with no process at all.
55+
4256
## Claude Desktop
4357

4458
The one host the SDK can configure for you:

0 commit comments

Comments
 (0)