Skip to content

feat(core): capture MCP OAuth client names per request - #24508

Open
betegon wants to merge 3 commits into
developfrom
feat/mcp-oauth-client-name
Open

betegon wants to merge 3 commits into
developfrom
feat/mcp-oauth-client-name

Conversation

@betegon

@betegon betegon commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

OAuth registration can identify a different application from MCP clientInfo, but transport AuthInfo has no standard client name. Add an opt-in getOAuthClientName resolver that records the registered name as mcp.auth.client.name, independently of mcp.client.name.

For example, when a registered application named Example Desktop connects through a client identifying as example-connector, before the span contains only mcp.client.name = "example-connector". After configuring the resolver, it also contains mcp.auth.client.name = "Example Desktop".

Resolve the name once per incoming request, including discovery and unsupported methods. The callback receives clientId and application-defined extra metadata when available and may read request-scoped authentication context. Only the returned name is recorded; resolver failures leave dispatch intact. Preserve the wrapper's existing first-explicit-value option behavior. Real HTTP coverage exercises both MCP SDK majors in ESM/CJS, concurrent requests, and missing identities.

#25059 is merged; this branch is rebased on develop and imports MCP_AUTH_CLIENT_NAME from published @sentry/conventions@0.27.0. The conventions publication blocker is resolved. This identity distinction follows MCP client registration. Network metadata (#24506) and canonical attributes (#25060) remain separate changes.

Validated the 48-project SDK build, formatting and lint, 151 MCP unit tests, and ten real MCP SDK v1/v2 integration tests after rebase.

@betegon betegon self-assigned this Sep 18, 2026
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: a7ce5b9 (PR test merge using develop at 9927b7c)

Against: 9927b7c (develop) · base run #63346

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 29.98 kB - -
@sentry/browser - with treeshaking flags 28.12 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.02 kB - -
@sentry/browser (incl. Tracing) 52.16 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.16 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.11 kB - -
@sentry/browser (incl. Tracing, Replay) 91.95 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.84 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.69 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.62 kB - -
@sentry/browser (incl. Feedback) 47.5 kB - -
@sentry/browser (incl. sendFeedback) 35.04 kB - -
@sentry/browser (incl. FeedbackAsync) 40.15 kB - -
@sentry/browser (incl. Metrics) 31 kB - -
@sentry/browser (incl. Logs) 31.27 kB - -
@sentry/browser (incl. Metrics & Logs) 31.93 kB - -
@sentry/react 31.8 kB - -
@sentry/react (incl. Tracing) 54.49 kB - -
@sentry/vue 38.13 kB - -
@sentry/vue (incl. Tracing) 55.1 kB - -
@sentry/svelte 30 kB - -
@sentry/remix (Remix 3 client bundle) 57.19 kB - -
CDN Bundle 31.74 kB - -
CDN Bundle (incl. Tracing) 52.7 kB - -
CDN Bundle (incl. Logs, Metrics) 33.94 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.65 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.92 kB - -
CDN Bundle (incl. Tracing, Replay) 90.4 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.32 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.54 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.49 kB - -
CDN Bundle - uncompressed 93.49 kB - -
CDN Bundle (incl. Tracing) - uncompressed 156.34 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.04 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 162.31 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 230.25 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 276.69 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 282.64 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 290.39 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 296.33 kB - -
@sentry/nextjs (client) 57.38 kB - -
@sentry/sveltekit (client) 52.54 kB - -
@sentry/core/server 41.98 kB +0.27% +109 B 🔺
@sentry/core/browser 13.81 kB - -
@sentry/node 153.23 kB +0.07% +105 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.58 kB - -
@sentry/node - without tracing 94.72 kB +0.01% +1 B 🔺
@sentry/node - without channel injection 133.86 kB +0.08% +99 B 🔺
@sentry/aws-serverless 102.88 kB - -
@sentry/cloudflare (withSentry) - minified 193.71 kB - -
@sentry/cloudflare (withSentry) 481.82 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 214.38 kB - -

View base workflow run

@betegon
betegon marked this pull request as ready for review October 5, 2026 11:34
@betegon
betegon requested a review from a team as a code owner October 5, 2026 11:34
@betegon
betegon requested review from andreiborza and mydea and removed request for a team October 5, 2026 11:34
@betegon
betegon marked this pull request as draft October 5, 2026 11:35
@betegon
betegon force-pushed the feat/mcp-oauth-client-name branch from 9b2892f to 914fd50 Compare October 5, 2026 14:50
@betegon
betegon force-pushed the feat/mcp-oauth-client-name branch from 914fd50 to ead1950 Compare October 13, 2026 08:52
betegon added a commit that referenced this pull request Oct 13, 2026
Use `@sentry/conventions/attributes` for registered MCP keys, including
all singleton and indexed result fields. The branch now uses published
conventions `0.27.0` from `develop`, so both local result prefixes can
be removed.

Before, the SDK constructed `mcp.tool.result.0.content` from a local
prefix. After, `MCP_TOOL_RESULT_KEY_CONTENT.replace('<key>', '0')`
produces that same key. Singleton keys, values, original array indexes,
and input/output capture behavior remain unchanged. Deprecated
tool-result fields stay emitted for compatibility; this change adds no
aliases or backfill.

This is the mechanical base for network metadata (#24506), OAuth
attribution (#24508), and canonical OpenTelemetry attributes (#25060).
The latter separately adds complete serialized results in
`gen_ai.tool.call.result`.
@betegon
betegon force-pushed the feat/mcp-oauth-client-name branch from ead1950 to f965bba Compare October 14, 2026 08:53
@betegon
betegon marked this pull request as ready for review October 21, 2026 15:09
@betegon
betegon requested a review from JPeer264 October 21, 2026 15:16

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@github-actions

Copy link
Copy Markdown
Contributor

👋 @mydea, @andreiborza — Please review this PR when you get a chance!

@betegon
betegon requested review from a team as code owners October 23, 2026 12:04
@betegon
betegon requested review from logaretm and s1gr1d and removed request for a team October 23, 2026 12:04
@cursor

cursor Bot commented Oct 23, 2026

Copy link
Copy Markdown

This PR is too large for Bugbot to review. It changes 67,411 lines and 3,660,613 characters. Split the change into smaller pull requests to get a review.

@betegon

betegon commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

bugbot run verbose=true

@cursor

cursor Bot commented Oct 23, 2026

Copy link
Copy Markdown

Bugbot request id: eea33c32-93f0-44cf-b25d-0cd32c7cc2f6

@cursor

cursor Bot commented Oct 23, 2026

Copy link
Copy Markdown

Bugbot rules debug

Bugbot rules included in this run
Rule Type Size Status
PR Review Guidelines for Cursor Bot (project-70ead460d2b3) project (BUGBOT.md) 15,678 chars included

https://cursor.com/docs/bugbot#team-rules

Bugbot request id: eea33c32-93f0-44cf-b25d-0cd32c7cc2f6

@betegon

betegon commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

bugbot run verbose=true

@cursor

cursor Bot commented Oct 23, 2026

Copy link
Copy Markdown

Bugbot request id: f1ecc5b7-44f7-4fb2-935c-3b703c247d9a

@cursor

cursor Bot commented Oct 23, 2026

Copy link
Copy Markdown

Bugbot rules debug

Bugbot rules included in this run
Rule Type Size Status
PR Review Guidelines for Cursor Bot (project-70ead460d2b3) project (BUGBOT.md) 15,678 chars included

https://cursor.com/docs/bugbot#team-rules

Bugbot request id: f1ecc5b7-44f7-4fb2-935c-3b703c247d9a

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0cb6dd6. Configure here.

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