← Back to Cookbook

Auto-Triage and Fix User Feedback with Cursor Automations and Sentry MCP

Trigger a Cursor agent the moment user feedback is assigned in Sentry. It reads the issue, finds the relevant code, and opens a PR.

Features
Category Workflow
Time
20–30 minutes
Difficulty
Intermediate
Steps
6 steps

Before you start

SDKs & packages
Accounts & access
Knowledge
  • Basic familiarity with your app's codebase and repo structure

1
Add the User Feedback widget to your app

Sentry's User Feedback widget gives users a simple way to report problems directly from your UI. When submitted, feedback appears as an issue in your Sentry project, complete with session context, tags, and optional replay links. Add the widget using the Sentry SDK's feedbackIntegration. Configure it to match your app's look and feel, and it will attach automatically to your Sentry initialization.

User Feedback setup guide
import * as Sentry from "@sentry/browser";

Sentry.init({
  dsn: "your-dsn-here",
  integrations: [
    Sentry.feedbackIntegration({
      colorScheme: "system",
      showBranding: false,
    }),
  ],
});

2
Connect the Sentry MCP to Cursor

The Sentry MCP server gives Cursor agents direct access to your Sentry issues, feedback, and debugging context. Once connected, the @Sentry tool will be available in all your Cursor agents.

  • Visit mcp.sentry.dev and click Install in Cursor to configure the MCP server automatically
  • Or add it manually in Cursor SettingsMCP using the server URL https://mcp.sentry.dev/mcp
  • Authenticate with a Sentry auth token that has project:read and issue:read scopes
Sentry MCP Server docs
The mcp.sentry.dev page showing the MCP server URL and an Install in Cursor button

3
Write the agent instructions

Agent instructions are the prompt your Cursor Automation runs with. They tell the agent what to do when the trigger fires: fetch the feedback from Sentry, find the relevant code, and attempt a fix. Copy the template below and adjust the bracketed placeholders for your project. You'll paste this into the Instructions field in the next step.

You are a user feedback analyst for [your-app]. You run when a Sentry User Feedback issue is assigned in the "[project]" project.

## Step 1: Gather context from Sentry

Use @Sentry MCP to fetch the assigned issue. Extract:
- The feedback message
- The page or feature the user was interacting with (from tags/context)
- Any additional context (browser, session replay link)
- Only proceed if the issue is a User Feedback type issue

## Step 2: Identify and read the relevant code

Map the feedback to a file or component in the repo:
- Use the page URL, feature name, or error context as clues
- Search the codebase if the mapping isn't obvious

Read the relevant files to understand what the user experienced.

## Step 3: Assess and fix

Determine if you can fix this with a code change. You CAN fix it if:
- It's a UI bug, copy error, or behavioral issue you can identify in the code
- You've read the relevant files and know exactly what to change
- No unverifiable assumptions are needed
- The fix is scoped to 1–3 files

If you can't fix it confidently, skip to Step 5.

## Step 4: Open a PR

- Branch: feedback/<short-description>
- Minimal edits only — match surrounding code style
- PR title: fix: <what changed> (under 70 chars)
- PR body: summarize the user feedback and what you changed

## Step 5: Comment on the Sentry issue

Use @Sentry MCP to add a comment on the issue with:
- A link to the PR (if opened)
- OR what needs changing and why it needs a human

## Rules

- Be conservative — prefer commenting in Sentry over opening a speculative PR
- Never add features or refactor surrounding code
- Scope every change to exactly what the feedback describes

4
Create a Cursor Automation

Cursor Automations are background agents that fire automatically based on a trigger, like a Sentry issue being assigned.

  • In Cursor, open the Automations tab
  • Click New Automation and give it a name (e.g. "Fix User Feedback")
  • Under Triggers, add: *Issue assigned* → select your Sentry project
  • Under Tools, enable @Sentry MCP and Open Pull Request
  • Paste your instructions from Step 3 into the Instructions field
  • Set Environment to *Cursor Cloud* so the agent runs without your machine being on
Cursor Automation settings showing an Issue assigned trigger for a Sentry project, with Memories, Slack, Open Pull Request, and Sentry tools enabled, running on Cursor Cloud

5
Trigger the automation with a real feedback issue

With the automation live, test it end-to-end. The agent will fetch the issue context from Sentry, read the relevant code, and either open a PR or leave a comment explaining why it passed.

  • Submit feedback through your app's User Feedback widget
  • In Sentry, navigate to Issues → User Feedback
  • Assign the feedback issue to any team member
  • Switch to Cursor and open AutomationsRun History to watch the agent spin up
The Sentry User Feedback widget open on a demo app, showing a Report a Bug form with name, email, description, and screenshot fields

6
Review the agent's output

When the agent opens a PR, treat it like any other code review. For feedback the agent couldn't fix, the Sentry issue comment will explain what it found and why it passed, giving your team a head start on triaging manually.

  • Check the diff to confirm the change matches the feedback description
  • Read the PR body: the agent should explain what feedback it addressed and what it changed
  • Run your test suite before merging
  • If the fix is wrong or too broad, close the PR and tighten the agent instructions

That's it.

Your agent handles the first response.

When user feedback lands in Sentry and gets assigned, a Cursor agent investigates the root cause and opens a draft PR, so your team reviews fixes, not raw complaints.

  • Configured the Sentry User Feedback widget to collect structured feedback
  • Connected Sentry MCP to Cursor for in-agent issue access
  • Created a Cursor Automation triggered by Sentry issue assignment
  • Wrote agent instructions that triage feedback and open a fix PR

Pro tips

  • 💡 Scope your Sentry project trigger narrowly: create one automation per project so each agent has the right codebase context and instructions.
  • 💡 Add a validation step at the top of your instructions that checks the issue type first. If it's not User Feedback, the agent should exit early rather than wasting a run on an unrelated issue.
  • 💡 Include a brief map of your repo structure or key component directories in the agent instructions so it knows where to look without searching the entire codebase on every run.
  • 💡 Use Sentry's Alert Rules to automatically assign incoming User Feedback issues to a team. This way the automation fires without any manual triage step.

Common pitfalls

  • ⚠️ Forgetting to grant the Sentry auth token both project:read and issue:read scopes. The agent will fail to fetch issue details and may produce no output or a misleading error.
  • ⚠️ Writing agent instructions that are too broad, or not scoping the trigger to User Feedback issues. The agent will spin up for every assignment in the project and make speculative changes. Add explicit rules about what issue types it should handle and what it is and isn't allowed to touch.
  • ⚠️ Not testing the full end-to-end flow before relying on the automation. The widget submission, Sentry issue creation, assignment trigger, and Cursor agent response all need to be verified together.

Frequently asked questions

The User Feedback widget is available for JavaScript/browser SDKs. For mobile or backend SDKs, you can use the User Feedback API to submit feedback programmatically and it will still appear as an assignable issue in Sentry.
Yes. Cursor Automations and Background Agents require a Cursor Pro or Business subscription. Check Cursor's pricing page for the latest plan details.
Close it and leave a comment explaining what was wrong. This helps you refine your agent instructions over time. Adding a rule like "if in doubt, comment on the Sentry issue instead of opening a PR" makes the agent more conservative by default.
Yes. You can change the Cursor Automation trigger to fire on any Sentry issue assignment: error issues, performance issues, or cron failures. Adjust the agent instructions to match the issue type you want to handle.
The Sentry MCP server is free to use and doesn't count against your Sentry event quota. It only reads data you already have in Sentry.

Fix it, don't observe it.

Get started with the only application monitoring platform that empowers developers to fix application problems without compromising on velocity.