Cursor is an AI-native code editor built on VS Code that deeply integrates AI assistance through its Composer and Agent Mode features. When you connect Sentry MCP to Cursor, you get a workflow where production error data from Sentry flows directly into the editor context alongside your source files — and Cursor's Agent Mode can read the error, find the relevant code, and apply a fix without you leaving the editor.
This topic covers the full setup, practical debugging workflows, how to use Agent Mode to apply Sentry-driven fixes, and an honest assessment of when Cursor's approach isn't the right tool for the job.
Connecting Sentry MCP to Cursor Agent Mode
Cursor reads MCP server configuration from JSON files. You have two scopes:
- Global:
~/.cursor/mcp.json— available in all Cursor projects on your machine. - Project:
.cursor/mcp.jsonin your project root — scoped to that project.
Global configuration
Create or edit ~/.cursor/mcp.json:
{
"mcpServers": {
"sentry": {
"url": "https://mcp.sentry.dev/mcp",
"headers": {
"Authorization": "Bearer YOUR_SENTRY_AUTH_TOKEN"
}
}
}
}
Project configuration (recommended when different projects use different Sentry orgs)
Create .cursor/mcp.json in your project root:
{
"mcpServers": {
"sentry": {
"url": "https://mcp.sentry.dev/mcp",
"headers": {
"Authorization": "Bearer ${SENTRY_AUTH_TOKEN}"
}
}
}
}
Use an environment variable reference for the token and commit the config file to version control — no secrets are stored in the file.
Enabling Agent mode in Cursor
- Open Cursor and open a project.
- Open the AI chat panel (Cmd+L / Ctrl+L).
- Switch from "Chat" to "Agent" mode using the dropdown in the chat panel header.
- Confirm that MCP tools are available: check the tool list icon in the agent panel. You should see the Sentry MCP tools listed.
Verifying the setup
In Cursor Agent mode, type:
List the top 5 unresolved Sentry issues in my organization
Tips
- If Sentry tools don't appear in Agent mode after adding the config, restart Cursor — MCP config changes require a full restart.
- Use the project-level config for different Sentry orgs per project.
- Never commit amcp.jsonfile containing a hardcoded auth token — use environment variable references or your OS keychain.
Pulling Sentry Issues into Cursor for In-Context Code Debugging
Cursor's Agent Mode has simultaneous access to your MCP tools and your codebase. This means when it reads a Sentry stack trace, it can immediately open the referenced source files — no copy/paste, no manual navigation.
Start with issue triage:
Use Sentry to list the 5 highest-frequency unresolved issues in the "orders-service" project. Show me issue ID, error type, event count, and the culprit function.
Pull a specific issue and correlate with local code:
Get Sentry issue ORDERS-7731. Find the source file and function mentioned in the stack trace in this project. Open it and show me the relevant code.
Cursor will call the Sentry MCP, extract the file path and line number from the stack trace, and use its built-in file navigation to locate and display the code.
Full event detail with breadcrumbs:
Get the latest event for Sentry issue ORDERS-7731. Show me the full breadcrumb sequence, the request context, and the user who triggered it. Then open the source files referenced in the stack trace.
Investigating a trace across services:
I have a distributed trace ID: "f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6". Get the Sentry trace. Identify which service and span contains the error. Then find the relevant source code in this workspace for that service.
Querying by release to find regressions:
Get all Sentry issues in project "checkout" with firstSeen after our last deploy (2026-05-06 12:00 UTC). For each issue, check if the affected file exists in this workspace and open the relevant function.
Tips
- Cursor's file search is indexed — it finds files by path very quickly even in large monorepos. Ask the agent to "search for the fileOrderRepository.tsin this workspace" if the Sentry stack trace contains a relative path.
- Use the@filesyntax in Cursor Composer to manually add context: type@src/services/payment.tsto bring a file into scope before asking the agent to investigate a related Sentry issue.
- When Sentry events contain minified or transpiled stack frames (common in frontend JavaScript), ask the agent: "The stack trace shows minified code. Does this project have source maps? Check for.mapfiles near the output directory."
- Cursor's Agent Mode shows its tool calls in real time. Watch the tool call log to see exactly which Sentry API calls it makes — this helps you understand how to write better prompts.
Using Cursor Agent Mode to Propose and Apply Code Fixes
The most powerful Sentry MCP workflow in Cursor is having the agent go from "here is the Sentry issue" to "here is the fix applied to your code" in a single Agent Mode session. This works because Agent Mode can call MCP tools to get data and then use Cursor's code editing capabilities to apply changes.
Full fix workflow — single prompt:
Get Sentry issue API-2903. Read the stack trace. Find the relevant source files in this project. Diagnose the root cause. Propose a fix and apply it to the code. Also write a unit test that would have caught this bug.
Agent Mode will:
1. Call sentry_get_issue and sentry_get_event via MCP
2. Read the stack trace and identify the file and line
3. Open the local source file
4. Reason about the root cause
5. Generate a code change and apply it via Cursor's editor
6. Write a test file
Fix proposal with diff review (recommended for production changes):
Get Sentry issue PAYMENT-1182. Diagnose the root cause and propose a fix as a diff. Do NOT apply the change yet — show me the proposed diff and explain your reasoning first.
Review the proposed diff in the Agent Mode response, then:
The fix looks correct. Apply it to the file and also update the CHANGELOG.md to note the fix for this bug.
Multi-issue batch fix for related bugs:
Get Sentry issues ORDERS-800, ORDERS-801, and ORDERS-802. Are they related? If they share a root cause in the same file, propose a single fix that addresses all three. Apply the fix.
Fix with backward compatibility check:
Get Sentry issue DB-991. The fix involves changing the function signature of `UserRepository.findById()`. Before applying, check all callers of this function in the codebase and make sure the fix won't break them.
Testing the fix path:
After applying the fix for ORDERS-7731, run the existing test suite for the orders module using "npm test -- --testPathPattern=orders". Report whether the tests pass.
Tips
- Always use the "propose diff first" pattern for production hotfixes. Agent Mode can apply changes quickly but the speed makes it easy to approve changes without careful review.
- Ask the agent to add a comment near the fix referencing the Sentry issue ID:// Fix for Sentry issue ORDERS-7731: null check on order.items. This creates a permanent audit trail in the code.
- UseCmd+Zimmediately if an applied fix is wrong — Cursor's undo history is preserved even after Agent Mode edits.
- For large refactors, ask the agent to create a new branch first: "Before applying this fix, rungit checkout -b fix/sentry-orders-7731in the terminal." Agent Mode has terminal access and will execute this.
Limitations and When Cursor Is Not the Best Tool for Sentry Debugging
Cursor with Sentry MCP is powerful, but there are scenarios where it's the wrong tool or where you'll hit clear limitations.
Context window limits in large projects. Cursor's Agent Mode has a context window limit. In a large monorepo, when the agent tries to hold Sentry event data, multiple source files, test files, and conversation history simultaneously, it may start truncating earlier context. Symptoms: the agent "forgets" the Sentry data mid-investigation or produces fixes that don't match what was described earlier.
Mitigation:
No real-time Sentry alerting integration. Cursor doesn't have a built-in webhook receiver or background listener. Sentry MCP in Cursor is always pull-based — you must initiate the investigation. If you want to be notified when a new critical error fires and have it immediately open in Cursor, that workflow doesn't exist natively. Use Sentry's own alert notifications (Slack, PagerDuty) to trigger the investigation, then bring the issue ID to Cursor.
Frontend source maps. If your frontend errors in Sentry show minified stack traces (e.g., bundle.js:1:45721), Cursor cannot locate the original source without source maps. Check your build config:
webpack --config webpack.config.js
build: {
sourcemap: true // generates .map files
}
If source maps aren't available, raw Sentry stack traces for frontend code will be unusable for in-editor navigation.
Multi-repo stack traces. If your Sentry stack trace spans multiple repositories (microservices architecture), Cursor can only navigate to source files within the currently open workspace. Files from other services require opening those repos in a separate Cursor window.
No Sentry write access via MCP. The @sentry/mcp-server is read-only. Cursor's agent cannot mark issues as resolved, assign them, or add comments via MCP. For workflow closure, use the Sentry API directly:
curl -X PUT \
-H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "resolved"}' \
"https://sentry.io/api/0/issues/7731/"
curl -X PUT \
-H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"assignedTo": "username"}' \
"https://sentry.io/api/0/issues/7731/"
When to use CLI tools instead: If you're doing batch triage (reviewing 20+ issues, generating a sprint report from Sentry data, comparing error trends across releases), the Claude Code CLI or Gemini CLI are better choices. Cursor's UI is optimized for single-issue, code-editing workflows — not bulk data analysis. Use the right tool for the task.
Tips
- For the best experience, keep one source file open and visible before starting an Agent Mode session for a specific Sentry issue. It primes the context window with the right code.
- If Agent Mode is slow or stalls on MCP tool calls, check the Cursor Output panel for MCP server errors. The most common issue is a network timeout reachinghttps://mcp.sentry.dev/mcp— verify your connection and retry.
- Commit your source files before starting a fix session. If Agent Mode makes multiple changes and you want to revert,git checkout .is faster and more reliable than Ctrl+Z through many edits.
- Cursor's.cursorignorefile (similar to.gitignore) controls which files the agent indexes. If your build output contains transpiled files that confuse the agent when it tries to match Sentry stack frame paths, add those directories to.cursorignore.