.agents/docs/SENTRY_MCP_SETUP.md
This guide explains how to enable the Sentry MCP server for Claude Code, Cursor, and other MCP-compatible clients so you can query Sentry issues, events, and stack traces from your agent without leaving the IDE.
The Sentry server is wired into .agents/mcp.json and uses a User Auth Token loaded from .env.local — same pattern as the GitHub, Jira, and Slack MCPs in this repo.
"Sentry": {
"command": "npx",
"args": ["-y", "@sentry/mcp-server@latest"],
"envFile": "${workspaceFolder}/.env.local"
}
opik-mcp-local).org:readproject:readteam:readevent:write (required by some MCP calls; does not allow event deletion)project:write and team:write only if you want write actions (resolve issues, comment, assign). Read-only is recommended..env.localIf you don't have .env.local yet, copy .env.template:
cp .env.template .env.local
Then set the value:
SENTRY_ACCESS_TOKEN=your-user-auth-token-here
.env.local is gitignored — do not commit it.
make claude
This regenerates .claude/ and .mcp.json. The convert script reads .env.local and inlines values into the Sentry block of .mcp.json (same as the Jira MCP). Verify:
jq '.mcpServers.Sentry.env | has("SENTRY_ACCESS_TOKEN")' .mcp.json
# → true
If you rotate the token later, update .env.local and re-run make claude.
Restart Claude Code (or Cursor, etc.) so it loads the new MCP server.
Ask the agent something like:
List recent Sentry issues for opik-python-sdk in the comet-or org.
You should see it call a Sentry tool and return results.
The official Sentry MCP exposes (non-exhaustive):
find_organizations, find_projects, find_releases, find_teams, get_sentry_resource, get_issue_tag_values, get_replay_details, whoami*:write scopes): update_issue (resolve / assign / ignore)The Sentry MCP exposes three "search" tools — search_issues, search_events, search_issue_events — and one analysis tool, analyze_issue_with_seer. All of them route through Sentry's own OpenAI account for natural-language → Sentry query translation, and that account is frequently rate-limited (You exceeded your current quota). Treat them as best-effort; do not build workflows around them.
Direct, non-LLM tools that always work:
get_sentry_resource, get_issue_tag_values, find_organizations, find_projects, find_releases, find_teams, whoami, update_issue.
When you need to enumerate events inside an issue (the direct tools fetch a single resource but cannot paginate events), call Sentry's REST API directly using the same SENTRY_ACCESS_TOKEN. The /analyze-sentry-issue slash command (defined in ../commands/comet/analyze-sentry-issue.md) drives this — paginates /api/0/issues/<id>/events/ and aggregates by exception message, tags, and users.
If you point at a self-hosted Sentry, add SENTRY_HOST=sentry.example.com (no scheme) to .env.local. For plain-HTTP self-hosted deployments, append --insecure-http to the args array in .agents/mcp.json.
If you don't want to manage a personal token, you can run the official remote MCP via OAuth instead. Replace the Sentry block in .agents/mcp.json with:
"Sentry": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://mcp.sentry.dev/mcp"],
"env": {}
}
Then make claude + restart your MCP client. The first Sentry tool call opens a browser for OAuth. Tokens are cached at ~/.mcp-auth/. Note: this path won't help the /analyze-sentry-issue slash command, which still needs SENTRY_ACCESS_TOKEN in .env.local.
.agents/mcp.json is committed. Never put a token in it directly — always go through .env.local via envFile..mcp.json is gitignored (generated by make claude), but treat it as if it weren't — re-running make claude after editing .env.local is the only supported way to update it.SENTRY_ACCESS_TOKEN missing from .mcp.json after make claudejq '.mcpServers.Sentry.env | has("SENTRY_ACCESS_TOKEN")' .mcp.json
If false: confirm .env.local has the line SENTRY_ACCESS_TOKEN=... (no surrounding quotes, no leading whitespace) and re-run make claude.
make claudeConfirm both files are in sync:
jq '.mcpServers | keys' .agents/mcp.json
jq '.mcpServers | keys' .mcp.json
Restart Claude Code after make claude — it only loads MCP servers at startup.
make claude after editing .env.local.rm -rf ~/.mcp-auth
Then trigger a Sentry tool call again to start a fresh OAuth flow.