Skip to main content
RapidDev - Software Development Agency
mcp-tutorial

How to use the Sentry MCP server for error tracking

The Sentry MCP server connects your AI assistant to your Sentry error tracking account so it can search for issues, view error details, analyze stack traces, and help debug production errors — all through natural language. It authenticates via OAuth or API token and gives your AI real-time access to your application's error data. Ask your AI to find the most frequent errors, trace a specific bug, or suggest fixes based on stack traces and breadcrumbs.

What you'll learn

  • How to install and configure the Sentry MCP server
  • How to authenticate with Sentry using OAuth or API tokens
  • How to search issues, view stack traces, and analyze errors through AI
  • How to use the server to accelerate debugging production errors
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate7 min read15 minutesClaude Desktop, Cursor, Windsurf, VS Code (Copilot)March 2026RapidDev Engineering Team
TL;DR

The Sentry MCP server connects your AI assistant to your Sentry error tracking account so it can search for issues, view error details, analyze stack traces, and help debug production errors — all through natural language. It authenticates via OAuth or API token and gives your AI real-time access to your application's error data. Ask your AI to find the most frequent errors, trace a specific bug, or suggest fixes based on stack traces and breadcrumbs.

Debug Production Errors with AI-Powered Sentry Access

The Sentry MCP server gives your AI assistant direct access to your Sentry error tracking data. Instead of manually browsing the Sentry dashboard, you can ask your AI to find the most impactful errors, analyze stack traces, look at breadcrumbs and context, and suggest fixes. The server supports both OAuth authentication (for multi-user setups) and API token authentication (for individual use). It exposes tools to search issues, view error details, list projects, and explore event data — turning your AI into a debugging partner that can cross-reference errors with your codebase.

Prerequisites

  • A Sentry account with at least one project
  • A Sentry API token (auth token) or OAuth app credentials
  • Node.js 18 or later installed on your machine
  • Claude Desktop, Cursor, or another MCP-compatible AI host

Step-by-step guide

1

Create a Sentry API token

Log into sentry.io and go to Settings > Developer Settings > Auth Tokens (or Settings > Account > API > Auth Tokens for personal tokens). Create a new token with the scopes: project:read, org:read, event:read, and issue:read at minimum. If you want the AI to resolve or assign issues, also add issue:write. Copy the token — Sentry will only show it once.

typescript
1Required token scopes:
2- org:read List organizations and teams
3- project:read List projects
4- issue:read Search and view issues
5- event:read View error events and stack traces
6
7Optional scopes:
8- issue:write Resolve, assign, or update issues
9- member:read View team member information

Expected result: You have a Sentry auth token with the required scopes.

2

Add the Sentry MCP server to your configuration

Open your MCP host's configuration file and add a sentry entry. The Sentry auth token is passed as an environment variable. The configuration uses npx with the -y flag for automatic installation.

typescript
1{
2 "mcpServers": {
3 "sentry": {
4 "command": "npx",
5 "args": [
6 "-y",
7 "@sentry/mcp-server-sentry"
8 ],
9 "env": {
10 "SENTRY_AUTH_TOKEN": "sntrys_your_token_here"
11 }
12 }
13 }
14}

Expected result: Your configuration file contains the Sentry MCP server entry with your auth token.

3

Restart your AI host and verify the connection

Fully quit and reopen Claude Desktop, Cursor, or VS Code. The Sentry MCP server will authenticate with your account and expose tools for searching issues, viewing events, and listing projects. Verify the connection by checking the tools list.

Expected result: The Sentry MCP server shows as connected with error tracking tools available.

4

List projects and search for issues

Start by asking the AI to list your Sentry projects and show recent issues. This confirms the connection works and gives you an overview of your error landscape. The AI can filter issues by status, frequency, first/last seen dates, and assigned team.

typescript
1Example prompts:
2
3"List all my Sentry projects and their error counts"
4
5"Show me the top 10 unresolved issues in the frontend-app project, sorted by frequency"
6
7"Search for issues related to 'TypeError' in the last 7 days"

Expected result: The AI returns project listings and issue searches from your Sentry account.

5

Analyze stack traces and error details

The real power comes from deep error analysis. Ask the AI to examine specific issues — view the stack trace, read the breadcrumbs (user actions leading to the error), check tags and context, and look at affected users. The AI can then suggest fixes based on the error data, especially when combined with your codebase through the filesystem MCP server.

typescript
1Example prompts:
2
3"Show me the full stack trace for issue PROJ-1234 and explain what's causing it"
4
5"What are the breadcrumbs leading up to the most frequent error in my project?"
6
7"Analyze the latest 5 events for the 'Cannot read property of undefined' issue and find the common pattern"

Expected result: The AI provides detailed error analysis with stack traces, breadcrumbs, and suggested fixes.

6

Configure for VS Code with the servers key

For VS Code with GitHub Copilot, use the servers key instead of mcpServers. Create a .vscode/mcp.json file in your workspace root.

typescript
1{
2 "servers": {
3 "sentry": {
4 "command": "npx",
5 "args": [
6 "-y",
7 "@sentry/mcp-server-sentry"
8 ],
9 "env": {
10 "SENTRY_AUTH_TOKEN": "sntrys_your_token_here"
11 }
12 }
13 }
14}

Expected result: VS Code recognizes the Sentry MCP server and Copilot can access your error tracking data.

Complete working example

claude_desktop_config.json
1{
2 "mcpServers": {
3 "sentry": {
4 "command": "npx",
5 "args": [
6 "-y",
7 "@sentry/mcp-server-sentry"
8 ],
9 "env": {
10 "SENTRY_AUTH_TOKEN": "sntrys_your_token_here"
11 }
12 }
13 }
14}
15
16// VS Code variant (.vscode/mcp.json):
17// {
18// "servers": {
19// "sentry": {
20// "command": "npx",
21// "args": ["-y", "@sentry/mcp-server-sentry"],
22// "env": {
23// "SENTRY_AUTH_TOKEN": "sntrys_your_token_here"
24// }
25// }
26// }
27// }
28
29// Get your token at:
30// sentry.io > Settings > Auth Tokens
31
32// Required scopes: org:read, project:read, issue:read, event:read
33// Optional: issue:write (to resolve/assign issues)
34
35// Available tools:
36// - list_projects: List all Sentry projects
37// - search_issues: Search issues with filters
38// - get_issue: Get detailed issue information
39// - get_issue_events: View error events and stack traces
40// - get_event_details: Full event data with breadcrumbs
41// - resolve_issue: Mark an issue as resolved
42// - assign_issue: Assign an issue to a team member

Common mistakes when using the Sentry MCP server for error tracking

Why it's a problem: Creating a token without the event:read scope

How to avoid: Without event:read, the AI can see issue titles but cannot access stack traces, breadcrumbs, or event details. Always include event:read for meaningful error analysis.

Why it's a problem: Using a project-scoped token instead of an organization token

How to avoid: Project-scoped tokens only see one project. For the MCP server to list all projects and search across them, use an organization-level auth token.

Why it's a problem: Committing the Sentry auth token to version control

How to avoid: Sentry tokens grant access to your error data which may contain sensitive information (user data, request payloads). Add your MCP config file to .gitignore and rotate the token if it is exposed.

Why it's a problem: Not combining Sentry with the filesystem server for maximum debugging power

How to avoid: The Sentry server shows errors and stack traces, but without access to your code, the AI cannot suggest specific fixes. Add the filesystem MCP server pointing at your project so the AI can cross-reference stack traces with actual source code.

Best practices

  • Combine Sentry MCP with filesystem MCP so the AI can cross-reference errors with your source code
  • Start by listing top unresolved issues to focus on the highest-impact errors
  • Ask the AI to analyze patterns across multiple events rather than single occurrences
  • Use minimal token scopes — only add issue:write if you want the AI to resolve or assign issues
  • Rotate your Sentry auth token periodically and update the MCP config
  • Use the AI to triage errors — ask it to categorize issues by severity and component
  • Check breadcrumbs for user action context, not just the stack trace
  • Keep your Sentry token out of version control and shared configurations

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I want to set up the Sentry MCP server so my AI assistant can help me debug production errors. Walk me through creating a Sentry auth token, configuring the server in Claude Desktop, and analyzing my most critical issues.

MCP Prompt

Show me the top 5 unresolved issues in my project sorted by event count, then pick the most frequent one, analyze its stack trace, and suggest a code fix based on the error pattern and breadcrumbs.

Frequently asked questions

Can the AI access the full request payload and user data from Sentry events?

Yes, if your Sentry project captures that data and your token has event:read scope. Be aware that error events may contain sensitive user information, request bodies, and headers. The AI processes this data in your conversation context.

Can the AI automatically resolve issues in Sentry?

Only if your token includes the issue:write scope. With that scope, the AI can mark issues as resolved, assign them to team members, and update their status. Without issue:write, the server is read-only.

Does this work with self-hosted Sentry?

Yes. If you run a self-hosted Sentry instance, you may need to set a SENTRY_URL environment variable pointing to your instance URL (e.g., https://sentry.your-company.com). Check the server documentation for the exact variable name.

How many API calls does the Sentry MCP server make?

Each tool call results in one or more Sentry API requests. Sentry's API has rate limits (varies by plan). Normal interactive use through MCP is unlikely to hit rate limits, but avoid asking the AI to iterate through thousands of issues in rapid succession.

Can the AI fix the errors it finds?

The AI can analyze errors, identify root causes, and suggest code fixes. If you also have the filesystem MCP server configured, it can directly edit your source code to apply the fix. If you also have the GitHub MCP server, it can create a PR with the fix.

Can RapidDev help set up an AI-powered error triage pipeline?

Yes. RapidDev can help you build an automated workflow that uses the Sentry MCP server to triage errors, correlate them with code changes via GitHub, suggest fixes, and route critical issues to the right team members — all powered by AI.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.