MCP Library updated 12 min read

Sentry MCP Server: AI-Powered Error Monitoring and Debugging

Monitor and debug application errors with AI. Learn how to analyze Sentry issues, track performance, and resolve bugs using natural language.

RP

Rajesh Praharaj

Sep 13, 2025 · Updated Dec 28, 2025

Sentry MCP Server: AI-Powered Error Monitoring and Debugging

TL;DR - Sentry MCP Quick Start

Debug application errors with AI - Analyze issues and stack traces with natural language.

🆕 2025: Sentry MCP now integrates with Seer AI for 95% accurate root cause analysis and Autofix for automatic code fix suggestions! For an introduction to MCP, see the MCP Introduction guide.

Quick Setup:

{
  "mcpServers": {
    "sentry": {
      "command": "npx",
      "args": ["-y", "@anthropic/mcp-server-sentry"],
      "env": {
        "SENTRY_AUTH_TOKEN": "your-sentry-token",
        "SENTRY_ORGANIZATION": "your-org-slug"
      }
    }
  }
}

What you can do:

  • 🐛 Issues: List and analyze errors
  • 📊 Trends: Track error frequency
  • 🔍 Debug: Analyze stack traces
  • Performance: Monitor transactions
  • 📈 Stats: Error counts and metrics

Example conversation:

You: What are the top unresolved issues in our API project?

Claude: Here are the top unresolved issues:

        | Issue | Events | Users | First Seen |
        |-------|--------|-------|------------|
        | TimeoutError: DB query | 234 | 45 | 2 days ago |
        | TypeError: null ptr | 89 | 23 | 1 week ago |
        | ValidationError | 56 | 12 | 3 days ago |
        
        The TimeoutError is most impactful. Want me to 
        analyze the stack trace?

🔑 Get your token at sentry.io/settings/account/api/auth-tokens

🤖 Remote hosting available: Sentry now offers hosted MCP servers - or deploy locally for full control.


Why Sentry + AI?

Error debugging becomes a conversation:

Traditional ApproachWith Sentry MCP
Search through issues manually”Show critical issues from today”
Analyze stack traces line-by-line”Explain why this error occurs”
Correlate errors manually”What changed when errors spiked?”
Write queries for trends”Show error trend for last week”

Use Cases

RoleHow They Use It
DevelopersDebug errors with AI analysis
SREsMonitor trends and prioritize
ManagersGet error summaries and status
SupportLink bugs to customer issues

For more on AI-assisted development, see the AI-Powered IDEs Comparison guide.

2025 AI Features

FeatureDescription
Seer AI AgentAutomated root cause analysis (95% accuracy)
AutofixAI-generated code fix suggestions (~54% success)
AI Code ReviewPre-production error prediction (beta Sept 2025)
Issue SummaryAI-generated issue explanations
Anomaly DetectionAI-powered pattern recognition

Prerequisites

1. Sentry Account

Free or paid Sentry account with at least one project.

2. API Token

Create an API token:

  1. Go to Sentry Settings
  2. Navigate to Account > API > Auth Tokens
  3. Click Create New Token
  4. Select scopes:

Read-Only Access:

  • project:read
  • org:read
  • team:read
  • event:read

Full Access (with write):

  • project:read, project:write
  • org:read
  • event:read, event:admin
  1. Create and copy the token

3. Organization Slug

Find your organization slug:

  • Your Sentry URL is: sentry.io/organizations/YOUR-ORG-SLUG/
  • Or check in Organization Settings

Installation & Configuration

Basic Setup

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "sentry": {
      "command": "npx",
      "args": ["-y", "@anthropic/mcp-server-sentry"],
      "env": {
        "SENTRY_AUTH_TOKEN": "your-token-here",
        "SENTRY_ORGANIZATION": "your-org-slug"
      }
    }
  }
}

Self-Hosted Sentry

For on-premise installations:

{
  "mcpServers": {
    "sentry": {
      "command": "npx",
      "args": ["-y", "@anthropic/mcp-server-sentry"],
      "env": {
        "SENTRY_AUTH_TOKEN": "your-token",
        "SENTRY_ORGANIZATION": "your-org",
        "SENTRY_URL": "https://sentry.yourcompany.com"
      }
    }
  }
}

Verify Installation

Restart your AI client and test:

You: List my Sentry projects

Claude: Here are your Sentry projects:

        | Project        | Platform | Issues (24h) |
        |----------------|----------|--------------|
        | frontend       | React    | 23           |
        | backend-api    | Python   | 45           |
        | mobile-app     | React Native | 12       |
        | worker-service | Node.js  | 8            |

Available Tools

Issue Management

ToolDescriptionExample Prompt
list_issuesList all issues”Show unresolved issues”
get_issueIssue details”Details of issue #123”
get_issue_eventsEvents for issue”Show recent events”
update_issueChange status”Resolve this issue”

Analysis

ToolDescriptionExample Prompt
get_eventSpecific event details”Show the latest occurrence”
get_stacktraceStack trace analysis”Analyze this stack trace”

Stats & Monitoring

ToolDescriptionExample Prompt
list_projectsAll projects”What projects do I have?”
get_project_statsError statistics”Show error counts this week”

Practical Workflows

Workflow 1: Error Triage

Prioritize and understand issues. For more on AI-powered workflows, see the AI-Powered Workflows guide.

You: Show me critical unresolved issues from the last 24 hours

Claude: Critical issues from last 24 hours:

        **High Priority (12+ events):**
        
        1. **TypeError: Cannot read property 'id' of null**
           - Project: frontend
           - Events: 156 | Users affected: 34
           - First seen: 6 hours ago
           - File: src/components/UserProfile.jsx:45
           
        2. **DBConnectionError: Connection refused**
           - Project: backend-api
           - Events: 89 | Users affected: 23  
           - First seen: 4 hours ago
           - File: services/database.py:78
           
        3. **TimeoutError: Request timeout after 30s**
           - Project: worker-service
           - Events: 45 | Users affected: 12
           - First seen: 2 hours ago
           
        **Recommendation:** 
        The TypeError is affecting the most users. 
        Want me to analyze its stack trace?

You: Yes, analyze the TypeError

Claude: Analyzing stack trace...

        **Error: Cannot read property 'id' of null**
        
        **Stack Trace:**

TypeError: Cannot read property ‘id’ of null at UserProfile (src/components/UserProfile.jsx:45) at renderWithHooks (react-dom.js:1234) at mountIndeterminateComponent (react-dom.js:5678)


**Likely Cause:**
The `user` prop is null when accessing `user.id`.

**Relevant Code (line 45):**
```jsx
const userId = user.id;  // user is null here

Recommended Fix:

const userId = user?.id;
// Or add null check:
if (!user) return <LoadingSpinner />;

Context: This started after deployment at 14:00 UTC. Possibly related to PR #234 which changed user loading.


### Workflow 2: Error Trend Analysis

Understand error patterns:

```text
You: Show me the error trend for backend-api over the last week

Claude: **Error Trend: backend-api (Last 7 Days)**

        | Date    | Total | Critical | New Issues |
        |---------|-------|----------|------------|
        | Dec 24  | 245   | 12       | 3          |
        | Dec 23  | 189   | 8        | 2          |
        | Dec 22  | 156   | 5        | 1          |
        | Dec 21  | 423   | 45       | 8          | ⚠️ Spike
        | Dec 20  | 134   | 4        | 1          |
        | Dec 19  | 128   | 3        | 0          |
        | Dec 18  | 145   | 5        | 2          |
        
        **Notable Pattern:**
        - Major spike on Dec 21 (3x normal)
        - Correlates with v2.1.0 deployment
        - Most errors were DBConnectionError
        
        **Root Cause (Dec 21):**
        Deployment introduced connection pool exhaustion.
        Fixed in v2.1.1 (Dec 22).
        
        Current error rate is back to normal.

Workflow 3: Release Health

Compare errors across releases:

You: Compare error rates between our last two releases

Claude: **Release Comparison**

        | Metric           | v2.1.0 (Dec 21) | v2.1.1 (Dec 22) |
        |------------------|-----------------|-----------------|
        | Total errors     | 423             | 189             |
        | Error rate       | 2.3%            | 0.8%            |
        | Crash-free users | 94.2%           | 98.7%           |
        | New issues       | 8               | 2               |
        
        **Top Issues Introduced in v2.1.0:**
        1. DBConnectionError - 156 events (FIXED in v2.1.1)
        2. TimeoutError - 89 events (FIXED in v2.1.1)
        3. CacheError - 34 events (Still present)
        
        **v2.1.1 Successfully Fixed:**
        - Connection pool issues
        - Timeout handling
        
        **Still Needs Attention:**
        - CacheError persists (12 events since v2.1.1)

Workflow 4: User Impact Analysis

Understand which users are affected:

You: Which errors are affecting the most users this week?

Claude: **User Impact Analysis (This Week)**

        | Error | Users Affected | % of Total | Severity |
        |-------|----------------|------------|----------|
        | Auth timeout | 234 | 4.2% | High |
        | Load failure | 156 | 2.8% | Medium |
        | API 500 error | 89 | 1.6% | High |
        | Invalid input | 45 | 0.8% | Low |
        
        **Most Impactful: Auth Timeout**
        - Affects premium users disproportionately
        - Occurs during peak hours (9-11 AM)
        - Common devices: iOS Safari
        
        **Recommendations:**
        1. Increase auth service timeout
        2. Add retry logic for auth calls
        3. Consider caching auth tokens longer

Workflow 5: Root Cause Analysis

Deep dive into specific issues:

You: Help me understand why we're getting NullPointerExceptions 
     in the payment service

Claude: Analyzing NullPointerException in payment-service...

        **Issue Overview:**
        - First seen: Dec 20, 2024
        - Total events: 178
        - Unique users: 67
        - Status: Unresolved
        
        **Stack Trace Pattern:**

NullPointerException at PaymentProcessor.processCard(PaymentProcessor.java:89) at CheckoutController.submit(CheckoutController.java:45)


**Event Analysis (sampled 50 events):**

**Common Factors:**
- 93% have `billing_address` as null
- 89% are guest checkout users
- 100% are mobile web users

**Root Cause:**
Guest checkout flow doesn't require billing address,
but `PaymentProcessor.processCard()` assumes it exists.

**Code Issue (line 89):**
```java
String country = order.getBillingAddress().getCountry();
// billingAddress is null for guests

Recommended Fix:

Address billing = order.getBillingAddress();
String country = billing != null ? 
  billing.getCountry() : order.getShippingAddress().getCountry();

Related PRs:

  • PR #456 introduced guest checkout (Dec 18)
  • Missing null check was in original code

---

## Example Prompts

### Issue Discovery

```text
# By recency
"Show issues from the last hour"
"What new errors appeared today?"
"List issues first seen this week"

# By severity
"Show critical issues in frontend"
"What are the highest-volume errors?"
"List issues affecting more than 100 users"

# By project
"Show all issues in backend-api"
"What's the error count by project?"
"Which project has the most issues?"

Analysis Requests

# Stack trace analysis
"Analyze this error's stack trace"
"What's causing the NullPointerException?"
"Explain why this crash is happening"

# Pattern analysis
"What do these errors have in common?"
"Is there a pattern to when this occurs?"
"Which releases introduced the most bugs?"

# Correlation
"Did anything change when errors spiked?"
"Is this error related to the database issues?"
"What events led to this crash?"

Status & Metrics

# Overview
"Give me an error summary for today"
"How is our error rate trending?"
"What's our crash-free user percentage?"

# Comparison
"Compare this week to last week"
"How did the latest release affect errors?"
"Which errors improved after the patch?"

Issue Management

# Updating (if write access granted)
"Mark this issue as resolved"
"Assign this issue to the backend team"
"Add a note to this issue about the fix"

# Prioritization
"What should we fix first?"
"Which issues are getting worse?"
"What's blocking our release?"

Combining with Other MCPs

Sentry + GitHub

Link errors to code:

You: Find the commit that introduced this error

Claude: [Uses Sentry to get error timeline]
        [Uses GitHub to find matching commits]
        
        Error first seen: Dec 20, 14:32 UTC
        
        Matching commits around that time:
        - abc123 (Dec 20, 14:15) - "Add guest checkout"
        - def456 (Dec 20, 14:28) - "Update payment flow"
        
        Most likely cause: def456
        View: github.com/org/repo/commit/def456

You: Create an issue for this bug

Claude: [Uses GitHub to create issue]
        
        Created Issue #789:
        "NullPointerException in PaymentProcessor for guest checkout"
        
        Includes:
        - Stack trace
        - Affected users count
        - Suggested fix
        - Link to Sentry issue

Sentry + Slack

Alert on critical issues:

You: If new critical issues appear in production, alert #on-call

Claude: Monitoring set up. Will alert #on-call when:
        - New critical issues appear
        - Error rate exceeds threshold
        - Crash-free rate drops below 99%

Sentry + Memory

Remember issue context:

You: Remember what we learned about the payment bug

Claude: [Uses Memory to store context]
        
        Stored:
        - Root cause: Null billing address for guests
        - Introduced: PR #456 (Dec 18)
        - Fix: Add null check in PaymentProcessor.java:89
        - Status: Pending fix in v2.1.2
        
        I'll reference this in future debugging sessions.

Troubleshooting

Issue: “Authentication failed”

Solutions:

CauseSolution
Invalid tokenRegenerate API token
Token expiredCheck token in settings
Wrong org slugVerify organization slug
Insufficient scopeAdd required permissions

Issue: “Project not found”

Solutions:

  • Verify project slug is correct
  • Check token has project access
  • Ensure project exists in organization

Issue: “Rate limited”

Solutions:

  • Reduce request frequency
  • Use more specific queries
  • Request rate limit increase from Sentry

Security Best Practices

Token Permissions

Use CaseRecommended Scopes
Read-onlyproject:read, org:read, event:read
With updates+ event:admin
Full accessAll scopes (use carefully)

Access Control

✅ Do❌ Don’t
Use project-specific tokensUse org-admin tokens
Limit to needed projectsGrant access to all
Audit token usageIgnore access logs
Rotate tokens regularlyKeep old tokens active

For more on AI security best practices, see the Understanding AI Safety, Ethics, and Limitations guide.


ServerComplements Sentry By…
GitHub MCPLinking errors to code
Slack MCPAlerting on issues
Memory MCPRemembering bug context
PostgreSQL MCPCorrelating with app data

Summary

Sentry MCP Server enables AI-powered error analysis:

  • Issue tracking - List and prioritize errors
  • Stack trace analysis - Understand root causes
  • Trend analysis - Track error patterns
  • Release health - Compare versions
  • User impact - Know who’s affected
  • Seer AI (2025) - Automated root cause analysis

2025 AI Features:

  • Seer AI Agent - 95% accurate root cause analysis
  • Autofix - ~54% automatic code fix success
  • AI Code Review - Pre-production error prediction
  • Issue Summary - AI-generated explanations
  • Remote MCP hosting available

Best use cases:

  • Error triage and prioritization
  • Root cause analysis
  • Release monitoring
  • Trend identification
  • User impact assessment

Security checklist:

  • ☐ Create scoped API tokens
  • ☐ Start with read-only access
  • ☐ Limit to specific projects
  • ☐ Rotate tokens periodically
  • ☐ Monitor token usage

Next: Learn about MongoDB MCP Server → for database management.


Questions about Sentry MCP? Check the Sentry API docs or Sentry’s MCP GitHub.

Was this page helpful?

Let us know if you found what you were looking for.