How to connect to the Sentry MCP with Claude Code (4 steps)
.avif)
When a production error fires, most developers follow the same pattern: switch to the browser, open Sentry, find the issue, copy the stack trace, switch back to the terminal, and paste it in. That context switch breaks focus and adds minutes to every debugging cycle.
To help your developers pull Sentry error data directly into their coding session, we'll show you how to connect Sentry with Merge Agent Handler's Sentry MCP server.
How it works
Merge Agent Handler routes requests from Claude Code to Sentry's API. You install the Merge CLI, authenticate once, and register the connection with a single command. Agent Handler manages auth token storage so you don't keep Sentry credentials in your local environment or wire them into your codebase.
Here's the command that registers the connection:
Prerequisites
Before getting started, you'll need the following:
- A Merge Agent Handler account
- Claude Code installed (run
claude --versionto confirm) - pipx installed (run
pipx --versionto confirm, or install viapip install pipx) - A Sentry account with access to the projects you want to monitor
If you want to connect Merge Agent Handler's Sentry MCP with internal or customer-facing agentic products, you can follow the steps in our docs.
1. Install the Merge CLI
Install with pipx: pipx install merge-api

Verify your installation: merge --version
2. Configure the CLI and log in
Run merge login to authenticate your session and link the CLI to your Merge Agent Handler account: merge login
This authenticates your session so the CLI can make authorized requests on your behalf.
3. Add Agent Handler to Claude Code
To add Agent Handler to Claude Code, run:
Or register manually with:
Verify the connection registered. Open Claude Code and run: /mcp
agent-handler should appear under Local MCPs with a connected status.

4. Authenticate Sentry
Open a Claude Code session and test it with: "Show me the 5 most recent unresolved errors in the production environment and summarize the stack trace for the most critical one."
The first time you use a Sentry tool, a Magic Link will appear to authenticate the connector.

You should then see an output like the following:

{{this-blog-only-cta}}
Sentry MCP FAQ
In case you have more questions on setting up and using the Sentry MCP in Claude Code, we've addressed several more commonly-asked questions below.
What can you do once the Sentry MCP is connected to Claude Code?
With Sentry connected, Claude Code can:
- Search and retrieve issues: pull up open, resolved, or regressed errors by project, environment, or time range without leaving the terminal
- Read stack traces and event detail: fetch the full event payload for any issue, including stack frames, breadcrumbs, and request context
- List issues by project: surface all active errors in a given project so you can prioritize what to fix next
- Check issue status and assignment: see who owns an issue and what its current state is before starting a fix
- Resolve or assign issues: update issue state directly from Claude Code if write tools are enabled in your Tool Pack
This pays off most during active debugging. Instead of switching to the browser to find the relevant Sentry issue, copying the stack trace, and pasting it into your terminal, Claude Code can retrieve the full error context in the same session where you're writing the fix.
Why use Merge Agent Handler vs. a self-hosted Sentry MCP server?
You can build a self-hosted MCP server that talks directly to Sentry's API. For a single developer on a personal project, that approach is straightforward.
It breaks down at the team level. Self-hosting means managing Sentry auth tokens per developer, handling token rotation when someone leaves, and keeping the server maintained as Sentry's API evolves. Each developer ends up with their own credential management problem, and there's no central place to audit what your agents are reading or writing.
Merge Agent Handler is a managed MCP layer. It centralizes authentication, scopes access at the Tool Pack and Registered User level so each developer gets access to exactly the projects they need, and logs every tool call for observability. When you need to know what an agent queried during an incident, the audit trail is there.
For teams running agents in production against live Sentry data, Merge Agent Handler removes the credential overhead and adds the security controls that matter at scale.
Why connect Sentry to Claude Code?
Sentry is where your production errors live. Claude Code is where you fix them. The gap between those two environments is the context switch that slows down every debugging session.
With the Sentry MCP connected, Claude Code can retrieve issue lists, read full stack traces, and check error status without leaving the terminal. That means you can describe a bug to Claude, have it pull the relevant Sentry events, and start reasoning about the root cause in a single session. Engineers debugging regressions can ask Claude to compare recent errors against a specific release, identify the spike, and trace it to a file, all without opening a browser.
.avif)


.png)

.png)