Skip to content

Commit a46eeea

Browse files
committed
docs: regroup the nav into topical sections
The docs render as one flat 15-chapter "Tutorial - User Guide" plus a 15-item "Advanced" grab-bag (whose sidebar heading is a dead label: it has no index page), and the section a deploying user needs most, "Running your server", has exactly one child, titled "ASGI". Regroup the same 40 pages into sections a reader would actually scan for: Get started install -> first server -> test it Servers one page per thing a server exposes; Tools first Inside your handler the Context, dependencies, and everything a running handler can do Running your server now also owns Authorization and OpenTelemetry Clients now also owns OAuth, identity assertion, connecting to multiple servers, and the cache Advanced only the genuine escape hatches (5, was 15), with a real, clickable index page "Protocol versions" and "Deprecated features" become their own top-level entries. The first is the one page that squarely explains the two protocol eras and was buried as the last child of "The Client", where a server author never looks. The second is the SEP-2577 retirement table, filed dead last in "Advanced". Not a single file moves. MkDocs nav sections, nav titles, and file paths are three independent things, so this is an mkdocs.yml edit plus three new ~200-word section index pages (docs/servers/, docs/handlers/, docs/advanced/). Every existing URL, every `--8<--` include, and every docs_src test is untouched, and Material's breadcrumbs follow the nav, not the directory. docs/tutorial/index.md is rewritten from a "how these docs are built" meta page into the Get started doorway; its tested-examples promise is kept. tests/test_examples.py gains the two new docs directories so their fenced code blocks stay lint-covered, and AGENTS.md's description of how the docs are organised is updated to match.
1 parent 8f79a1c commit a46eeea

7 files changed

Lines changed: 130 additions & 37 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@ rather than adding new standalone sections.
138138
## Documentation
139139

140140
When a change affects public API or user-visible behaviour, update the relevant
141-
page(s) under `docs/` in the same PR. Docs are organised by topic
142-
(`tutorial/`, `client/`, `run/`, `advanced/`) — find the page covering the
143-
feature you touched rather than adding a new one.
141+
page(s) under `docs/` in the same PR. Docs are organised by the `nav:` sections
142+
in `mkdocs.yml` (Get started, Servers, Inside your handler, Running your server,
143+
Clients, Advanced), not by the on-disk directory names — find the page covering
144+
the feature you touched in `mkdocs.yml` rather than adding a new one.
144145

145146
## Formatting & Type Checking
146147

docs/advanced/index.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Advanced
2+
3+
Everything an ordinary server or client needs has a topical home in the sections above.
4+
This section is the escape hatches — the things you reach for when `MCPServer`'s
5+
convenience layer is in the way:
6+
7+
* **[The low-level Server](low-level-server.md)** — the class `MCPServer` is built on.
8+
Hand-written schemas, `on_*` handlers, nothing checked for you, and custom JSON-RPC
9+
methods of your own.
10+
* **[Pagination](pagination.md)** and **[Middleware](middleware.md)** — two things you
11+
can *only* do on the low-level `Server`.
12+
* **[Extensions](extensions.md)** and **[MCP Apps](apps.md)** — the protocol's
13+
extension surface: compose extension packages into a server, or write your own.
14+
15+
A few things you might reasonably look for here live where you'd actually use them
16+
instead:
17+
18+
* **Authorization** is under **[Running your server](../run/index.md)** — you protect a
19+
server where you deploy it.
20+
* **OAuth**, **identity assertion**, connecting to **multiple servers**, and the
21+
response **cache** are all under **[Clients](../client/index.md)**.
22+
* **Multi-round-trip requests** and **Subscriptions** are under
23+
**[Inside your handler](../handlers/index.md)** — both are things a handler *does*.
24+
* **URI templates** is under **[Servers](../servers/index.md)**, next to Resources.
25+
* **[Protocol versions](../client/protocol-versions.md)** and
26+
**[Deprecated features](deprecated.md)** each have their own top-level page.
27+
28+
If you're not sure whether you need this section, you don't.

docs/handlers/index.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Inside your handler
2+
3+
A handler's arguments come from the client. Everything *else* it can read, and
4+
everything it can do while it runs, is here.
5+
6+
What it can read:
7+
8+
* **[The Context](../tutorial/context.md)** — the one extra parameter any handler can
9+
ask for: the live request, its headers, its session, and most of the verbs below.
10+
* **[Dependencies](../tutorial/dependencies.md)** — parameters the model never sees,
11+
filled in by your own functions with `Resolve`.
12+
* **[Lifespan](../tutorial/lifespan.md)** — state your server builds once at startup,
13+
and how a handler reaches it through the `Context`.
14+
15+
What it can do while it runs:
16+
17+
* Ask the user for more input — **[Elicitation](../tutorial/elicitation.md)**, and
18+
**[Multi-round-trip requests](../advanced/multi-round-trip.md)**, the 2026-07-28
19+
pattern that carries it.
20+
* Report **[Progress](../tutorial/progress.md)** on something slow.
21+
* Write logs — to standard error, for whoever operates the server — with
22+
**[Logging](../tutorial/logging.md)**.
23+
* Tell subscribed clients that something changed —
24+
**[Subscriptions](../advanced/subscriptions.md)**.
25+
26+
If you haven't registered a handler yet, start with
27+
**[Tools](../tutorial/tools.md)** — every page here assumes you have one.

docs/servers/index.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Servers
2+
3+
An `MCPServer` exposes three primitives to a connected client. They differ by who
4+
decides to use them:
5+
6+
* A **[tool](../tutorial/tools.md)** is an action the *model* picks and calls. This is
7+
the page most people want first, and
8+
**[Structured Output](../tutorial/structured-output.md)** is its reference companion:
9+
everything about the shape of what a tool returns.
10+
* A **[resource](../tutorial/resources.md)** is read-only data the *application*
11+
chooses to read. **[URI templates](../advanced/uri-templates.md)** is its reference
12+
companion: the full addressing syntax and the path-safety rules.
13+
* A **[prompt](../tutorial/prompts.md)** is a message template a *person* invokes by
14+
name, from a menu or a slash command.
15+
16+
Around the three primitives, the rest of what a server declares:
17+
18+
* **[Completions](../tutorial/completions.md)** — server-side autocomplete for prompt
19+
and resource-template arguments.
20+
* **[Images, audio & icons](../tutorial/media.md)** — everything a tool can
21+
return besides text, and the icons a client shows next to your server.
22+
* **[Handling errors](../tutorial/handling-errors.md)** — the difference between an
23+
error the model can recover from and one it must never see.
24+
25+
Every page here stands on its own; jump straight to the one you need. If you haven't
26+
built a server yet, start with **[First steps](../tutorial/first-steps.md)** instead.
27+
28+
What happens *inside* the functions you register — the `Context`, dependency injection,
29+
asking the user for more input mid-call — is the next section,
30+
**[Inside your handler](../handlers/index.md)**.

docs/tutorial/index.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Tutorial - User Guide
1+
# Get started
22

3-
This tutorial shows you how to use the MCP Python SDK, step by step.
4-
5-
Each section gradually builds on the previous ones, but it's written so you can go straight to any specific section to solve a specific problem. It also works as a future reference: you can come back to exactly the part you need.
3+
New to MCP, or new to this SDK? Start here. These pages take you from nothing to a
4+
working, tested server: [install the SDK](../installation.md), build your
5+
[first server](first-steps.md), and [test it](testing.md) with an in-memory client.
66

77
## Run the code
88

@@ -18,7 +18,7 @@ It is **HIGHLY encouraged** that you write (or copy) the code, edit it, and run
1818

1919
## You will not be guessing
2020

21-
Every example in this tutorial is a complete file under [`docs_src/`](https://github.com/modelcontextprotocol/python-sdk/tree/main/docs_src) in the SDK's own repository, and every one of them is exercised by the SDK's test suite through an **in-memory client**:
21+
Every example in these docs is a complete file under [`docs_src/`](https://github.com/modelcontextprotocol/python-sdk/tree/main/docs_src) in the SDK's own repository, and every one of them is exercised by the SDK's test suite through an **in-memory client**:
2222

2323
```python
2424
import pytest
@@ -38,14 +38,14 @@ No subprocess, no port, no transport. `Client(mcp)` connects to the server objec
3838

3939
If a change to the SDK breaks an example on one of these pages, CI goes red before the page does. The code you read here is the code that runs.
4040

41-
You'll use this yourself in the [Testing](testing.md) chapter; it's how you test your own servers, too.
42-
43-
## Install the SDK
44-
45-
If you haven't yet, [install the SDK](../installation.md) first.
41+
You'll use this yourself in [Testing](testing.md); it's how you test your own servers, too.
4642

47-
## Advanced User Guide
43+
## Where to go next
4844

49-
There is also an **Advanced User Guide** you can read after this one.
45+
Once you have a server running, the rest of these docs are a reference, not a course.
46+
Every page stands on its own — jump straight to what you need:
5047

51-
It builds on this tutorial, uses the same concepts, and teaches you the extra things: the low-level `Server`, middleware, authorization, the 2026-07-28 protocol negotiation. But you should read this first: everything in the Advanced guide assumes you know the basics.
48+
* What a server exposes — tools, resources, prompts — is **[Servers](../servers/index.md)**.
49+
* What's available inside the functions you register is **[Inside your handler](../handlers/index.md)**.
50+
* Getting it in front of clients — stdio, HTTP, your existing FastAPI app — is **[Running your server](../run/index.md)**.
51+
* Building the other side, an application that *uses* MCP servers, is **[Clients](../client/index.md)**.

mkdocs.yml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,53 @@ site_url: https://py.sdk.modelcontextprotocol.io/v2/
1212

1313
nav:
1414
- MCP Python SDK: index.md
15-
- Installation: installation.md
16-
- Tutorial - User Guide:
15+
- Get started:
1716
- tutorial/index.md
17+
- Installation: installation.md
1818
- First steps: tutorial/first-steps.md
19+
- Testing: tutorial/testing.md
20+
- Servers:
21+
- servers/index.md
1922
- Tools: tutorial/tools.md
2023
- Structured Output: tutorial/structured-output.md
2124
- Resources: tutorial/resources.md
25+
- URI templates: advanced/uri-templates.md
2226
- Prompts: tutorial/prompts.md
27+
- Completions: tutorial/completions.md
28+
- "Images, audio & icons": tutorial/media.md
29+
- Handling errors: tutorial/handling-errors.md
30+
- Inside your handler:
31+
- handlers/index.md
2332
- The Context: tutorial/context.md
2433
- Dependencies: tutorial/dependencies.md
25-
- Handling errors: tutorial/handling-errors.md
2634
- Lifespan: tutorial/lifespan.md
27-
- Media: tutorial/media.md
28-
- Completions: tutorial/completions.md
2935
- Elicitation: tutorial/elicitation.md
36+
- Multi-round-trip requests: advanced/multi-round-trip.md
3037
- Progress: tutorial/progress.md
3138
- Logging: tutorial/logging.md
32-
- Testing: tutorial/testing.md
39+
- Subscriptions: advanced/subscriptions.md
3340
- Running your server:
3441
- run/index.md
35-
- ASGI: run/asgi.md
36-
- The Client:
42+
- Add to an existing app: run/asgi.md
43+
- Authorization: advanced/authorization.md
44+
- OpenTelemetry: advanced/opentelemetry.md
45+
- Clients:
3746
- client/index.md
38-
- Client callbacks: client/callbacks.md
39-
- Client transports: client/transports.md
40-
- Protocol versions: client/protocol-versions.md
47+
- Callbacks: client/callbacks.md
48+
- Transports: client/transports.md
49+
- OAuth: advanced/oauth-clients.md
50+
- Identity assertion: advanced/identity-assertion.md
51+
- Multiple servers: advanced/session-groups.md
52+
- Caching: advanced/caching.md
53+
- Protocol versions: client/protocol-versions.md
54+
- Deprecated features: advanced/deprecated.md
4155
- Advanced:
42-
- Multi-round-trip requests: advanced/multi-round-trip.md
56+
- advanced/index.md
4357
- The low-level Server: advanced/low-level-server.md
44-
- URI templates: advanced/uri-templates.md
4558
- Pagination: advanced/pagination.md
46-
- Caching hints: advanced/caching.md
47-
- Subscriptions: advanced/subscriptions.md
4859
- Middleware: advanced/middleware.md
4960
- Extensions: advanced/extensions.md
5061
- MCP Apps: advanced/apps.md
51-
- OpenTelemetry: advanced/opentelemetry.md
52-
- Authorization: advanced/authorization.md
53-
- OAuth clients: advanced/oauth-clients.md
54-
- Identity assertion: advanced/identity-assertion.md
55-
- Session groups: advanced/session-groups.md
56-
- Deprecated features: advanced/deprecated.md
5762
- Migration Guide: migration.md
5863
- API Reference: api/
5964

tests/test_examples.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ async def test_desktop(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
104104
"docs/index.md",
105105
"docs/installation.md",
106106
"docs/tutorial",
107+
"docs/servers",
108+
"docs/handlers",
107109
"docs/run",
108110
"docs/client",
109111
"docs/advanced",

0 commit comments

Comments
 (0)