Sentry MCP: pull an error into an agent session
Connect Sentry's MCP server to Claude Code, Cursor or VS Code, then have the agent read an error and fix it against event data. Setup steps and pitfalls.
Updated · Markdown version
Sentry's MCP server lets a coding agent query your Sentry account, so the agent can read an error's details while it edits code instead of you pasting a stack trace into the chat. This guide covers choosing between the hosted and local server, connecting either one to a client, and a workflow that turns a Sentry issue into a fix backed by event data.
Choose the hosted or local server
Both options expose the same Sentry data to your agent. They differ in where the connection lives and how credentials are handled.
| Feature | Hosted (mcp.sentry.dev) | Local (Sentry CLI, stdio) |
|---|---|---|
| Endpoint or command | https://mcp.sentry.dev/mcp | sentry mcp |
| Authentication | OAuth on first connection | sentry auth login, no token in client config |
| Scoping | Organization or project in the URL path | Target argument such as my-org/my-project |
| Self-hosted Sentry | Not covered on the hosted page | sentry auth login --url and SENTRY_HOST |
Choose the hosted server when your client supports HTTP MCP and you want no local install. Choose the local server when you need self-hosted Sentry or want credentials kept out of the client config.
Connect the hosted server
- Pick a scope. Replace
{organizationSlug}and{projectSlug}with your values. The Sentry page recommends a project-scoped URL, and a scoped URL hides some discovery tools. - In Claude Code, run:
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp/my-org/my-project - In Cursor, add this under
mcpServersin the MCP settings:"sentry": { "url": "https://mcp.sentry.dev/mcp/my-org/my-project" } - Complete the OAuth prompt that opens on first use. Authorize the Sentry account that can see the project.
- Check the connection: ask the agent to list unresolved issues in the project, then open one of the returned IDs in the Sentry web interface and confirm the title matches.
Connect the local server
- Install the CLI:
curl https://cli.sentry.dev/install -fsS | bash - Log in:
sentry auth login - Register the server with Claude Code:
claude mcp add sentry -- sentry mcp - To limit access to one project, register
sentry mcp my-org/my-projectinstead. - For self-hosted Sentry, run
sentry auth login --url https://sentry.example.com, then setSENTRY_HOSTin the server's environment. - Check the connection with the same issue-listing request as above. Run
sentry mcp --helpto see all flags.
Turn an error into a fix
- Give the agent an issue ID or a short search, such as the exception class and the module name. A stack trace pasted from memory may not match the current release.
- Ask the agent to read the issue's recent events and note the release, the environment and the first in-app frame. Use the tool names your session lists, because the README does not name every tool.
- Reproduce the error locally with a failing test before changing code.
- Apply the fix and rerun the test. The test should fail before the change and pass after it.
- Check the result against Sentry: after the fix ships, the issue should stop receiving new events in the next release.
Pitfalls
- Wrong project. An unscoped URL exposes every project in the organization, and the agent may read a similar error from another service. Notice it by a stack trace that names unfamiliar modules. Fix it by using the project-scoped URL.
- Search tools missing. The four search tools need an LLM provider configured on the server. If they are absent from the tool list, the provider is probably unset. Check the server's README for the variable names; this guide does not list them.
- Empty results after login. An account that can authorize the server may still lack access to the project. Notice it when every query returns nothing. Fix it by checking the account's Sentry role, since the page does not state the OAuth scope.
- A single event treated as the bug. One event can come from a bad deploy or a client-side retry. Notice it when the event's release is old. Fix it by comparing several events across releases before editing code.
- Token in version control. The remote configuration shows a bearer token header. Keep it in an environment variable and out of a committed
.mcp.jsonfile.
When to use a skill instead
A plain prompt that says "fix this Sentry error" leaves the agent free to skip reproduction, so MCP data can turn into a guess. Pair the data with systematic-debugging, which has the agent reproduce the failure, narrow the cause and write a failing test before it edits anything. If one project floods you with hundreds of events, log-error-clustering sorts them into distinct signatures with counts, which helps you pick the issue worth loading into the session. Neither skill replaces the MCP connection; they decide what the agent does with the data it reads.
FAQ
What is an MCP server? It is a small service that makes a system's data and actions callable by an AI client. The Sentry server is the one that hands your Sentry issues and events to a coding agent.
What does MCP stand for? MCP stands for Model Context Protocol. The protocol is open source and defines how AI applications reach outside systems.
What is MCP in AI? In AI tools, MCP is the connection layer between a model-based assistant and outside systems such as databases, search services and issue trackers. It works like a standard port that different clients and servers can share.
Related skills in this catalog
Platform Score is our assessment under a published method. It is not a safety guarantee.
Related guides
Sources
- https://mcp.sentry.dev/ (accessed 2026-11-21)
- https://github.com/getsentry/sentry-mcp (accessed 2026-11-21)
- https://modelcontextprotocol.io/docs/getting-started/intro (accessed 2026-11-21)
This page is not offered to search engines yet: The content file does not mark this page indexable yet.