Skip to content

docs(spec): align examples with the normative text (ui/initialize, teardown, CSP default) - #822

Open
shreesh1802 wants to merge 1 commit into
modelcontextprotocol:mainfrom
shreesh1802:docs/align-spec-examples
Open

shreesh1802 wants to merge 1 commit into
modelcontextprotocol:mainfrom
shreesh1802:docs/align-spec-examples

Conversation

@shreesh1802

Copy link
Copy Markdown

While building an MCP App server (Python) I checked the draft spec's examples against its normative text and the SDK types in src/spec.types.ts, and found three places that disagree. This PR changes documentation only (one file, 5 lines).

  1. Transport snippet sent method "initialize" with capabilities and clientInfo. The text ("MUST include its capabilities in the appCapabilities field") and McpUiInitializeRequest specify "ui/initialize" with appInfo, appCapabilities and protocolVersion. Following the snippet leaves out the required appInfo; I did exactly that in my first implementation.
  2. ui/resource-teardown is described as "Host notifies View", but the example has an id and a response, and McpUiResourceTeardownRequest is a request type. Reworded as a request.
  3. CSP construction example produces connect-src 'self' when no CSP is declared, but the "Restrictive Default" section requires connect-src 'none'. The example now falls back to 'none', as it already does for frame-src.

Two notes for reviewers:

  • The same text appears in specification/2026-01-26/apps.mdx (the stable spec). I left that file alone and can port the changes if you want.
  • I did not change the teardown example's params: { reason: string }, because McpUiResourceTeardownRequest has params: {}. Which one is intended?

Found while building https://github.com/shreesh1802/Sahayak for the Amazon Developer Hackathon. I prepared this change with the help of Claude Code and checked each point against the spec file and src/spec.types.ts.

…ardown, CSP default)

- Transport snippet: send "ui/initialize" with appInfo and appCapabilities, as the text
  ("MUST include its capabilities in the appCapabilities field") and McpUiInitializeRequest
  in src/spec.types.ts specify, instead of "initialize" with capabilities and clientInfo.
- ui/resource-teardown: describe it as a request (it has an id and a response), not a
  notification.
- CSP construction example: fall back to connect-src 'none' when no CSP is declared, matching
  the "Restrictive Default" section, as the example already does for frame-src.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant