1b74b06753
Cut comment and docstring volume roughly in half across src, tests, examples, and docs_src: removed comments that restate the adjacent code, leftover development narration, section banners, and self-evident Args/Returns blocks, and compressed the remaining docstrings to a Google-style summary line plus only the detail that earns its place. Kept (and tightened) the load-bearing content: Raises sections, deprecation and version-availability notes, spec/RFC/issue references, why-comments for non-obvious decisions, and all coverage pragmas. The generated mcp_types.v* wire modules are untouched.
extensions
Writing your own extension (SEP-2133): one identifier bundles a settings entry
under ServerCapabilities.extensions, a contributed tool, and a vendor request
method gated on the client declaring the extension back.
Run it
# stdio (default — the client spawns the server as a subprocess)
uv run python -m stories.extensions.client
# HTTP — the client self-hosts the server on a free port, runs, then tears it down
uv run python -m stories.extensions.client --http
What to look at
server.pyclass Catalog(Extension)— the whole extension:settings()becomes the advertised capability entry,tools()contributes a regular tool,methods()registers a vendor verb. The extension never holds the server; it declares contributions andMCPServer(extensions=[...])consumes them.server.pyrequire_client_extension(ctx, EXTENSION_ID)— the vendor method rejects clients that did not declare the extension with-32021(missing required client capability) and a machine-readablerequiredCapabilitiespayload.client.pyClient(target, extensions={EXTENSION_ID: {}})— the client-side half of the negotiation; on 2026-07-28 it travels in the per-request_metaenvelope.client.pyclient.session.send_request(...)— vendor methods have noClient-level helper; the session escape hatch sends them.
Spec
SEP-2133 — extensions capability
· Capabilities — _meta key grammar
See also
apps/ (the built-in MCP Apps extension) · custom_methods/ (the same verb
registered on the lowlevel Server by hand, without an extension).