Skip to content

Commit a3adea3

Browse files
docs(js): Document dataCollection.mcp option (#20346)
1 parent 94d5103 commit a3adea3

3 files changed

Lines changed: 32 additions & 5 deletions

File tree

‎docs/platforms/javascript/common/configuration/options.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ For more on what data Sentry collects and how to control it, see <PlatformLink t
140140
| `urlQueryParams` | `CollectBehavior` | `true` | Collect URL query parameters. Parameter names are always included. The SDK replaces the values of sensitive parameters with `[Filtered]`. |
141141
| `graphQL` | `{ document?, variables? }` | both `true` | `document`: Collect the GraphQL document (the query or mutation source text). <br /><br /> `variables`: Collect the variables that are passed to GraphQL operations. <br /><br /> The operation name and type are always collected. |
142142
| `genAI` | `{ inputs?, outputs? }` | both `true` | `inputs`: Collect the content of generative AI inputs: system instructions, prompt messages, tool definitions, and tool call arguments. <br /><br /> `outputs`: Collect the content of generative AI outputs, such as completion text and tool call results. <br /><br /> Metadata, such as the model name and token counts, is always collected. Options set on an AI integration take precedence over these values. |
143+
| `mcp` | `{ inputs?, outputs? }` | both `true` | Available in SDK version `11.9.0` and above. <br /><br /> `inputs`: Collect the content of incoming MCP requests, such as tool call arguments, prompt arguments, and the payload of MCP logging notifications. <br /><br /> `outputs`: Collect the content of MCP responses, such as tool results and prompt result messages. <br /><br /> Metadata, such as the method name, the tool or prompt name, and error status, is always collected. A field you don't set falls back to the matching `genAI` field. The `recordInputs` and `recordOutputs` options of `wrapMcpServerWithSentry` take precedence over these values. |
143144
| `databaseQueryData` | `boolean` | `true` | Collect the data associated with database queries: bound query parameters, data payloads for write operations, and returned result data. <br /><br /> The sanitized or parameterized query text (`db.query.text`) is **not** controlled by this option. Structural metadata, such as the database system, query summary, operation name, and table, is also **always** collected. |
144145
| `queues` | `boolean` | `true` | Collect the arguments passed to tasks within queues. For Kafka, this is the message key. Structural metadata, such as the messaging system, the destination name, and the operation, is always collected. |
145146
| `stackFrameVariables` | `CollectBehavior` | `true` | Capture local variable values in stack frames. Allow/deny lists match variable names. |

‎docs/platforms/javascript/common/data-management/data-collected/index.mdx‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,6 @@ Sentry.init({
272272

273273
The content of generative AI inputs (system instructions, prompt messages, tool definitions, and tool call arguments) and outputs (such as completion text and tool call results) might carry personal data. By default, the SDK records both inputs and outputs. Metadata like model ID and token counts is always collected.
274274

275-
The same setting applies to instrumented MCP servers. By default, the SDK records the inputs and outputs of tool calls, prompt retrievals, and resource reads. Use the `recordInputs` and `recordOutputs` options of `wrapMcpServerWithSentry` to control recording per server.
276-
277275
Use the `dataCollection.genAI` option to control this. For example, opt out of recording AI message content while keeping the metadata:
278276

279277
```JavaScript
@@ -287,6 +285,32 @@ Sentry.init({
287285
},
288286
});
289287
```
288+
289+
<PlatformCategorySection supported={["server"]}>
290+
## MCP Server Inputs and Outputs
291+
292+
When you instrument an MCP server, metadata like the method name, the tool or prompt name, the session and protocol version, content counts, and error status is always sent to Sentry.
293+
294+
The content of MCP requests and responses might carry personal data, such as tokens, file paths, or private user content. By default, the SDK records both inputs (such as tool call arguments, prompt arguments, and the payload of MCP logging notifications) and outputs (such as tool results and prompt result messages).
295+
296+
Use the `dataCollection.mcp` option, available in SDK version `11.9.0` and above, to control this. For example, opt out of recording MCP content while keeping the metadata:
297+
298+
```JavaScript
299+
Sentry.init({
300+
dsn: "___PUBLIC_DSN___",
301+
dataCollection: {
302+
mcp: {
303+
inputs: false,
304+
outputs: false,
305+
},
306+
},
307+
});
308+
```
309+
310+
If you don't set a field of `dataCollection.mcp`, the SDK uses the matching `dataCollection.genAI` field instead. In SDK versions before `11.9.0`, `dataCollection.genAI` is the only global setting for MCP content.
311+
312+
To control recording for a specific server, use the `recordInputs` and `recordOutputs` options of <PlatformLink to="/mcp-monitoring/">`wrapMcpServerWithSentry`</PlatformLink>. They take precedence over the `dataCollection` settings.
313+
</PlatformCategorySection>
290314
</PlatformSection>
291315

292316
<PlatformSection supported={["javascript.electron"]}>

‎docs/platforms/javascript/common/mcp-monitoring/index.mdx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ Support for `@modelcontextprotocol/server` 2.x requires Sentry JavaScript SDK ve
2424

2525
By default, the SDK sends the inputs and outputs of your MCP tool calls, prompt retrievals, and resource reads. This gives you rich debugging context. MCP payloads can carry sensitive data, such as tokens, file paths, or private user content. Review what your server handles before you deploy to production.
2626

27-
The <PlatformLink to="/configuration/options/#dataCollection">`dataCollection.genAI`</PlatformLink> option controls this recording globally for both MCP and AI instrumentation:
27+
The <PlatformLink to="/configuration/options/#dataCollection">`dataCollection.mcp`</PlatformLink> option controls this recording globally for all MCP servers:
2828

2929
```javascript
3030
Sentry.init({
3131
dsn: "___PUBLIC_DSN___",
3232
dataCollection: {
33-
genAI: { inputs: false, outputs: false },
33+
mcp: { inputs: false, outputs: false },
3434
},
3535
});
3636
```
3737

38-
To control recording for a specific server, pass it to `wrapMcpServerWithSentry` with the `recordInputs` and `recordOutputs` options. These options override the `dataCollection.genAI` settings, and they also apply to a server the SDK has already instrumented automatically:
38+
The `dataCollection.mcp` option requires Sentry JavaScript SDK version `11.9.0` or newer. If you don't set a field of `dataCollection.mcp`, or you use an older SDK version, the matching `dataCollection.genAI` field controls MCP recording instead.
39+
40+
To control recording for a specific server, pass it to `wrapMcpServerWithSentry` with the `recordInputs` and `recordOutputs` options. These options override the `dataCollection` settings, and they also apply to a server the SDK has already instrumented automatically:
3941

4042
```javascript
4143
const server = Sentry.wrapMcpServerWithSentry(mcpServer, {

0 commit comments

Comments
 (0)