Sentry MCP — Error Monitoring Server for AI Agents
MCP server that connects AI agents to Sentry for real-time error monitoring. Query issues, analyze stack traces, track regressions, and resolve bugs with full crash context. 2,000+ stars.
What it is
Sentry MCP is a Model Context Protocol server that connects AI agents to Sentry's error monitoring platform. It gives agents like Claude Code the ability to query issues, analyze stack traces, track regressions, and access crash context directly from the development environment. Instead of switching between your editor and the Sentry dashboard, the AI agent retrieves error data and suggests fixes inline.
The server targets developers who use Sentry for error tracking and want their AI coding assistant to have awareness of production errors while writing code.
How it saves time or tokens
Sentry MCP eliminates the context switch between your editor and the Sentry dashboard. When debugging, the AI agent can pull the exact stack trace, affected users count, and error frequency without you navigating the Sentry UI. The agent correlates error data with your codebase to suggest targeted fixes, reducing the investigation cycle from multiple tool switches to a single conversation.
How to use
- Add the Sentry MCP server to your
.mcp.json:
{
"mcpServers": {
"sentry": {
"command": "npx",
"args": ["-y", "@sentry/mcp-server"],
"env": {
"SENTRY_AUTH_TOKEN": "sntrys_your_token",
"SENTRY_ORG": "your-org"
}
}
}
}
- Get your auth token at sentry.io/settings/auth-tokens.
- Restart Claude Code and ask about your errors: 'What are the top unresolved issues in the backend project?'
Example
Debugging workflow with Sentry MCP:
# Ask the agent to investigate errors
'Show me the top 5 unresolved errors in the API project'
# Agent calls Sentry MCP, returns:
# 1. TypeError: Cannot read property 'id' of null (342 events)
# 2. ConnectionTimeoutError: Redis connection timed out (128 events)
# ...
# Drill into a specific error
'Show me the stack trace for the TypeError issue'
# Agent retrieves full stack trace and suggests a fix
'The null check is missing in UserService.getProfile(). Add:
if (!user) return null;'
Related on TokRepo
- AI Tools for Monitoring — Monitoring and observability tools for production systems
- AI Tools for Testing — Testing tools that catch errors before they reach production
Common pitfalls
- The auth token needs project-level read access. Organization-level tokens without project scope return empty results.
- Rate limits apply to the Sentry API. Frequent queries during a debugging session may hit throttling. Cache results when iterating on a fix.
- The MCP server exposes error data to the AI agent. Ensure your Sentry data does not contain sensitive user information that should not be sent to LLM providers.
Frequently Asked Questions
The agent can query issues, stack traces, event counts, affected user counts, error frequencies, and regression data. It accesses the same data available through the Sentry API, scoped to the permissions of your auth token.
Yes, if your self-hosted Sentry instance exposes the standard API. You may need to configure the server URL in addition to the auth token and organization slug.
The MCP server primarily provides read access to error data. Write operations like resolving or ignoring issues depend on the specific MCP server implementation and your auth token's permissions.
The MCP server makes API calls to Sentry on behalf of the agent. If you hit Sentry's API rate limits, the server returns an error. Spread your queries over time during heavy debugging sessions.
Yes. Stack traces and error messages retrieved by the MCP server are included in the conversation context sent to the LLM. Ensure your Sentry data does not contain sensitive PII or credentials in error messages.
Citations (3)
- Sentry MCP GitHub— Sentry MCP server for AI agent error monitoring
- Sentry Documentation— Sentry error monitoring platform
- MCP Documentation— Model Context Protocol for AI tool integration
Related on TokRepo
Source & Thanks
Created by Sentry. Licensed under MIT.
sentry-mcp — ⭐ 2,000+
Thanks to Sentry for closing the loop between error monitoring and AI-assisted fixing.