Title: wrapMcpServerWithSentry: tool-call spans missing with stateless StreamableHTTPServerTransport · Issue #20290 · getsentry/sentry-javascript · GitHub
Open Graph Title: wrapMcpServerWithSentry: tool-call spans missing with stateless StreamableHTTPServerTransport · Issue #20290 · getsentry/sentry-javascript
X Title: wrapMcpServerWithSentry: tool-call spans missing with stateless StreamableHTTPServerTransport · Issue #20290 · getsentry/sentry-javascript
Description: AI disclaimer: used Claude Code to generate as much useful context as possible. Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentati...
Open Graph Description: AI disclaimer: used Claude Code to generate as much useful context as possible. Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascrip...
X Description: AI disclaimer: used Claude Code to generate as much useful context as possible. Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascrip...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/20290
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"wrapMcpServerWithSentry: tool-call spans missing with stateless StreamableHTTPServerTransport","articleBody":"AI disclaimer: used Claude Code to generate as much useful context as possible.\n\n### Is there an existing issue for this?\n\n- [X] I have checked for existing issues [https://github.com/getsentry/sentry-javascript/issues](\u003chttps://github.com/getsentry/sentry-javascript/issues>)\n- [X] I have reviewed the documentation [https://docs.sentry.io/](\u003chttps://docs.sentry.io/>)\n- [X] I am using the latest SDK release [https://github.com/getsentry/sentry-javascript/releases](\u003chttps://github.com/getsentry/sentry-javascript/releases>)\n\n### How do you use Sentry?\n\nSentry Saas ([sentry.io](\u003chttp://sentry.io>))\n\n### Which SDK are you using?\n\n@sentry/node - express\n\n### SDK Version\n\n10.48.0\n\n### Framework Version\n\n@modelcontextprotocol/sdk 2.x (Node `StreamableHTTPServerTransport`)\n\n### Link to Sentry event\n\n*N/A — no spans are emitted*\n\n### Reproduction Example/SDK Setup\n\n```ts\nSentry.init({ dsn: process.env.DSN, tracesSampleRate: 1.0 });\n\napp.all('/mcp', auth, async (req, res) => {\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: undefined, // stateless\n enableJsonResponse: true,\n });\n const server = Sentry.wrapMcpServerWithSentry(\n new McpServer({ name: 'x', version: '1.0.0' }),\n { recordInputs: true, recordOutputs: true },\n );\n registerTools(server);\n await server.connect(transport);\n await transport.handleRequest(req, res, req.body);\n});\n```\n\n### Steps to Reproduce\n\n1. Use `@sentry/node` ≥ 10.39.0 (post-[#19172](\u003chttps://github.com/getsentry/sentry-javascript/issues/19172>)).\n2. Construct a per-request `McpServer` + Node `StreamableHTTPServerTransport` with `sessionIdGenerator: undefined` (stateless mode, per the official MCP SDK `simpleStatelessStreamableHttp.ts` example).\n3. Wrap with `wrapMcpServerWithSentry`, `server.connect(transport)`, `transport.handleRequest(...)`.\n4. Call any tool from a client.\n\n### Expected Result\n\nAn `mcp.server` span with `mcp.tool.name` attribute for each `tools/call`, visible on the MCP insights dashboard.\n\n### Actual Result\n\nZero `mcp.server` spans emitted. `http.server` transactions for `POST /mcp` are recorded fine, but tool-call correlation never resolves, so spans are created on `onmessage` and never `.end()`-ed on `send`.\n\n### Additional Context\n\nThis is the stateless follow-up to [JS-1663](https://linear.app/getsentry/issue/JS-1663/mcp-server-aint-recording-events-reqres-transport-issue) / PR [#19172](\u003chttps://github.com/getsentry/sentry-javascript/issues/19172>), which the reporter flagged [in this comment](\u003chttps://github.com/getsentry/sentry-javascript/issues/19233#issuecomment-3909694943>) and a maintainer acknowledged [here](\u003chttps://github.com/getsentry/sentry-javascript/issues/19233#issuecomment-3916610235>) (\"about the stateless issue, we'll get that fixed, it slipped by\").\n\nI'm using stateless because I am deploying to a scale-to-zero [Fly.io](\u003chttp://Fly.io>) server.\n\n### Priority\n\nReact with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.","author":{"url":"https://github.com/maxproske","@type":"Person","name":"maxproske"},"datePublished":"2026-04-14T18:25:51Z","url":"https://github.com/getsentry/sentry-javascript/issues/20290"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:16eba029-5f80-f8d4-8d72-85b1523398bf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C812:3B5D6F:11B0B3:18B67A:6B046EE2 |
| html-safe-nonce | 427e0c8fb9a65892a15c3309e57ec9259f38c8ccb936403eb72638f95f1fd85d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODEyOjNCNUQ2RjoxMUIwQjM6MThCNjdBOjZCMDQ2RUUyIiwidmlzaXRvcl9pZCI6IjU4MTE4ODkzMTY1NTI3OTc5MjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3b59b87a9fbe707184732e87588fc627aa30945af71690003a4137ecb081bccf |
| hovercard-subject-tag | issue:4263998475 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/20290/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3572a633d57cc41e54f4b322b5ac8e91ae4448d5db1d166686c37e9060486774/getsentry/sentry-javascript/issues/20290 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3572a633d57cc41e54f4b322b5ac8e91ae4448d5db1d166686c37e9060486774/getsentry/sentry-javascript/issues/20290 |
| og:image:alt | AI disclaimer: used Claude Code to generate as much useful context as possible. Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascrip... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maxproske |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cfb5f24c6e01d85f70804652a5107e5cac03a161 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width