Skip to content

Commit 79bc060

Browse files
authored
fix(python-mcp): Add MCP integration to snippets (#15511)
The MCP integration is not automatically enabled. Update copy and snippets to reflect that. - fixes [TET-1439: Add integration init in MCP setup docs](https://linear.app/getsentry/issue/TET-1439/add-integration-init-in-mcp-setup-docs)
1 parent ab0feb3 commit 79bc060

File tree

1 file changed

+22
-2
lines changed
  • docs/platforms/python/integrations/mcp

1 file changed

+22
-2
lines changed

docs/platforms/python/integrations/mcp/index.mdx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,23 @@ uv add "sentry-sdk[mcp]"
3838

3939
## Configure
4040

41-
If you have the `mcp` package in your dependencies, the MCP integration will be enabled automatically when you initialize the Sentry SDK.
41+
Simply update your `sentry_sdk.init()` call to include the `MCPIntegration()`.
4242

43-
<PlatformContent includePath="getting-started-config" />
43+
```python
44+
import sentry_sdk
45+
from sentry_sdk.integrations.mcp import MCPIntegration
46+
47+
sentry_sdk.init(
48+
dsn="___PUBLIC_DSN___",
49+
traces_sample_rate=1.0,
50+
# Add data like tool inputs/outputs;
51+
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
52+
send_default_pii=True,
53+
integrations=[
54+
MCPIntegration(),
55+
],
56+
)
57+
```
4458

4559
## Verify
4660

@@ -63,6 +77,9 @@ sentry_sdk.init(
6377
# Add data like tool inputs/outputs;
6478
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
6579
send_default_pii=True,
80+
integrations=[
81+
MCPIntegration(),
82+
],
6683
)
6784

6885
# Create the MCP server
@@ -115,6 +132,9 @@ sentry_sdk.init(
115132
dsn="___PUBLIC_DSN___",
116133
traces_sample_rate=1.0,
117134
send_default_pii=True,
135+
integrations=[
136+
MCPIntegration(),
137+
],
118138
)
119139

120140
# Create the low-level MCP server

0 commit comments

Comments
 (0)