Title: MCP server aint recording events - req/res transport issue · Issue #19233 · getsentry/sentry-javascript · GitHub
Open Graph Title: MCP server aint recording events - req/res transport issue · Issue #19233 · getsentry/sentry-javascript
X Title: MCP server aint recording events - req/res transport issue · Issue #19233 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/19233
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MCP server aint recording events - req/res transport issue","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/node\n\n### SDK Version\n\n10.34.0\n\n### Framework Version\n\n_No response_\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\nHello, I've been debugging this issue for a few days I think I understand why it happens, here is what I found.\n\nThe sentryMcpWrapper is storing the sessions in a weakmap from the transport to the session data.\n\nThe issue is, that the transport received in the `onMessage` method can be a different level of abstraction from the one recived in the `send` method\n\nHere you can see images of both events for the same mcp call: \n\n`onMessage`: \n\u003cimg width=\"1515\" height=\"643\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/c44c6ce6-bd24-436e-b557-4bba9647b5a5\" />\n\n`onSend`: \n\u003cimg width=\"1598\" height=\"820\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/60d87ae7-a776-4bc7-98c2-1e01b413df0d\" />\n\nAs you can see in the images above, this is the same request, but on response (send) the sdk exposes a different transport (a warpper that holds the original transport) \n\nThis happens because the `send` method is being called from a StreamableHTTPServerTransport which overrides the method, but it does not override the `onMessage` method so that one is being called from the super class which means the code is getting different `this` values in each invocation.\n\nBecause the weakmap uses the class of the transport itself as the key for the entire transaction this causes the event to not be found and not send to sentry.\n \nA solution might be trying to use the prototype class or just forgo using classes at all there and trying to use the session id generated by the transport but I dont know all the details and I'm sure there was a good reason for this approach.\n\n### Steps to Reproduce\nAs far as I see this happens always if you create your own `StreamableHTTPServerTransport` and use `mcpServer.connect(transport)`\n\n### Expected Result\n\nEvents to be sent to sentry\n\n### Actual Result\n\nEvents are not being sent\n\n### Additional Context\n\n_No response_\n\n### Priority\n\n\u003csub>React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.\u003c/sub>","author":{"url":"https://github.com/gotenxds","@type":"Person","name":"gotenxds"},"datePublished":"2026-02-02T07:57:40Z","url":"https://github.com/getsentry/sentry-javascript/issues/19233"}
| 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:5d2e75dc-fee4-4573-0c46-444399b9ce1d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C6CE:1CF439:7CD1DC:A3FC51:6B04CA9D |
| html-safe-nonce | 4caa65b08553b3e725c83c2e2dce26d3da8cd708a1383c32aac52d62564b8dad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNkNFOjFDRjQzOTo3Q0QxREM6QTNGQzUxOjZCMDRDQTlEIiwidmlzaXRvcl9pZCI6IjI0MzU4ODQzMDQyMjA2MDUwODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7d7035c8c97dcc435fe5f610a3e871fc371ec09dc5a6eb7062bab43455e756e6 |
| hovercard-subject-tag | issue:3915523915 |
| 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/19233/issue_layout |
| twitter:image | https://opengraph.githubassets.com/095e18e193c27ca2baa043465396664e5ef38f8a5ab40907771e26723c2982f2/getsentry/sentry-javascript/issues/19233 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/095e18e193c27ca2baa043465396664e5ef38f8a5ab40907771e26723c2982f2/getsentry/sentry-javascript/issues/19233 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gotenxds |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27ed421e5c2dac040a37529b5b9191edcc4a3de70521471e81fb4b4d9dc2aa7d |
| 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 | 63dc19014c621c67306d7899c04c78dcd0d95803 |
| 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