Skip to content

Conversation

@betegon
Copy link
Member

@betegon betegon commented Dec 16, 2025

With this PR we get this attributes from the initialization request and response into the initialize span:

  • mcp.client.name, mcp.client.version, mcp.client.title (from request)
  • mcp.server.name, mcp.server.version, mcp.server.title (from response)
  • mcp.protocol.version (from both request and response)

Changes:

  • Extract client info and protocol version from the initialize request and set them on the span after creation in transport.ts
  • Extract server info and protocol version from the initialize response in completeSpanWithResults and add them to the span
  • Add two new helper functions buildClientAttributesFromInfo and buildServerAttributesFromInfo to build attributes directly from PartyInfo objects

Closes #18532 (added automatically)

@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.81 kB - -
@sentry/browser - with treeshaking flags 23.3 kB - -
@sentry/browser (incl. Tracing) 41.58 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.18 kB - -
@sentry/browser (incl. Tracing, Replay) 80.16 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.9 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.85 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 97.08 kB - -
@sentry/browser (incl. Feedback) 41.52 kB - -
@sentry/browser (incl. sendFeedback) 29.49 kB - -
@sentry/browser (incl. FeedbackAsync) 34.48 kB - -
@sentry/react 26.52 kB - -
@sentry/react (incl. Tracing) 43.78 kB - -
@sentry/vue 29.27 kB - -
@sentry/vue (incl. Tracing) 43.39 kB - -
@sentry/svelte 24.82 kB - -
CDN Bundle 27.23 kB - -
CDN Bundle (incl. Tracing) 42.22 kB - -
CDN Bundle (incl. Tracing, Replay) 78.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 84.39 kB - -
CDN Bundle - uncompressed 80.02 kB - -
CDN Bundle (incl. Tracing) - uncompressed 125.37 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 241.91 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.67 kB - -
@sentry/nextjs (client) 46 kB - -
@sentry/sveltekit (client) 41.95 kB - -
@sentry/node-core 51.6 kB - -
@sentry/node 161.48 kB -0.01% -1 B 🔽
@sentry/node - without tracing 93.03 kB +0.01% +1 B 🔺
@sentry/aws-serverless 108.54 kB - -

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,837 - 9,235 -4%
GET With Sentry 1,764 20% 1,792 -2%
GET With Sentry (error only) 6,137 69% 6,097 +1%
POST Baseline 1,204 - 1,185 +2%
POST With Sentry 590 49% 608 -3%
POST With Sentry (error only) 1,069 89% 1,067 +0%
MYSQL Baseline 3,295 - 3,392 -3%
MYSQL With Sentry 491 15% 524 -6%
MYSQL With Sentry (error only) 2,701 82% 2,693 +0%

View base workflow run

@betegon betegon requested a review from JPeer264 December 16, 2025 20:05
Copy link
Member

@JPeer264 JPeer264 left a comment

Choose a reason for hiding this comment

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

LGTM

@betegon betegon merged commit 3d58496 into develop Dec 17, 2025
401 of 403 checks passed
@betegon betegon deleted the bete/feat/mcp-capture-initialize-attributes branch December 17, 2025 13:14
dcramer pushed a commit to getsentry/sentry-mcp that referenced this pull request Dec 18, 2025
I shipped [a
fix](getsentry/sentry-javascript#18531) to
capture client name on stateless servers for `initialize` spans and it
was released today.

[Sentry SDK
changelog](https://github.com/getsentry/sentry-javascript/releases/tag/10.32.0).
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.

feat(core): Capture initialize attributes on MCP servers

3 participants