Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/platforms/javascript/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ For more on what data Sentry collects and how to control it, see <PlatformLink t
| `httpBodies` | `HttpBodyCollectionTarget[]` | all types | Body types to collect: `"incomingRequest"`, `"outgoingRequest"`, `"incomingResponse"`, `"outgoingResponse"`. Set to `[]` to disable. |
| `urlQueryParams` | `CollectBehavior` | `true` | Collect URL query parameters. Parameter names are always included. The SDK replaces the values of sensitive parameters with `[Filtered]`. |
| `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. |
| `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. |
| `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. <br /><br /> For instrumented MCP servers, `mcp` takes precedence over these values. |
| `mcp` | `{ inputs?, outputs? }` | both `true` | `inputs`: Collect the content of incoming MCP requests: tool call arguments, prompt arguments, and the message payload of logging notifications. <br /><br /> `outputs`: Collect the content of MCP responses, such as tool results and prompt messages. <br /><br /> Metadata, such as the method name, tool or prompt name, session, protocol version, content counts, and error status, is always collected. The `recordInputs` and `recordOutputs` options of [`wrapMcpServerWithSentry`](/platform-redirect/?next=%2Fmcp-monitoring%2F) take precedence over these values. If you don't set a field, MCP servers use the matching `genAI` field. Requires SDK version `11.9.0` or newer. In earlier versions, only `genAI` controls MCP content. |
| `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. |
| `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. |
| `stackFrameVariables` | `CollectBehavior` | `true` | Capture local variable values in stack frames. Allow/deny lists match variable names. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,6 @@ Sentry.init({

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.

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.

Use the `dataCollection.genAI` option to control this. For example, opt out of recording AI message content while keeping the metadata:

```JavaScript
Expand All @@ -287,6 +285,34 @@ Sentry.init({
},
});
```

<PlatformCategorySection supported={["server"]}>

## MCP Requests And Responses

When you instrument an MCP server, the SDK always sends metadata like the method name, the tool or prompt name, the session, and the error status.

The content of MCP requests (tool call arguments, prompt arguments, and logging notification payloads) and responses (tool results and prompt messages) might carry personal data or secrets. By default, the SDK records both.

Use the `dataCollection.mcp` option to control this. It takes precedence over `dataCollection.genAI`. If you don't set it, MCP servers follow your `genAI` settings. For example, opt out of recording MCP content while keeping the metadata:

```JavaScript
Sentry.init({
dsn: "___PUBLIC_DSN___",
dataCollection: {
mcp: {
inputs: false,
outputs: false,
},
},
});
```

To control recording for a single server, use the `recordInputs` and `recordOutputs` options of <PlatformLink to="/mcp-monitoring/#configure-input-and-output-recording">`wrapMcpServerWithSentry`</PlatformLink>. They take precedence over `dataCollection.mcp`.

The `dataCollection.mcp` option requires SDK version `11.9.0` or newer. In earlier versions, `dataCollection.genAI` controls MCP content.

</PlatformCategorySection>
</PlatformSection>

<PlatformSection supported={["javascript.electron"]}>
Expand Down
8 changes: 5 additions & 3 deletions docs/platforms/javascript/common/mcp-monitoring/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ Support for `@modelcontextprotocol/server` 2.x requires Sentry JavaScript SDK ve

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.

The <PlatformLink to="/configuration/options/#dataCollection">`dataCollection.genAI`</PlatformLink> option controls this recording globally for both MCP and AI instrumentation:
The <PlatformLink to="/configuration/options/#dataCollection">`dataCollection.mcp`</PlatformLink> option controls this recording globally for all MCP servers. `inputs` covers tool call arguments, prompt arguments, and logging notification payloads. `outputs` covers tool results and prompt messages. Metadata, such as the tool name, session, and error status, is always collected:

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
dataCollection: {
genAI: { inputs: false, outputs: false },
mcp: { inputs: false, outputs: false },
},
});
```

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:
The `dataCollection.mcp` option requires Sentry JavaScript SDK version `11.9.0` or newer. In earlier versions, `dataCollection.genAI` controls MCP recording together with AI instrumentation. If you don't set `mcp`, the SDK falls back to the matching `genAI` field, so existing `genAI` settings keep applying to MCP servers. When you set both, `mcp` takes precedence.

To control recording for a specific server, pass it to `wrapMcpServerWithSentry` with the `recordInputs` and `recordOutputs` options. These options override the `dataCollection.mcp` settings, and they also apply to a server the SDK has already instrumented automatically:

```javascript
const server = Sentry.wrapMcpServerWithSentry(mcpServer, {
Expand Down
6 changes: 3 additions & 3 deletions docs/product/mcp-servers/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ On Cloudflare Workers, automatic instrumentation requires building with the Sent

#### Options

Pass these options to `wrapMcpServerWithSentry` to configure a specific server, including one the SDK already instrumented automatically. The `recordInputs` and `recordOutputs` options require Sentry JavaScript SDK version `10.33.0` or newer.
Pass these options to [`wrapMcpServerWithSentry`](/platform-redirect/?next=%2Fmcp-monitoring%2F) to configure a specific server, including one the SDK already instrumented automatically. The `recordInputs` and `recordOutputs` options require Sentry JavaScript SDK version `10.33.0` or newer.

##### `recordInputs`

_Type: `boolean`_

Records inputs to MCP tool and prompt calls (such as tool arguments and prompt parameters).

Defaults to `dataCollection.genAI.inputs`. In Sentry JavaScript SDK 10.x, when `dataCollection` isn't configured, this follows `sendDefaultPii`.
Defaults to `dataCollection.mcp.inputs`, then `dataCollection.genAI.inputs`. Before Sentry JavaScript SDK `11.9.0`, only `dataCollection.genAI.inputs` applies. In Sentry JavaScript SDK 10.x, when `dataCollection` isn't configured, this follows `sendDefaultPii`.

##### `recordOutputs`

_Type: `boolean`_

Records outputs from MCP tool and prompt calls (such as tool results and prompt messages).

Defaults to `dataCollection.genAI.outputs`. In Sentry JavaScript SDK 10.x, when `dataCollection` isn't configured, this follows `sendDefaultPii`.
Defaults to `dataCollection.mcp.outputs`, then `dataCollection.genAI.outputs`. Before Sentry JavaScript SDK `11.9.0`, only `dataCollection.genAI.outputs` applies. In Sentry JavaScript SDK 10.x, when `dataCollection` isn't configured, this follows `sendDefaultPii`.

#### Cloudflare Workers

Expand Down
Loading