Debug Faster with Sentry MCP and Claude Code
Connect Sentry to Claude Code so your AI coding agent can pull issues, read traces and logs, find the root cause, and apply the fix.
Before you start
Tools
- Claude Code installed and running
- Node.js 18+ (for
npx)
Accounts & access
- Sentry account with at least one project instrumented
Knowledge
- Basic familiarity with Claude Code and how to open its chat interface
1 Install and authenticate the Sentry MCP server
The Sentry MCP server is a cloud-hosted service with no package to maintain. Run the command below in your terminal to register it with Claude Code, then launch Claude Code with claude. When prompted, sign in with your Sentry account and grant the requested permissions.
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp 2 Ask Claude to summarize your open issues
Open the Claude Code chat interface and ask it to pull issues from your Sentry project. Claude will use the Sentry MCP tools to list current issues, grouped by frequency and recency. Try a prompt like the one below and adjust the project slug and timeframe to match your setup. You can find your project slug in Sentry under Settings > Projects.
Use Sentry to list the top 5 open issues in my [project-slug]
project from the last 24 hours.
Summarize each one: what's failing, how often,
and which users are affected. 3 Pull full context for a specific issue
Once you spot an issue worth investigating, ask Claude to go deeper. It can fetch the full stack trace, related log lines, and trace spans for any event. This is the same data you'd find in the Issues tab and Logs Explorer, without leaving your editor. Logs are especially useful here: if your app emits structured logs, Claude can search them for patterns around the time the error occurred, correlating log output with the stack trace to pinpoint exactly where things went wrong. Sentry's Seer integration can also suggest a root cause automatically. Ask Claude to pull all of it at once.
Fetch the latest event for issue [ISSUE-ID] in Sentry.
Get the full stack trace, related log output around the time
of the error, and run a root-cause analysis using Seer.
Tell me exactly what's going wrong and why. 4 Apply the fix
With the root cause identified, ask Claude to locate the relevant code in your repository and apply a fix. Because Claude Code has access to both your codebase and the Sentry issue context in the same session, it can write a targeted, accurate patch rather than a generic suggestion. Review the diff before accepting. Once you're happy, commit and deploy as usual. Check Issues in Sentry to confirm the error rate drops after the fix ships.
Based on the Sentry issue and root cause you just found,
locate the relevant code in this repo and apply a fix.
Show me the diff before making any changes.That's it.
Claude found it. Claude fixed it.
With Sentry's MCP server connected to Claude Code, your AI agent can search through errors, traces, and logs to pinpoint root causes and ship the fix in a fraction of the time it would take manually.
- Installed and authenticated the Sentry MCP server in Claude Code
- Asked Claude to list and summarize open issues from your Sentry project
- Had Claude pull full error context: stack traces, structured logs, and related spans
- Applied a bug fix directly inside your editor with Claude's help
Pro tips
- 💡 Give Claude a specific issue ID (e.g.
MYAPP-123) rather than a description. It removes ambiguity and lets Claude fetch the exact event data in one tool call. - 💡 Ask Claude to check for related issues before applying a fix:
Are there any other Sentry issues in this project that might share the same root cause?This surfaces systemic problems, not just the one you're looking at. - 💡 Combine Sentry context with your code search:
Find the function referenced in the stack trace and show me recent git changes to it.Claude can correlate the error with recent commits to narrow down when the bug was introduced.
Common pitfalls
- ⚠️ Complete the OAuth flow before asking Claude to fetch Sentry data. If you skip it or dismiss the browser prompt, Claude won't have access to your organization and MCP tool calls will fail.
- ⚠️ Avoid asking Claude to fix an issue without first fetching the full event context. Generic prompts like
fix the login buggive Claude nothing to work with; always pull the stack trace and logs first. - ⚠️ Don't rely solely on Seer's root-cause suggestion without reviewing the stack trace yourself. Seer is a strong starting point, but Claude's fix will be more accurate when you validate the diagnosis against your own knowledge of the codebase.
Frequently asked questions
What's next?
Fix it, don't observe it.
Get started with the only application monitoring platform that empowers developers to fix application problems without compromising on velocity.