How to Install the Sentry MCP with Claude Code (2026)
A. Frans
Published June 8, 2026
Table of Contents
- 01What the Sentry MCP actually gives you
- 02Step 1: Decide between the hosted and local server
- 03Step 2: Add the hosted server to Claude Code
- 04Step 3: Set up the local server (only if you skipped the hosted one)
- 05Step 4: Verify the connection works
- 06Step 5: Use it on a real bug
- 07A note on security and scope
- 08Frequently asked questions
A production error fires at 2am. By the time you're at your desk, you're juggling three tabs: the Sentry dashboard to read the stack trace, your editor to find the code, and a chat window to think out loud. The context lives in three places and your brain has to be the glue.
The Sentry MCP server removes one of those tabs. It gives Claude Code a live connection to your Sentry account, so instead of you reading the error and describing it to the agent, the agent reads it directly (the stack trace, the affected releases, the user count, the breadcrumbs) and goes straight to "here's the line that's failing and here's the fix." This guide walks through installing it, connecting it safely, and using it on real bugs.
What the Sentry MCP actually gives you
Before the setup, it helps to know what you're wiring up. With the connection live, Claude Code can pull issues from your Sentry projects, read full stack traces and event details, see which release introduced a regression, and check how many users an error touched. Sentry also exposes Seer, its AI debugging agent, through the same connection, so Claude can ask for a root-cause analysis and bring that into your session.
The practical result: you stop copy-pasting error JSON into chat. You ask "what's the most common error in the checkout service this week?" and the agent queries Sentry, ranks the issues, and starts on the worst one with the actual trace in front of it.
| Capability | Without the MCP | With the MCP |
|---|---|---|
| Reading an error | Copy-paste stack trace into chat | Agent pulls it directly |
| Finding the worst bug | Scan the dashboard yourself | Ask the agent to rank issues |
| Root-cause analysis | Read and reason manually | Agent calls Seer and reads the result |
| Linking error to code | You map it by hand | Agent ties the trace to the file |
Step 1: Decide between the hosted and local server
Sentry offers two ways to connect, and the choice matters for security.
Hosted (remote) server is the easy path. Sentry runs the MCP server at its own endpoint and you authenticate through OAuth in your browser, so there's no token to manage, and you always get the latest version. This is the right default for most people.
Local (stdio) server runs on your machine via npx and authenticates with an access token you generate. Choose this if your security policy forbids browser-based OAuth flows, or you need to pin a specific version. It's more control and more responsibility.
For most developers, start hosted. You can always switch later.
Step 2: Add the hosted server to Claude Code
Open a terminal and run the claude mcp add command pointing at Sentry's hosted endpoint:
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
Then start Claude Code and trigger the authentication. Type /mcp inside Claude Code to see your MCP servers, select Sentry, and follow the OAuth prompt. It opens your browser, you log into Sentry, you approve the connection, and you're back. Claude Code stores the resulting credentials for you.
If you'd rather scope the config to a single project rather than your whole machine, add --scope project to the command, which writes the server into a .mcp.json file in your current repo. That's the cleaner choice for a work project you don't want bleeding into your personal setup.
Step 3: Set up the local server (only if you skipped the hosted one)
If your policy needs the local route, first generate an auth token in Sentry: go to your organization settings, open Auth Tokens, and create one with the scopes you need. Read access to issues and events is enough for debugging, and you should not grant more than that.
Then add the server with the token passed as an environment variable rather than typed inline:
claude mcp add sentry \
--env SENTRY_ACCESS_TOKEN=your_token_here \
--env SENTRY_HOST=sentry.io \
-- npx -y @sentry/mcp-server@latest
Keep that token out of any file you might commit. The safest pattern is to store it in your shell's secret manager or a .env file that's already in .gitignore, and reference it. Never paste the raw token into a config that lives in source control. A leaked Sentry token can read your error data, which often contains snippets of real user activity.
Step 4: Verify the connection works
Don't assume it's wired up. Check it. Start Claude Code and run /mcp; Sentry should show as connected. Then ask something concrete that forces a real query:
> "List the five most frequent unresolved issues in my Sentry project from the last 7 days."
If the agent comes back with actual issue titles, counts, and the projects they came from, you're connected. If it says it can't reach Sentry or asks you to paste the errors, recheck the auth step. Usually the OAuth approval didn't complete, or the local token is missing a scope.
Step 5: Use it on a real bug
This is where it earns its place. A few prompts that work well once you're connected:
For triage, ask the agent to rank what's actually on fire: "Which error is affecting the most users right now, and what's the stack trace?" It pulls the issue, reads the trace, and tells you where to look first instead of you eyeballing a dashboard.
For root cause, lean on Seer through the connection: "Run a root-cause analysis on the top issue and summarize the likely fix." You get Sentry's AI analysis surfaced inside the same session where you'll write the patch.
For regressions, tie the error to a release: "Which release introduced this error, and what changed?" That narrows a hunt that would otherwise mean scrolling through commits.
The workflow that clicks for most people: the agent identifies the issue from Sentry, reads the trace, finds the matching code in your repo, proposes a fix, and you review it. Three tabs collapse into one conversation.
A note on security and scope
The Sentry MCP reads data that can be sensitive. Error events sometimes carry user IDs, request payloads, and other fragments of real activity. Treat the connection with that in mind. Use read-only scopes unless you have a specific reason to let the agent resolve or modify issues. Prefer the hosted OAuth flow, which avoids long-lived tokens sitting on disk. And if you go local, rotate the token periodically and revoke it the moment a laptop goes missing.
For broader context on choosing and securing these connections, our roundup of the best MCP tools and platforms compares the major servers side by side.
Frequently asked questions
What's the difference between the Sentry MCP and just using the Sentry dashboard? The dashboard is for you to read; the MCP is for your agent to read. With the dashboard you spot an error, then describe it to Claude Code in your own words and hope you captured the right details. With the MCP, the agent queries Sentry itself, gets the complete trace and metadata, and starts debugging from the actual data. You still use the dashboard for monitoring; the MCP just removes the copy-paste step when you're fixing something.
Do I need a paid Sentry plan to use the MCP? No. The MCP server works with Sentry's free tier, since it's reading the same issue and event data your account already collects. You'll hit the normal free-plan limits on event volume and retention, but the connection itself doesn't cost extra. Larger teams on paid plans get more history for the agent to query, which helps with regression hunting, but it's not required to start.
Is it safe to connect Claude Code to my production Sentry? Reasonably, if you scope it right. Use read-only access so the agent can investigate but not change issue states, prefer the hosted OAuth flow over a local token, and remember that error data can contain user information, so treat the session like you'd treat the dashboard itself. The risk isn't reading errors; it's granting write scopes you don't need or leaving a broad token on disk. Keep both tight.
Why does the agent say it can't reach Sentry after I installed it? Almost always an auth problem. For the hosted server, the OAuth approval in the browser didn't finish. Run /mcp, select Sentry, and complete the flow again. For the local server, the access token is missing or lacks the right scope; regenerate it with issue and event read permissions and confirm the environment variable is actually set in the shell Claude Code runs in. A quick /mcp status check tells you which side is broken.
Can I use the Sentry MCP alongside other MCP servers? Yes, and most people do. Running the Sentry MCP next to the GitHub MCP and the Supabase MCP gives the agent error data, your code, and your database in one session, so it can trace a bug from the Sentry event to the offending code to the data that triggered it. Each server is scoped independently, so add only the ones you need and authenticate each separately.
Share this article
⚙Related Tools
📄Related Articles
Get More AI Tool Guides
New comparisons and guides every week. Join thousands of professionals staying ahead of the AI curve.