René's URL Explorer Experiment


Title: SentryGlobalFilter: handle the mcp host type of `@nestjs/mcp` · Issue #26693 · getsentry/sentry-javascript · GitHub

Open Graph Title: SentryGlobalFilter: handle the mcp host type of `@nestjs/mcp` · Issue #26693 · getsentry/sentry-javascript

X Title: SentryGlobalFilter: handle the mcp host type of `@nestjs/mcp` · Issue #26693 · getsentry/sentry-javascript

Description: Problem Statement @nestjs/mcp is the official NestJS module for Model Context Protocol servers. It runs every tool method through Nest's enhancers with the execution context type 'mcp', and its docs say that global filters run on those c...

Open Graph Description: Problem Statement @nestjs/mcp is the official NestJS module for Model Context Protocol servers. It runs every tool method through Nest's enhancers with the execution context type 'mcp', and its doc...

X Description: Problem Statement @nestjs/mcp is the official NestJS module for Model Context Protocol servers. It runs every tool method through Nest's enhancers with the execution context type 'mcp',...

Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/26693

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SentryGlobalFilter: handle the mcp host type of `@nestjs/mcp`","articleBody":"### Problem Statement\n\n`@nestjs/mcp` is the official NestJS module for Model Context Protocol servers. It runs every tool method through Nest's enhancers with the execution context type `'mcp'`, and its docs say that global filters run on those calls too (https://docs.nestjs.com/mcp/primitives):\n\n> Global guards, interceptors and filters (`app.useGlobalGuards()`, `APP_GUARD`) run on MCP calls too, as they do on GraphQL resolvers, and on the HTTP request that carries them. An enhancer written for HTTP routes that reads `context.switchToHttp().getRequest()` should check `context.getType() === 'http'` first.\n\n`SentryGlobalFilter.catch` has branches for `graphql`, `rpc` and `ws`. Every other host type falls through to the HTTP path: it captures the exception and calls `super.catch(exception, host)`, and `BaseExceptionFilter` then replies through the HTTP adapter.\n\nMeasured with `{ provide: APP_FILTER, useClass: SentryGlobalFilter }`, the Fastify adapter and a tool that throws an `Error` (`@sentry/nestjs` 11.10.0, `@nestjs/core` 12.3.3, `@nestjs/platform-fastify` 12.3.3, `@nestjs/mcp` 0.0.3, Node 24; the same code is on `develop`, `packages/nestjs/src/setup.ts`):\n\n- The event is captured once, with the mechanism `auto.http.nestjs.global_filter`.\n- `BaseExceptionFilter` hands the call's context object to the HTTP adapter: `isHeadersSent` returns `undefined`, and `reply` throws `TypeError: this.raw.getHeader is not a function`.\n- That `TypeError` leaves the filter, and it is what `@nestjs/mcp` answers with `Internal server error`. The client sees the right text, because `@nestjs/mcp` gives that answer to any error that is not an `HttpException`.\n- Nest's own handler never logs the original error under `ExceptionsHandler`.\n\nSo nothing is lost today, but the result rests on the adapter failing on an object that is no response.\n\n### Solution Brainstorm\n\nA branch for `mcp` that does what the `graphql` branch does: rethrow an `HttpException` untouched, otherwise capture with a mechanism of its own (`auto.mcp.nestjs.global_filter`, say) and rethrow, without touching the HTTP adapter. `@nestjs/mcp` turns the rethrown error into the tool error.\n\n### Additional Context\n\nWorkaround in use, registered in place of `SentryGlobalFilter`. A filter that returns nothing counts as not handled on an MCP call (`ExternalExceptionsHandler` in `@nestjs/core`): Nest logs the error and rethrows it.\n\n```ts\n@Catch()\nexport class SentryMcpFilter extends SentryGlobalFilter {\n  public override catch(exception: unknown, host: ArgumentsHost): void {\n    if (host.getType\u003cstring>() === \"mcp\") {\n      captureException(exception, { mechanism: { handled: false } });\n      return;\n    }\n\n    super.catch(exception, host);\n  }\n}\n```\n\nWith it the adapter is not called, the error is captured once, logged once under `ExceptionsHandler`, and answered with `Internal server error`.\n\nReproduction:\n\n```ts\n@Injectable()\nclass ProbeTools {\n  @Tool({ name: \"throws_error\", description: \"Throws\" })\n  throwsError(): never {\n    throw new Error(\"boom\");\n  }\n}\n\n@Module({\n  imports: [\n    SentryModule.forRoot(),\n    McpModule.forRoot({ name: \"probe\", version: \"0.0.0\" }),\n  ],\n  providers: [\n    { provide: APP_FILTER, useClass: SentryGlobalFilter },\n    ProbeTools,\n  ],\n})\nclass AppModule {}\n\nconst app = await NestFactory.create(AppModule, new FastifyAdapter());\nconst client = await connectMcpClient(app); // from '@nestjs/mcp/testing'\nawait client.callTool({ name: \"throws_error\" });\n```\n\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/reichhartd","@type":"Person","name":"reichhartd"},"datePublished":"2026-11-20T10:12:42Z","url":"https://github.com/getsentry/sentry-javascript/issues/26693"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:1c977f2f-0c88-445c-c0d8-c3ddf234a82f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB480:2F8368:3C57BB:518205:6B043FB1
html-safe-nonce300394ea6b2faa7ddc5be46acb22dc2c250fdd209cbb0419301a656a6e2d317d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDgwOjJGODM2ODozQzU3QkI6NTE4MjA1OjZCMDQzRkIxIiwidmlzaXRvcl9pZCI6IjQyNjE5MjM5OTI2NzM0NjgzMzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacfd6000fce0a48c8d2961b49e9a5d366a165b0b8c6d2c72f1eb8512546678c7db
hovercard-subject-tagissue:6509351538
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/26693/issue_layout
twitter:imagehttps://opengraph.githubassets.com/599faaf01b1b420f99ad4968c138626f113f7c6f957786079938cabb5a5f4cfd/getsentry/sentry-javascript/issues/26693
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/599faaf01b1b420f99ad4968c138626f113f7c6f957786079938cabb5a5f4cfd/getsentry/sentry-javascript/issues/26693
og:image:altProblem Statement @nestjs/mcp is the official NestJS module for Model Context Protocol servers. It runs every tool method through Nest's enhancers with the execution context type 'mcp', and its doc...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamereichhartd
hostnamegithub.com
expected-hostnamegithub.com
None9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3328572
octolytics-dimension-repository_nwogetsentry/sentry-javascript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3328572
octolytics-dimension-repository_network_root_nwogetsentry/sentry-javascript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release06dc448a76fe4751ac1db26524aefa3aa3e889a8
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/issues/26693#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F26693
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F26693
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-javascript
Reloadhttps://github.com/getsentry/sentry-javascript/issues/26693
Reloadhttps://github.com/getsentry/sentry-javascript/issues/26693
Reloadhttps://github.com/getsentry/sentry-javascript/issues/26693
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues340 (340)https://github.com/getsentry/sentry-javascript/issues
Pull requests54 (54)https://github.com/getsentry/sentry-javascript/pulls
Discussionshttps://github.com/getsentry/sentry-javascript/discussions
Actionshttps://github.com/getsentry/sentry-javascript/actions
Security and quality7 (7)https://github.com/getsentry/sentry-javascript/security
Insightshttps://github.com/getsentry/sentry-javascript/insights
https://github.com/getsentry/sentry-javascript
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/26693
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/26693
#26695https://github.com/getsentry/sentry-javascript/pull/26695
SentryGlobalFilter: handle the mcp host type of @nestjs/mcphttps://github.com/getsentry/sentry-javascript/issues/26693#top
#26695https://github.com/getsentry/sentry-javascript/pull/26695
Featurehttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Feature%22
Nest.jshttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Nest.js%22
https://github.com/reichhartd
reichhartdhttps://github.com/reichhartd
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#issue-6509351538
https://docs.nestjs.com/mcp/primitiveshttps://docs.nestjs.com/mcp/primitives
reichhartdhttps://github.com/reichhartd
Featurehttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Feature%22
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#event-36756668294
getsantryhttps://github.com/apps/getsantry
Waiting for: Product Ownerhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Waiting%20for%3A%20Product%20Owner%22
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#event-36756670324
https://github.com/apps/linear-code
linear-codehttps://github.com/apps/linear-code
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#issuecomment-7036899258
Linear Codehttps://linear.app
JS-4135https://linear.app/getsentry/issue/JS-4135
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#event-36756674077
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693
linear-codehttps://github.com/apps/linear-code
Nest.jshttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Nest.js%22
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#event-36756713028
https://github.com/andreiborza
andreiborzahttps://github.com/andreiborza
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#issuecomment-7037099023
@reichhartdhttps://github.com/reichhartd
getsantryhttps://github.com/apps/getsantry
Waiting for: Product Ownerhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Waiting%20for%3A%20Product%20Owner%22
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#event-36757515722
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693
andreiborzahttps://github.com/andreiborza
completedhttps://github.com/getsentry/sentry-javascript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
0d6ec39https://github.com/getsentry/sentry-javascript/commit/0d6ec3952ecd41a443d220f148e71fa2d7ddb1d8
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#event-36761489603
JPeer264https://github.com/JPeer264
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#event-36770813030
feat(nestjs): Handle @nestjs/mcp tool errors in SentryGlobalFilter (g…https://github.com/adityareddy-dev/sentry-javascript/commit/0d6ec3952ecd41a443d220f148e71fa2d7ddb1d8
g…https://github.com/getsentry/sentry-javascript/pull/26695
https://docs.github.com/articles/closing-issues-via-commit-messages
0d6ec39https://github.com/adityareddy-dev/sentry-javascript/commit/0d6ec3952ecd41a443d220f148e71fa2d7ddb1d8
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Nov 20, 2026https://github.com/getsentry/sentry-javascript/issues/26693#issuecomment-7041438448
GitHub Actionshttps://help.github.com/en/actions
#26695https://github.com/getsentry/sentry-javascript/pull/26695
11.16.0 releasehttps://github.com/getsentry/sentry-javascript/releases/tag/11.16.0
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-javascript/issues/26693
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/26693
Featurehttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Feature%22
Nest.jshttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Nest.js%22
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.