Learn Claude Code: Tool Integrations Sentry: Production Debugging

Sentry: Production Debugging

Intermediate 🕐 12 min Lesson 4 of 11
What you'll learn
  • Connect the Sentry MCP server using the OAuth authentication flow from within a Claude Code session
  • Query production errors, read stack traces, and identify which deployment introduced a regression
  • Combine Sentry and GitHub MCP to close the loop from error to fix in a single session

Reading a stack trace from a tab you just alt-tabbed to

When a production error arrives, the typical workflow goes like this: open the Sentry alert email, click through to the Sentry dashboard, navigate to the error, read the stack trace, copy the relevant frames, switch to Claude, paste them in, and start asking questions. If the error references a specific release, you go back to Sentry to find the release details. If you want to fix it, you need to find the corresponding commit on GitHub.

The Sentry MCP server gives Claude direct access to your Sentry data. Stack traces, recent errors, release information, and error counts are all available as tool calls. Claude can answer questions about your production errors without you copying anything.

Adding the Sentry server

Sentry's MCP server is the canonical OAuth example in the official Claude Code documentation. It uses the standard browser-based OAuth flow and is available without any special configuration.

Add the server:

claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

Check its status:

claude mcp list

You will see ! Needs authentication. This is expected. Start a Claude session and open the MCP panel:

/mcp

Select sentry and choose Authenticate. Your browser opens to Sentry's sign-in page. Approve the connection. Back in Claude Code, the server status changes to ✓ Connected.

Claude Code stores the OAuth token securely and refreshes it automatically. You will not need to reauthenticate unless you revoke access from Sentry's settings.

Querying your errors

Once connected, you can ask Claude about your Sentry data in plain language:

What are the most common errors in the last 24 hours?

Claude calls the Sentry MCP tools to fetch error counts by type, returns a ranked list, and can describe each one. You can drill into any error:

Show me the stack trace for the TypeError that started appearing this morning.

Claude retrieves the full stack trace, including the file paths, line numbers, and local variables at each frame — the same data you would see in the Sentry UI, but now in context with everything else Claude knows about your codebase.

The release-to-regression workflow

One of the most valuable Sentry queries is connecting a new error to the deploy that introduced it:

Which deployment introduced these new NullReferenceException errors? When did they start appearing?

Claude queries Sentry's release data, compares error rates across releases, and identifies the specific deploy where the error count spiked. It can also compare the error rate before and after a release to confirm whether a fix worked.

This workflow — error appears, find the responsible deploy, correlate with a code change — takes minutes of dashboard navigation to do manually. With Sentry connected, it is a single question.

Closing the loop with GitHub

Sentry tells you something is broken. GitHub tells you where the code lives. With both servers connected, you can close the full debugging loop in one session:

Check Sentry for the most common errors in the payments service. Find the commit on GitHub that likely introduced the top error. Suggest a fix.

Claude queries Sentry for the error details and the release it appeared in, queries GitHub to find the relevant commits around that release, reads the code changes, and suggests the fix. The full path from error notification to code fix happens without leaving Claude Code.

Reading the authentication status indicators

The /mcp panel inside a session and claude mcp list in your shell both show status indicators that are worth knowing:

  • ✓ Connected — ready to use
  • ! Needs authentication — server is reachable but you need to complete the OAuth flow
  • ✗ Failed to connect — server did not respond; check the URL with curl -I https://mcp.sentry.dev/mcp
  • ✗ Connection error — the connection attempt threw an error; run claude mcp get sentry for the specific message

If your Sentry authentication expires, Claude Code shows a notice and the /mcp panel offers a Re-authenticate option. Choose it and complete the browser flow again to restore access.

Key takeaways
  • Sentry's MCP server is the canonical OAuth example in the official Claude Code docs — add the URL, run /mcp, authenticate once, and it stays connected with automatic token refresh.
  • Claude can query Sentry errors, stack traces, and release data in plain language — no dashboard navigation or copy-paste required.
  • The release-to-regression workflow — identifying which deploy introduced a new error — is one of the most time-saving Sentry + Claude combinations.
  • Combining Sentry MCP with GitHub MCP closes the full debugging loop: error details from Sentry, responsible commit from GitHub, fix suggested in context.
  • Authentication status indicators in /mcp and <code>claude mcp list</code> tell you exactly what is wrong when a server is not connecting — check them before troubleshooting further.