Skip to content

chore(mcp): MCP packages 2.4.0 and Client ID Metadata Documents - #2744

Merged
mattzcarey merged 1 commit into
mainfrom
chore/mcp-conformance-spec-compliance
Oct 27, 2026
Merged

mattzcarey merged 1 commit into
mainfrom
chore/mcp-conformance-spec-compliance

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

The MCP client can now use an OAuth Client ID Metadata Document. DurableObjectOAuthClientProvider takes a clientMetadataUrl option and sends it as the client_id when the authorization server advertises client_id_metadata_document_supported, and uses dynamic client registration with servers that don't. The MCP packages move to @modelcontextprotocol/client and /server 2.4.0 and /sdk 1.32.2.

The conformance referee stays at @modelcontextprotocol/conformance@0.2.0-alpha.12. It is the newest release, and its main has no commits since then. Every lane already ran every scenario alpha.12 has for its spec version, including all 40 server scenarios at 2026-07-28 against createMcpHandler, so no lanes changed. Baseline changes:

pnpm --filter agents run test:conformance, agents unit tests (including the new client-metadata-document.test.ts) and pnpm run check ran.


Devin Review

…ance baselines

- DurableObjectOAuthClientProvider accepts clientMetadataUrl and exposes
  clientMetadataDocument; the client uses CIMD when the authorization server
  advertises it and falls back to dynamic client registration otherwise
- conformance: auth/basic-cimd removed from both client baselines; fixture
  ported from @modelcontextprotocol/server@2.4.0; sep-2322 entry cites
  modelcontextprotocol/conformance#475; legacy handler baseline renamed
- @modelcontextprotocol/client and /server 2.4.0, /sdk 1.32.2
@changeset-bot

changeset-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0347fd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
agents Patch
@cloudflare/agent-think Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Devin Review

);
}
validateClientMetadataUrl(options.clientMetadataUrl);
this.clientMetadataUrl = options.clientMetadataUrl || undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Existing registrations block metadata URL adoption

When a server has a saved dynamic registration, adding clientMetadataUrl leaves client_id set to that registration. The SDK reuses stored client information before considering CIMD support. A server that retires that registration rejects authorization instead of using the configured URL.

Learn more

The MCP client manager restores each saved client_id into the provider during restoreConnectionsFromStorage. The provider then returns that client's saved registration from clientInformation. The SDK only selects clientMetadataUrl when it has no usable saved client information. Consequently, enabling CIMD on an existing Agent keeps using its previous dynamic registration even if the authorization server advertises CIMD.

Example: An Agent registered old-client with a server last week. After deploying clientMetadataUrl: "https://app.example/client.json", it restores old-client; OAuth still sends old-client, which fails if the server has retired that registration.

Recommended fix: Decide whether to migrate saved registrations when CIMD becomes configured. Preserve valid tokens where appropriate, but invalidate or replace the saved client information and matching persisted client_id before the SDK chooses its client ID when switching to CIMD. Add a test that starts with a saved DCR registration, enables CIMD, and verifies the next OAuth flow.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread docs/agents/mcp-client.md
}
```

Serve the document at that URL. `provider.clientMetadataDocument` returns its JSON: `client_id` is the URL and `redirect_uris` holds the callback URL. The authorization server checks every redirect URI against the document, so pass a fixed `callbackPath` to `addMcpServer` rather than relying on the per-instance default.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 CIMD guide lacks a serving example

clientMetadataDocument produces JSON but installs no route. A Worker must serve it at the configured URL; otherwise authorization servers cannot fetch the document. A route example would make the integration reproducible.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@agent-think

agent-think Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

🔴 agents import sizes: 2 entry points over threshold

Entry point Exports Largest gzip change Size now
🔴 agents/mcp/do-oauth-client-provider 1 resized +74.7 KiB (+3522.15%) 76.8 KiB
🔴 agents/mcp/client 5 resized up to +13 KiB (+21.02%) 74.8 KiB
🟡 agents/mcp 14 resized up to +2 KiB (+0.5%) 392.2 KiB
🟡 agents/mcp/server 1 resized +1.6 KiB (+2.37%) 67.7 KiB
Changed exports (21)
Import Gzip change Size now
🔴 agents/mcp/do-oauth-client-provider#DurableObjectOAuthClientProvider +74.7 KiB (+3522.15%) 76.8 KiB
🔴 agents/mcp/client#normalizeServerId +13 KiB (+21.02%) 74.8 KiB
🔴 agents/mcp/client#getNamespacedData +13 KiB (+21%) 74.7 KiB
🔴 agents/mcp/client#MCP_SERVER_ID_MAX_LENGTH +13 KiB (+21.01%) 74.7 KiB
🔴 agents/mcp/client#RPC_DO_PREFIX +13 KiB (+21.01%) 74.7 KiB
🔴 agents/mcp/client#RPCClientTransport +13 KiB (+20.69%) 75.6 KiB
🟡 agents/mcp#createLegacyMcpHandler +2 KiB (+0.5%) 392.2 KiB
🟡 agents/mcp#experimental_createMcpHandler +1.9 KiB (+0.5%) 392.3 KiB
🟡 agents/mcp#RPCClientTransport +1.9 KiB (+0.54%) 358 KiB
🟡 agents/mcp#normalizeServerId +1.9 KiB (+0.54%) 358 KiB
🟡 agents/mcp#RPC_DO_PREFIX +1.9 KiB (+0.53%) 358 KiB
🟡 agents/mcp#ElicitRequestSchema +1.9 KiB (+0.53%) 358 KiB
🟡 agents/mcp#DurableObjectEventStore +1.9 KiB (+0.53%) 358 KiB
🟡 agents/mcp#McpAgent +1.9 KiB (+0.53%) 358 KiB
🟡 agents/mcp#MCP_SERVER_ID_MAX_LENGTH +1.9 KiB (+0.53%) 358 KiB
🟡 agents/mcp#RPCServerTransport +1.9 KiB (+0.53%) 358 KiB
🟡 agents/mcp#getMcpAuthContext +1.9 KiB (+0.53%) 358 KiB
🟡 agents/mcp#StreamableHTTPEdgeClientTransport +1.9 KiB (+0.53%) 358.1 KiB
🟡 agents/mcp#SSEEdgeClientTransport +1.9 KiB (+0.53%) 358.1 KiB
🟡 agents/mcp#WorkerTransport +1.9 KiB (+0.52%) 361.7 KiB
🟡 agents/mcp/server#getMcpAuthContext +1.6 KiB (+2.37%) 67.7 KiB
How this works

Each runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement.

Compared f049ee11 → d0347fd1 · workflow run · reported by agent-think[bot]

@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@2744

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@2744

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@2744

hono-agents

npm i https://pkg.pr.new/hono-agents@2744

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@2744

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@2744

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@2744

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@2744

commit: d0347fd

@mattzcarey
mattzcarey merged commit a2d371e into main Oct 27, 2026
19 checks passed
@mattzcarey
mattzcarey deleted the chore/mcp-conformance-spec-compliance branch October 27, 2026 13:25
@github-actions github-actions Bot mentioned this pull request Oct 27, 2026
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