[Docs] Render the guides with Zensical instead of phpDocumentor - #414
Open
chr-hertel wants to merge 3 commits into
Open
[Docs] Render the guides with Zensical instead of phpDocumentor#414chr-hertel wants to merge 3 commits into
chr-hertel wants to merge 3 commits into
Conversation
chr-hertel
requested review from
CodeWithKyrian,
Nyholm and
soyuka
as code owners
August 10, 2026 23:09
chr-hertel
force-pushed
the
docs-zensical-poc
branch
from
August 10, 2026 23:22
bc1611c to
86d609a
Compare
phpDocumentor's guide renderer copies the markdown through mostly verbatim: relative links between pages keep pointing at `*.md` targets that do not exist in the built site, and nothing validates them, so the published guides are full of dead links. Zensical (the Material for MkDocs team's successor to MkDocs) resolves internal links against the page tree and fails the build on a broken one. `zensical build --strict` already found four dead links on the first run — three repo-relative links escaping docs/ (fixed to point at GitHub) and one wrong in-page anchor. phpDocumentor stays on for the class-level API reference only; `make docs` builds the guides into site/ and mounts the reference at site/api/, so its two header links back to the guides now target the site root. Deployment moves from pushing a gh-pages branch to the official GitHub Pages actions, and from release-only to every push on main, with pull requests building (but not deploying) so a broken link fails review instead of the site. NOTE: this needs the repository's Pages source switched to "GitHub Actions" (Settings -> Pages) once.
The docs site now uses the same theme configuration as https://py.sdk.modelcontextprotocol.io/ so the language SDKs read as one set of docs: the MCP mark as logo and favicon, Inter/JetBrains Mono, the black/slate palette with a three-way (system/light/dark) toggle, instant navigation, code copy/annotate, and a right-hand table of contents. The markdown extension set is widened to the same list (tabbed blocks, task lists, footnotes, emoji/icons, mermaid fences), which the content restructure builds on. Styling is otherwise stock: no custom stylesheet, and Zensical's own `modern` theme variant, pinned explicitly rather than left to the default. The one departure is code highlighting, which is broken out of the box here: Pygments only highlights PHP after a `<?php` tag, so the guides — whose code blocks are almost all fragments — rendered as flat plain text. The `php` lexer is extended with `startinline`, and complete-file blocks use a `php-file` lexer that keeps the literal open tag highlighted.
The guides were ten flat pages, each opening with a hand-maintained table of contents and each mixing several audiences: `mcp-elements.md` covered tools, prompts, schema generation and handler-side logging, `transports.md` covered both transports plus framework integration, and `server-builder.md` covered configuration, sessions and custom message handlers. They are now split along the same lines as the Python SDK's documentation (https://py.sdk.modelcontextprotocol.io/), one topic per page: Get started installation, first server, the Inspector Servers tools, resources, resource templates, prompts, completions, schema generation, registration Inside your handler the ClientGateway, logging Running your server builder, STDIO, HTTP, framework integration, sessions, authorization Clients connecting, transports, capabilities, server-initiated requests, error handling Advanced events, protocol extensions, custom message handlers Prose is carried over as-is apart from the seams; what is new is the landing page and one index page per section, which say what the section is for and where to go next, so no page is a dead end. The per-page "Table of Contents" lists are gone — the theme renders one from the headings — and GitHub's `> [!IMPORTANT]` blockquotes became admonitions, which Zensical renders as callouts rather than plain quotes. Every code sample and factual claim was then checked against src/ and the runnable examples, which turned up long-standing errors in the carried-over prose. Samples that could not run: a prompt using a `system` role (MCP has only user/assistant), `Mcp\Schema\PromptMessage` (it is under `Schema\Content`) constructed with an array instead of a single content object, `Mcp\Capability\Prompt\Completion\ProviderInterface` (it is `Mcp\Capability\Completion\ProviderInterface`), `new EmbeddedResource(type:, resource: [...])` (neither parameter exists), a `: resource` return type (not a PHP type), `#[McpResource]` with a `{path}` variable (that is a template), a stray quote in the builder example, a `middlewares:` argument (it is `middleware:`), and `getRequest()->getAttribute()` in the OAuth guide (no such method — the values arrive on the request meta). Claims corrected: sampling's `system_prompt` option (it is `systemPrompt`), `SampleMessage` (it is `SamplingMessage`), `Notification` called an interface (abstract class), "parameter order matters" for URI templates (bound by name), full RFC 6570 support (only simple `{var}`), the tool description fallback chain, `void` returning empty content, a non-zero STDIO exit code, `ErrorEvent` being null for parse errors, handlers being "prepended", `Psr16StoreSession`, and PSR-3 log context being sent to the client (it is dropped). Sixteen `examples/` paths were missing their `server/` segment. README, the OAuth ADR and one source comment now point at the published site instead of at markdown files that moved.
chr-hertel
force-pushed
the
docs-zensical-poc
branch
from
August 10, 2026 23:48
86d609a to
d1c43a8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the project’s guide documentation build from phpDocumentor guides to Zensical/MkDocs Material (matching the Python SDK docs), while keeping phpDocumentor for the generated API reference mounted at /api/. It also updates the build/deploy pipeline to publish the combined site via GitHub Pages (Actions-based deployment).
Changes:
- Add MkDocs/Zensical configuration and reorganize guide content under
docs/into a sectioned navigation. - Update
make docsto build Zensical guides + phpDocumentor API docs and merge them into a singlesite/output. - Replace the previous gh-pages branch deployment with the official GitHub Pages Actions workflow and update external doc links.
Reviewed changes
Copilot reviewed 51 out of 54 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Server/Transport/Http/OAuth/ProtectedResourceMetadataHandler.php | Update docs reference path for authorization guide. |
| requirements-docs.txt | Add pinned Zensical dependency for docs toolchain. |
| README.md | Point documentation links to the published docs site URLs. |
| phpdoc.dist.xml | Configure phpDocumentor to output API docs only under .phpdoc/build/api. |
| mkdocs.yml | Add MkDocs/Zensical site configuration, theme, nav, and markdown extensions. |
| Makefile | Split docs build into guides (Zensical) + API (phpDocumentor) and add docs-serve. |
| examples/client/http_discovery_calculator.php | Update server startup path/port in usage comment. |
| docs/servers/tools.md | New “Tools” guide page for server-side tooling. |
| docs/servers/schemas.md | New schema generation/validation guide page. |
| docs/servers/resources.md | New “Resources” guide page. |
| docs/servers/resource-templates.md | New “Resource templates” guide page. |
| docs/servers/registration.md | New “Registering elements” guide page. |
| docs/servers/prompts.md | New “Prompts” guide page. |
| docs/servers/index.md | New “Servers” section index page. |
| docs/servers/completions.md | New completion providers guide page. |
| docs/server-builder.md | Remove legacy top-level server builder guide (moved under docs/run/). |
| docs/run/stdio.md | New STDIO transport guide page. |
| docs/run/sessions.md | New sessions guide page. |
| docs/run/server-builder.md | New server builder guide page under “Running your server”. |
| docs/run/index.md | New “Running your server” section index page. |
| docs/run/http.md | Refocus HTTP transport doc and convert callouts to admonitions. |
| docs/run/framework-integration.md | New framework integration guide page. |
| docs/run/authorization.md | Update authorization docs for new structure and middleware/meta behavior. |
| docs/mcp-elements.md | Remove legacy monolithic “MCP Elements” guide (split into section pages). |
| docs/index.md | Replace legacy docs landing page with new MkDocs site homepage. |
| docs/handlers/logging.md | New handler logging guide page. |
| docs/handlers/index.md | New “Inside your handler” section index page. |
| docs/handlers/client-communication.md | Rename/rework handler client-communication guide. |
| docs/get-started/installation.md | New installation guide page. |
| docs/get-started/inspector.md | New Inspector walkthrough guide page. |
| docs/get-started/index.md | New “Get started” section index page. |
| docs/get-started/first-server.md | New “First server” tutorial page. |
| docs/favicon.svg | Add docs site favicon asset. |
| docs/examples.md | Update examples guide paths and admonition style. |
| docs/CNAME | Add CNAME for GitHub Pages custom domain. |
| docs/client/transports.md | New client transports guide page. |
| docs/client/server-requests.md | New client server-initiated requests guide page. |
| docs/client/index.md | New “Clients” section index page. |
| docs/client/errors.md | New client error handling guide page. |
| docs/client/connecting.md | New client connecting guide page (includes setMaxRetries() no-op note). |
| docs/client/capabilities.md | New client capabilities guide page. |
| docs/client.md | Remove legacy monolithic client guide (replaced by section pages). |
| docs/advanced/index.md | New “Advanced” section index page. |
| docs/advanced/extensions.md | Update extensions doc link to GitHub-hosted example. |
| docs/advanced/events.md | Update events doc content/callouts. |
| docs/advanced/custom-handlers.md | New custom message handlers guide page. |
| docs/.overrides/.icons/mcp.svg | Add custom icon override asset for the docs theme. |
| adr/0001-oauth-authorization-server-out-of-scope.md | Update ADR link to new authorization doc location. |
| .phpdoc/template/components/header-title.html.twig | Point phpDocumentor header link back to site root. |
| .phpdoc/template/base.html.twig | Point phpDocumentor “Guides” menu entry back to site root. |
| .gitignore | Ignore built docs output (site/) and cache directory. |
| .github/workflows/docs.yml | Replace gh-pages branch publishing with official GitHub Pages Actions deployment. |
| .gitattributes | Exclude MkDocs/Zensical config files from export archives. |
Suppressed comments (1)
docs/run/authorization.md:96
- The Quick Start snippet instantiates
OAuthRequestMetaMiddleware()without importing it, so the example won’t run as-is when copied. Either add ause Mcp\Server\Transport\Http\Middleware\OAuthRequestMetaMiddleware;import or fully-qualify the class here.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
POC: render the guides with Zensical instead of phpDocumentor, matching the Python SDK docs.
/api/.main, PRs build without deploying;make docsandmake docs-servelocally.startinlinefor fragments).src/: fixed nine samples that could not run, ~13 wrong claims, and 16 brokenexamples/paths.Fix #232