feat: add user agent tracking to MCP telemetry#338
Conversation
- Add user_agent.original attribute to all MCP operations (tools, prompts, resources)
- Stdio: Support MCP_USER_AGENT env var with default sentry-mcp-stdio/{version}
- Cloudflare: Capture user agent from initial SSE/WebSocket request headers
- Document user agent tracking following OpenTelemetry semantic conventions
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #338 +/- ##
==========================================
- Coverage 63.65% 63.45% -0.21%
==========================================
Files 46 46
Lines 5668 5686 +18
Branches 471 471
==========================================
Hits 3608 3608
- Misses 2060 2078 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| attributes: { | ||
| "mcp.resource.name": resource.name, | ||
| "mcp.resource.uri": url.toString(), | ||
| ...(context.userAgent && { |
There was a problem hiding this comment.
we'll remove this once sentry's core instrumentation does this at the mcp.server level
| name: `prompts/get ${prompt.name}`, | ||
| attributes: { | ||
| "mcp.prompt.name": prompt.name, | ||
| ...(context.userAgent && { |
There was a problem hiding this comment.
we'll remove this once sentry's core instrumentation does this at the mcp.server level
| name: `tools/call ${tool.name}`, | ||
| attributes: { | ||
| "mcp.tool.name": tool.name, | ||
| ...(context.userAgent && { |
There was a problem hiding this comment.
we'll remove this once sentry's core instrumentation does this at the mcp.server level
|
I'm not totally sure this is correct, but low risk so we'll ship and verify. |
🤖 Generated with Claude Code