# Auto-Fix Sentry User Feedback with Cursor Automations

> Set up a Cursor Automation that triggers when Sentry user feedback is assigned, investigates the issue using Sentry MCP, and opens a PR with a proposed fix.

**URL:** https://sentry.io/cookbook/fix-user-feedback-with-cursor-agents/

---

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

**Time:** 20–30 minutes | **Difficulty:** Intermediate

## What You'll Learn

- Configured the Sentry User Feedback widget to collect structured feedback

- Connected Sentry MCP to Cursor for in-agent issue access

- Created a Cursor Automation that responds to Sentry issue assignment

- Wrote agent instructions that triage feedback and open a fix PR

**Topics:** Sentry MCP, User Feedback

## Before you start

**SDKs & packages**

- [Sentry SDK](https://docs.sentry.io/platforms/) installed in your app

**Accounts & access**

- [Sentry account](https://sentry.io/signup/) with a project set up

- [Cursor Pro or Business](https://www.cursor.com/pricing) subscription (required for Automations)

**Knowledge**

- Basic familiarity with your app's codebase and repo structure

## Steps

### 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.

```javascript
import * as Sentry from "@sentry/browser";

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

[User Feedback setup guide](https://docs.sentry.io/product/user-feedback/setup/)

### 2. Add the Sentry MCP to your automation

The Sentry MCP server gives your Cursor agent direct access to your Sentry issues, feedback, and debugging context. You add and authenticate it from within the automation's Tools section on cursor.com/automations — it isn't configured in the Cursor desktop app.

- Go to [cursor.com/automations](https://cursor.com/automations) and click **New automation** (you'll finish configuring it in Step 4)

- In the **Tools** section, click **+ Add Tool or MCP**

- Expand **MCP Server** and click **+ New Connection**

- In the **Browse MCPs** dialog, search for `Sentry` and select the Sentry plugin to add it

- Back in **Tools**, click **Authenticate** on the Sentry row to launch the Sentry OAuth consent screen

- On the *Cursor is requesting access to Sentry* screen, enable at minimum **Inspect Issues & Events** (to read feedback and issue details) and **Triage Issues** (so the agent can comment on the Sentry issue), then click **Approve**

[Sentry MCP Server docs](https://mcp.sentry.dev/)

### 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.

```markdown
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. Configure the trigger and launch the automation

Cursor Automations are background agents that fire automatically based on a trigger. Back in the automation you started in Step 2 on [cursor.com/automations](https://cursor.com/automations), wire up the Sentry trigger, paste your instructions, and launch it. Sentry's available triggers are **Issue created**, **Issue updated**, and **Any issue event** — assignments come through as issue updates, so you'll use **Issue updated** and let the agent's instructions filter for the assignment case.

- Name the automation (e.g. "Fix User Feedback")

- Under **Triggers**, add **Issue updated** → select your Sentry project

- Confirm **Tools** has **Sentry** (from Step 2), and add **Open Pull Request**

- Paste your instructions from Step 3 into the **Instructions** field

- Keep **Environment** set to *Cursor Cloud* so the agent runs without your machine being on

- Click **Create** to launch the automation

[Cursor Automations docs](https://cursor.com/docs/cloud-agent/automations#sentry-triggers)

### 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](https://sentry.io/orgredirect/organizations/:orgslug/issues/feedback/)

- Assign the feedback issue to any team member

- In your newly created automation, switch to the **Run History** tab at the top to watch the agent spin up

### 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

## Summary

**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.

## 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](https://sentry.io/orgredirect/organizations/:orgslug/monitors/alerts/) to automatically assign incoming User Feedback issues to a team. This way the automation fires without any manual triage step.

## Common Pitfalls

- Forgetting to approve the right OAuth scopes when authenticating Sentry in Step 2. Without **Inspect Issues & Events**, the agent can't read the feedback details; without **Triage Issues**, it can't comment back on the Sentry issue.

- 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, **Issue updated** trigger, and Cursor agent response all need to be verified together.

## FAQ

**Does this work with any Sentry SDK, or only JavaScript?**

The User Feedback widget is available for JavaScript/browser SDKs. For mobile or backend SDKs, you can use the [User Feedback API](https://docs.sentry.io/api/projects/submit-user-feedback/) to submit feedback programmatically and it will still appear as an assignable issue in Sentry.

**Do I need a paid Cursor plan?**

Yes. Cursor Automations and Background Agents require a Cursor Pro or Business subscription. Check [Cursor's pricing page](https://www.cursor.com/pricing) for the latest plan details.

**What happens if the agent opens a bad PR?**

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.

**Can I trigger the automation on other Sentry issue types, not just User Feedback?**

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.

**Is there a cost for using the Sentry MCP server?**

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.

## Next Steps

- [product/user-feedback](https://sentry.io/product/user-feedback/)

- [product/seer](https://sentry.io/product/seer/)

- [Cursor Background Agents](https://docs.cursor.com/background-agent): Learn how Cursor Background Agents work, how they access your repo, and how to iterate on their output.

- [Cursor Automations](https://cursor.com/docs/cloud-agent/automations#sentry-triggers): Configure Cursor Automations with Sentry triggers to fire agents on issue assignment, new issues, and more.

---

*Source: [sentry.io/cookbook/fix-user-feedback-with-cursor-agents/](https://sentry.io/cookbook/fix-user-feedback-with-cursor-agents/)*
