How to connect to the Sentry MCP with Claude Code (5 steps)
.png)
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 acts as a secure bridge between Claude Code and Sentry's API. When you configure a Tool Pack and Registered User, Merge generates a unique MCP URL that Claude Code accesses via HTTP, combined with an API key for authentication.
Here's how the command looks before you add your specific MCP URL and API key:
Claude Code sends requests to that MCP URL, and Merge handles authentication and API calls to Sentry on the backend. You don't manage Sentry auth tokens locally or wire credentials into your codebase. Merge handles token storage from here on.
Prerequisites
Before getting started, you'll need the following:
- A Merge Agent Handler account
- Claude Code installed (run claude --version to confirm)
- A Sentry account with access to the projects you want to monitor
Related: A guide to integrating Supabase MCP with Claude Code
1. Create a Tool Pack
Log into Merge Agent Handler and navigate to Tool Packs. Click Create Tool Pack and give it a name tied to the use case, like "Sentry error monitor."

Under connectors, select Sentry. You can then choose which tools to enable.

For most debugging workflows, enabling issue search, issue detail retrieval, and event listing covers the common cases. Enable write tools if you want your agent to resolve or assign issues directly.
Save the Tool Pack. You'll return here in step 4 to copy your MCP URL.
2. Add a Registered User
Inside your Tool Pack, create a Registered User. This is the account your agent acts on behalf of when calling Sentry's API.

Give it a name that maps to your environment, like <code class="blog_inline-code">dev-local</code> or your own name. Once created, Merge generates a unique MCP URL scoped to this user.
3. Authenticate Sentry
From the Registered User detail page, click Add Connector and select Sentry.

Complete the authentication flow to grant your agent access to the Sentry organizations and projects you want to connect. Once authenticated, Merge stores and manages the credentials. You won't need to re-authenticate unless you revoke access.
4. Gather your credentials
You need two things before configuring Claude Code:
1. MCP URL: found on the Tool Pack detail page under the Registered User you just created. It looks soemthing like this: <code class="blog_inline-code">https://ah-api.merge.dev/api/v1/tool-packs/{TOOL_PACK_ID}/registered-users/{REGISTERED_USER_ID}/mcp</code>
2. API key: found in Settings > API Keys in your Merge Agent Handler dashboard. Create one if you don't have one yet.
Keep both handy for the next step.
5. Configure Claude Code with Sentry
Run the following command in your terminal, substituting your actual MCP URL and API key:
Verify the connection registered: <code class="blog_inline-code">claude mcp list</code>
<code class="blog_inline-code">agent-handler</code> should appear in the output with a connected status.
To confirm the connector is accessible, open a Claude Code session and run something like: "Show me the 5 most recent unresolved errors in the production environment and summarize the stack trace for the most critical one."
You should 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.
.png)



.png)