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.
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
- ▸Go to your Sentry Settings → Auth Tokens.
- ▸Click Create New Token.
- ▸Grant the following scopes:
project:read,event:read,issue:read. If you want the agent to auto-resolve issues, includeissue:write. - ▸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/).
{
"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
backendproject."
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 Foundfor every tool call, double-check yourSENTRY_ORGenvironment 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:
codex mcp add --name sentry --command "npx -y @modelcontextprotocol/server-sentry" --env SENTRY_AUTH_TOKEN=your_tokenFor a full list of recommended servers, see Best MCP Servers for OpenAI Codex.
Related Guides
How to Build a Custom MCP Server from Scratch
Learn how to create your own MCP server using the TypeScript or Python SDK. Expose custom tools and resources for AI agents to use.
Dev ToolsHow to Use the Puppeteer MCP Server for Web Scraping & Automation
Automate web browsers using the Puppeteer MCP server. Navigate websites, take screenshots, extract data, and automate web interactions through AI.
Dev ToolsHow to Use the Git MCP Server for Version Control Operations
Manage local Git repositories through AI agents. Clone repos, create branches, make commits, and view diffs using the Git MCP server.