docs: lead the README client example with a URL, not the server object

Merged
MA
2mo ago
+10-6

Reworks the README's "A client in 10 lines" so the first client a reader sees connects the way a real program does: serve the server.py from the section above with uv run mcp run server.py --transport streamable-http, then Client("http://localhost:8000/mcp"). The closing sentence mentions stdio and custom transports and links to the Clients docs; in-memory is left to the Testing page.

Also fixes the mcp run --transport help text, which still said "stdio or sse" even though streamable-http is accepted (and is what the README now tells you to run).

Motivation and Context

Started as #3313 (calling a localhost URL a "remote server" read oddly). Looking at it more closely, the bigger problem was that the example imported the server object and connected in-process, then offered the URL as the variation. In-process is a testing convenience, not how anyone connects to a real server, so the landing example shouldn't lead with it.

Closes #3313

How Has This Been Tested?

Ran the README verbatim: extracted the server block, the mcp run ... --transport streamable-http line and the client block into a scratch directory, started the server with that exact command (listens on 127.0.0.1:8000/mcp), ran the client, got {'result': 3}. Also checked localhost vs 127.0.0.1, a second run against the same server, and that mcp run --help shows the new text. pre-commit run --files README.md src/mcp/cli/cli.py passes.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

The docs site has the same lean in more places (the Clients section leads with in-memory, several "what Client accepts" lists put the server object first). That's a broader docs pass and is deliberately not in this PR.

AI Disclaimer