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.

FeatureHosted (mcp.sentry.dev)Local (Sentry CLI, stdio)
Endpoint or commandhttps://mcp.sentry.dev/mcpsentry mcp
AuthenticationOAuth on first connectionsentry auth login, no token in client config
ScopingOrganization or project in the URL pathTarget argument such as my-org/my-project
Self-hosted SentryNot covered on the hosted pagesentry 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

  1. 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.
  2. In Claude Code, run: claude mcp add --transport http sentry https://mcp.sentry.dev/mcp/my-org/my-project
  3. In Cursor, add this under mcpServers in the MCP settings: "sentry": { "url": "https://mcp.sentry.dev/mcp/my-org/my-project" }
  4. Complete the OAuth prompt that opens on first use. Authorize the Sentry account that can see the project.
  5. 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

  1. Install the CLI: curl https://cli.sentry.dev/install -fsS | bash
  2. Log in: sentry auth login
  3. Register the server with Claude Code: claude mcp add sentry -- sentry mcp
  4. To limit access to one project, register sentry mcp my-org/my-project instead.
  5. For self-hosted Sentry, run sentry auth login --url https://sentry.example.com, then set SENTRY_HOST in the server's environment.
  6. Check the connection with the same issue-listing request as above. Run sentry mcp --help to see all flags.

Turn an error into a fix

  1. 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.
  2. 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.
  3. Reproduce the error locally with a failing test before changing code.
  4. Apply the fix and rerun the test. The test should fail before the change and pass after it.
  5. 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.json file.

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.

Platform Score is our assessment under a published method. It is not a safety guarantee.

Next steps

  1. Chrome DevTools MCP: Debug a Live Page Through an Agent Read next.
  2. Debug an MCP Server with MCP Inspector Read next.
  3. All guides by topic Browse everything.

Sources

This page is not offered to search engines yet: The content file does not mark this page indexable yet.