Skip to content

Commit eb02573

Browse files
authored
feat(mcp): add python FastMCP (#15347)
1 parent 0cbac5f commit eb02573

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

docs/product/insights/ai/mcp/getting-started.mdx

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ Sentry MCP Observability helps you track and debug Model Context Protocol (MCP)
88

99
To start sending MCP data to Sentry, make sure you've created a Sentry project for your MCP-enabled repository and follow the guide below:
1010

11-
## Requirements
12-
13-
<VersionRequirement product="MCP Observability" sdk="Node SDK" minVersion="9.46.0" />
14-
15-
1611
## Supported SDKs
1712

1813
### JavaScript - MCP Server
1914

15+
<VersionRequirement
16+
product="MCP Observability"
17+
sdk="Node SDK"
18+
minVersion="9.46.0"
19+
/>
20+
2021
The Sentry JavaScript SDK supports MCP observability by wrapping the MCP Server from the [@modelcontextprotocol/sdk](https://www.npmjs.com/package/@modelcontextprotocol/sdk) package. This wrapper automatically captures spans for your MCP server workflows including tool executions, resource access, and client connections.
2122

2223
#### Quick Start with MCP Server
@@ -41,3 +42,40 @@ const server = Sentry.wrapMcpServerWithSentry(new McpServer({
4142

4243
...
4344
```
45+
46+
### Python - MCP Server
47+
48+
<VersionRequirement
49+
product="MCP Observability"
50+
sdk="Python SDK"
51+
minVersion="2.43.0"
52+
/>
53+
54+
The Sentry Python SDK supports MCP observability for [FastMCP](https://gofastmcp.com/getting-started/welcome). The integration automatically captures spans for your MCP server workflows including tool executions, resource access, and prompt handling.
55+
56+
#### Quick Start with FastMCP
57+
58+
```python
59+
import sentry_sdk
60+
from mcp.server.fastmcp import FastMCP
61+
62+
# Sentry init needs to be above everything else
63+
sentry_sdk.init(
64+
dsn="___PUBLIC_DSN___",
65+
traces_sample_rate=1.0,
66+
# Optional: Enable to capture tool call arguments and results in Sentry, which may include PII
67+
send_default_pii=True,
68+
)
69+
70+
# Create the MCP server
71+
mcp = FastMCP("Example MCP Server")
72+
73+
# Define a tool
74+
@mcp.tool()
75+
async def calculate_sum(a: int, b: int) -> int:
76+
"""Add two numbers together."""
77+
return a + b
78+
79+
# Run the server
80+
mcp.run()
81+
```

0 commit comments

Comments
 (0)