Files
wehub-resource-sync 49b9bb6724
Deploy Docs / deploy-docs (push) Failing after 1s
Conformance Tests / client-conformance (push) Failing after 3s
Conformance Tests / server-conformance (push) Failing after 1s
GitHub Actions Security Analysis / zizmor (push) Failing after 1s
CI / checks (push) Failing after 59m20s
CI / all-green (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 12:10:27 +08:00
..

apps

MCP Apps: a tool carries a _meta.ui.resourceUri reference to a ui:// resource that the host renders as an interactive surface. The server opts in via the Apps extension (io.modelcontextprotocol/ui); the client negotiates it by advertising the text/html;profile=mcp-app MIME type.

Run it

# stdio (default — the client spawns the server as a subprocess)
uv run python -m stories.apps.client

# HTTP — the client self-hosts the server on a free port, runs, then tears it down
uv run python -m stories.apps.client --http

What to look at

  • server.py MCPServer("apps-example", extensions=[apps]) — the extension advertises io.modelcontextprotocol/ui under ServerCapabilities.extensions and contributes the UI-bound tool and its ui:// resource. MCPServer itself never learns about "ui"; it applies a closed set of contributions.
  • server.py @apps.tool(resource_uri=...) — stamps _meta.ui.resourceUri on the tool; add_html_resource registers the matching ui:// resource at text/html;profile=mcp-app.
  • server.py client_supports_apps(ctx) — SEP-2133 graceful degradation: a client that did not negotiate Apps gets a text-only result.
  • client.py Client(target, extensions=[advertise(...)]) — the client advertises Apps support so the server returns the UI-enabled result, then reads the tool's _meta.ui.resourceUri and fetches that resource.

Spec

MCP Apps — extensions · SEP-2133 — extensions capability

See also

custom_methods/ (registering a non-spec method without an extension).