Skip to content

fix(v10/core): resolve MCP capture policy per operation - #23796

Open
JPeer264 wants to merge 1 commit into
v10from
backport/v10-mcp-capture-policy-per-operation
Open

fix(v10/core): resolve MCP capture policy per operation#23796
JPeer264 wants to merge 1 commit into
v10from
backport/v10-mcp-capture-policy-per-operation

Conversation

@JPeer264

@JPeer264 JPeer264 commented Sep 1, 2026

Copy link
Copy Markdown
Member

Backport of: #23437

Differences to the original PR

  • packages/core/src/integrations/mcp-server/transport.ts: the no-client fallback in resolveMcpOptions is false for recordInputs/recordOutputs, not true. On v10 resolveDataCollectionOptions still routes through the sendDefaultPii bridge when dataCollection is absent, so the old wrapMcpServerWithSentry code fell back to false when no client existed. Keeping true here would start capturing MCP inputs and outputs on a maintenance branch.
  • packages/core/src/integrations/mcp-server/transport.ts: startInactiveSpan is imported from ../../tracing together with withActiveSpan; v10 has no separate ../../tracing/trace import in this file.
  • packages/core/test/lib/integrations/mcp-server/capturePolicy.test.ts: the span-config helpers use sentry.source instead of sentry.segment.name.source, and the tool config carries a top-level op: 'mcp.server', matching v10's buildMcpServerSpanConfig. The no-client case asserts that inputs and outputs are omitted, following the fallback above.
  • dev-packages/e2e-tests/test-applications/node-express/src/app.ts: the dataCollection.genAI block is not added. On v10 the presence of any dataCollection key switches the resolution base from the sendDefaultPii bridge to the permissive spec defaults, which would have flipped userInfo, cookies, httpHeaders, httpBodies and databaseQueryData on for every other test in this app. Without the block, genAI already resolves to { inputs: false, outputs: false }, so the new MCP e2e assertions hold unchanged.
  • dev-packages/e2e-tests/test-applications/cloudflare-mcp-agent/src/index.ts: the genAI settings are merged into the existing dataCollection: { userInfo: true } object. v10 already sets dataCollection in both Sentry.init calls, so the original patch would have produced a duplicate key and silently dropped userInfo: true.

@JPeer264
JPeer264 marked this pull request as ready for review September 1, 2026 07:16
@JPeer264
JPeer264 requested review from msonnb and s1gr1d September 1, 2026 07:16
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.75 kB added added
@sentry/browser - with treeshaking flags 26.19 kB added added
@sentry/browser (incl. Tracing) 46.63 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.41 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.38 kB added added
@sentry/browser (incl. Tracing, Replay) 85.88 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.51 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 90.61 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 103.25 kB added added
@sentry/browser (incl. Feedback) 44.92 kB added added
@sentry/browser (incl. sendFeedback) 32.54 kB added added
@sentry/browser (incl. FeedbackAsync) 37.68 kB added added
@sentry/browser (incl. Metrics) 28.83 kB added added
@sentry/browser (incl. Logs) 29.06 kB added added
@sentry/browser (incl. Metrics & Logs) 29.75 kB added added
@sentry/react 29.56 kB added added
@sentry/react (incl. Tracing) 48.89 kB added added
@sentry/vue 33.18 kB added added
@sentry/vue (incl. Tracing) 48.59 kB added added
@sentry/svelte 27.77 kB added added
CDN Bundle 30.14 kB added added
CDN Bundle (incl. Tracing) 48.59 kB added added
CDN Bundle (incl. Logs, Metrics) 31.72 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 49.89 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 71.01 kB added added
CDN Bundle (incl. Tracing, Replay) 86.11 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.41 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 91.91 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.19 kB added added
CDN Bundle - uncompressed 89.87 kB added added
CDN Bundle (incl. Tracing) - uncompressed 146.84 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.58 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.82 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.41 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.15 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 270.12 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.85 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.81 kB added added
@sentry/nextjs (client) 51.42 kB added added
@sentry/sveltekit (client) 47.04 kB added added
@sentry/core/server 80.59 kB added added
@sentry/core/browser 66.74 kB added added
@sentry/node-core 63.27 kB added added
@sentry/node 125.77 kB added added
@sentry/node (incl. diagnostics channel injection) 169.85 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B added added
@sentry/node/light 51.43 kB added added
@sentry/node - without tracing 74.95 kB added added
@sentry/aws-serverless 84.22 kB added added
@sentry/cloudflare (withSentry) - minified 202.59 kB added added
@sentry/cloudflare (withSentry) 498.65 kB added added

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.

3 participants