Skip to content

docs: generate hierarchical per-module API reference pages - #2103

Merged
maxisbey merged 1 commit into
modelcontextprotocol:mainfrom
jonathanhefner:generate-all-api-docs
Mar 18, 2026
Merged

docs: generate hierarchical per-module API reference pages#2103
maxisbey merged 1 commit into
modelcontextprotocol:mainfrom
jonathanhefner:generate-all-api-docs

Conversation

@jonathanhefner

Copy link
Copy Markdown
Member

The API docs previously consisted of a single page (docs/api.md) containing only ::: mcp, which rendered just the top-level mcp/__init__.py exports. Most of the public API surface (MCPServer, Context, Settings, Tool, Resource, Prompt, etc.) was missing because those classes live in subpackages not re-exported at the top level.

This replaces the single-page approach with auto-generated per-module pages using the standard mkdocstrings recipe:

  • mkdocs-gen-files runs scripts/gen_ref_pages.py at build time to create a virtual .md stub for every module under src/mcp/
  • mkdocs-literate-nav reads the generated api/SUMMARY.md to build a hierarchical sidebar navigation tree
  • Material theme's navigation.indexes handles section index pages (the mkdocs-section-index plugin is not needed and conflicts with it)

Also updates mkdocstringspaths from [src/mcp] to [src] so that fully-qualified module identifiers like mcp.server.mcpserver.server resolve correctly.

BeforeAfter
before-1after-1
after-2

Kludex
Kludex previously requested changes Feb 19, 2026
Comment threaddocs/hooks/gen_ref_pages.py
The API docs previously consisted of a single page (`docs/api.md`)
containing only `::: mcp`, which rendered just the top-level
`mcp/__init__.py` exports. Most of the public API surface (`MCPServer`,
`Context`, `Settings`, `Tool`, `Resource`, `Prompt`, etc.) was missing
because those classes live in subpackages not re-exported at the top
level.
This replaces the single-page approach with auto-generated per-module
pages using the standard mkdocstrings recipe:
- `mkdocs-gen-files` runs `docs/hooks/gen_ref_pages.py` at build time to
create a virtual `.md` stub for every module under `src/mcp/`
- `mkdocs-literate-nav` reads the generated `api/SUMMARY.md` to build a
hierarchical sidebar navigation tree
- Material theme's `navigation.indexes` handles section index pages (the
`mkdocs-section-index` plugin is not needed and conflicts with it)
Also updates `mkdocstrings` `paths` from `[src/mcp]` to `[src]` so that
fully-qualified module identifiers like `mcp.server.mcpserver.server`
resolve correctly.
@maxisbeymaxisbey added the documentation Improvements or additions to documentation label Mar 5, 2026
@maxisbey
maxisbey dismissed Kludex’s stale reviewMarch 18, 2026 18:15

dismissing as the move was done

@maxisbey
maxisbey merged commit 5388bea into modelcontextprotocol:mainMar 18, 2026
29 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@jonathanhefner@Kludex@maxisbey