Dev Tools·
intermediate
·11 min read·Apr 4, 2026

How to Set Up the Sentry MCP Server for Error Monitoring

Connect Sentry to your AI agent for intelligent error analysis. Triage issues, analyze stack traces, and get fix suggestions through MCP.

Sentryerror monitoringdebuggingobservabilityissues

How to Set Up the Sentry MCP Server for Error Monitoring

The Sentry MCP server lets AI agents securely access your error monitoring data. By granting your agent access to Sentry, it can act as a senior debugging partner—performing intelligent issue triage, analyzing complex stack traces, identifying regressions, and suggesting code fixes before you even open your IDE.

Prerequisites

  • A Sentry account with project-level access.
  • A Sentry Auth Token generated specifically for the agent.
  • Node.js 18+ installed on your host.

Getting a Sentry Auth Token

  1. Go to your Sentry Settings → Auth Tokens.
  2. Click Create New Token.
  3. Grant the following scopes: project:read, event:read, issue:read. If you want the agent to auto-resolve issues, include issue:write.
  4. Copy the generated token immediately.

Configuration

Update your MCP client config. Ensure your SENTRY_ORG matches the slug found in your Sentry URL (e.g., sentry.io/organizations/your-organization-slug/).

json
{
  "mcpServers": {
    "sentry": {
      "command": "npx",
      "args": ["-y", "mcp-server-sentry"],
      "env": {
        "SENTRY_AUTH_TOKEN": "sntrys_your_token_here",
        "SENTRY_ORG": "your-organization-slug"
      }
    }
  }
}

Available Tools

  • list_projects — List available Sentry projects.
  • list_issues — Get issues with filters (status, priority).
  • get_issue_details — Fetch detailed information about a specific issue.
  • get_issue_events — View individual error events.
  • resolve_issue — Mark issues as resolved.
  • search_issues — Full-text semantic search across issues.

Example Workflows

  • Morning Triage: "Show me all unresolved critical issues from the last 24 hours across all projects."
  • Root Cause Analysis: "Get the details and stack trace for issue PROJ-1234 and suggest potential code fixes."
  • Release Verification: "Compare error rates before and after yesterday's deployment of the backend project."

Best Practices & Troubleshooting

  • Tool Synergies: Combine Sentry with the GitHub MCP server. The AI can read the Sentry error, map the stack trace to the exact line in your GitHub repo, and generate a pull request to fix it automatically!
  • Invalid Org Slug: If the server starts but returns 404 Not Found for every tool call, double-check your SENTRY_ORG environment variable.
  • Quota Limits: Sentry API tokens are subject to rate limiting. If your agent executes a loop to analyze hundreds of issues, it may trigger a 429 Too Many Requests. Instruct your agent to limit analyses to the top 5 most frequent issues.

Using with OpenAI Codex

You can use this MCP server with the OpenAI Codex CLI by adding it to your configuration:

bash
codex mcp add --name sentry --command "npx -y @modelcontextprotocol/server-sentry" --env SENTRY_AUTH_TOKEN=your_token

For a full list of recommended servers, see Best MCP Servers for OpenAI Codex.

Related Guides