Skip to content

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

Draft
betegon wants to merge 1 commit into
developfrom
feat/mcp-oauth-client-name
Draft

betegon wants to merge 1 commit 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 📦

Path Size % Change Change
@sentry/browser 29.83 kB - -
@sentry/browser - with treeshaking flags 27.96 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.87 kB - -
@sentry/browser (incl. Tracing) 52.02 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.02 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.96 kB - -
@sentry/browser (incl. Tracing, Replay) 91.75 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.62 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.47 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.43 kB - -
@sentry/browser (incl. Feedback) 47.35 kB - -
@sentry/browser (incl. sendFeedback) 34.89 kB - -
@sentry/browser (incl. FeedbackAsync) 40 kB - -
@sentry/browser (incl. Metrics) 30.85 kB - -
@sentry/browser (incl. Logs) 31.13 kB - -
@sentry/browser (incl. Metrics & Logs) 31.78 kB - -
@sentry/react 31.64 kB - -
@sentry/react (incl. Tracing) 54.34 kB - -
@sentry/vue 37.98 kB - -
@sentry/vue (incl. Tracing) 54.95 kB - -
@sentry/svelte 29.86 kB - -
@sentry/remix (Remix 3 client bundle) 57.02 kB - -
CDN Bundle 31.56 kB - -
CDN Bundle (incl. Tracing) 52.52 kB - -
CDN Bundle (incl. Logs, Metrics) 33.77 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.46 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.7 kB - -
CDN Bundle (incl. Tracing, Replay) 90.19 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.11 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.34 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.28 kB - -
CDN Bundle - uncompressed 92.98 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.83 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.52 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.79 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.56 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 276 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 281.94 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.7 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.63 kB - -
@sentry/nextjs (client) 56.75 kB - -
@sentry/sveltekit (client) 52.41 kB - -
@sentry/core/server 41.22 kB +0.25% +99 B 🔺
@sentry/core/browser 13.81 kB - -
@sentry/node 152.09 kB +0.08% +115 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.78 kB - -
@sentry/node - without tracing 94.54 kB +0.01% +3 B 🔺
@sentry/node - without channel injection 130.29 kB +0.09% +117 B 🔺
@sentry/aws-serverless 102.69 kB +0.01% +5 B 🔺
@sentry/cloudflare (withSentry) - minified 210.38 kB - -
@sentry/cloudflare (withSentry) 521.61 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 228.06 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

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