Blog

October 28, 2026

Build an AI support agent that triages Sentry errors

Connect AgentStack and Sentry to Claude Code over MCP, so one prompt matches every new support ticket to its Sentry issue, leaves an internal note and drafts the reply.

Claude CodeMCPSentrySupport inbox

A customer writes in: "the export button does nothing." Somebody on your team copies that into Sentry, finds the matching error, pastes the stack trace into Claude Code, and then goes back to write to the customer. That person is a relay, a "meat proxy" between the support inbox and the error tracker.

This guide removes the relay. You will connect AgentStack: AI support agents and Sentry to Claude Code through their MCP servers. Then one prompt takes every new support ticket, finds the Sentry issue behind it, writes up what it found as an internal note, and drafts the reply for you to approve.

What you need

  • An AgentStack workspace on the Standard plan or higher. The support Inbox and the ticket tools are not available on Free or Hobby (pricing).
  • A Sentry account with access to your project.
  • Claude Code installed.

Step 1: Let your AgentStack agent open tickets

The AgentStack agent answers customers from your own docs. When it can't solve something, such as a bug, it should hand the conversation to a person by opening a ticket in the Inbox.

  1. Sign up and create an agent.
  2. Add your docs or help-center URL as a source. Indexing runs in the background.
  3. Open the agent's Human Handoff card → Configure → Open a ticket in the Inbox. Optionally pick a default team. If that team auto-assigns new tickets (round-robin or least-loaded), change the prompt's view from "unassigned" to "my_teams" in Step 4. In When should the AI trigger this?, describe when to hand off, for example:
Hand the conversation to a person when the customer reports something that looks
like a bug: an error message, a button or page that does not work, data that is
missing or wrong, or a crash. Before handing off, ask for the page URL, roughly
when it happened, and the email on their account.

Asking for the time and the account email up front matters. Those are the two things you will match against Sentry in Step 4.

Details: Escalate to Inbox, AI and human handoff.

Step 2: Connect AgentStack to Claude Code

AgentStack runs a Streamable HTTP MCP server at https://www.agentstack.build/api/mcp, with OAuth sign-in. You don't need an API key for it. In fact, the MCP endpoint refuses REST API keys.

For triage you only need the Inbox (plus the organization tools, to check which workspace you're in), so connect a narrow version that mounts only those two toolsets:

claude mcp add --transport http agentstack https://www.agentstack.build/api/mcp/x/inbox,organizations -s user

(The full server is https://www.agentstack.build/api/mcp. The dashboard's MCP Server screen has the current snippet for each client. Prefer that snippet if it differs from this one.)

Start Claude Code, run /mcp, and finish the browser sign-in. Approve the scopes on the consent screen:

ScopeWhat it allows here
mcp:readlist_tickets, get_ticket, get_ticket_thread, find_tickets
mcp:writeadd_ticket_note, assign_ticket, change_ticket_status, close_ticket
mcp:sendreply_to_ticket, a real message to the customer. It is not in the default grant.

The tools act on your active organization, and every response echoes organization.id and slug. Check that first:

Call get_current_organization on agentstack and tell me which org I'm in.

If reply_to_ticket is refused later, your sign-in did not grant mcp:send. Keep replies as notes (Step 5) and send them from the Inbox yourself.

Reference: MCP server, MCP scopes.

Step 3: Connect Sentry to Claude Code

Sentry runs its own hosted MCP server with OAuth (mcp.sentry.dev):

claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

Sentry's page also shows a form scoped to one project, https://mcp.sentry.dev/mcp/{organizationSlug}/{projectSlug}, which keeps the agent from searching the wrong project. Sentry's tool list changes over time, so the prompts below describe what to do in plain words instead of naming Sentry tools.

Step 4: The triage prompt

Save this as .claude/commands/triage-support.md in your app's repo, so /triage-support runs it:

Triage new bug reports from the AgentStack support inbox against Sentry.

1. On agentstack: call get_current_organization and confirm the org is <your-org-slug>.
   Stop if it is not.
2. Call list_tickets with view "unassigned" and status "new".
3. For each ticket, call get_ticket and get_ticket_thread. If the thread already
   has a note that starts with "Sentry triage:", skip that ticket. Otherwise
   extract: what the customer did, the page URL, the time, the account email,
   any error text.
4. In Sentry, search the project for unresolved issues that match: same page or
   route, error text, a user with that email, and events near that time.
5. Rate the match: STRONG (same user or same error text within the time window),
   POSSIBLE, or NONE.
6. Call add_ticket_note on agentstack. Start the note with "Sentry triage:" and include:
   - Sentry issue link(s) and the rating
   - first-seen / last-seen, event count, and whether this user is in it
   - the top stack frame, and the file in THIS repo it points to
   - a one-paragraph likely cause, or "no matching error found"
   - a draft customer reply (plain language, no stack traces, no promises of dates)
7. If the customer still owes us details, say which ones in the note.
8. Do NOT call reply_to_ticket, close_ticket or change_ticket_status.
   Do not edit code. Finish with a table: ticket id, subject, Sentry match, rating.

Run it in Claude Code:

/triage-support

add_ticket_note writes an internal note that the customer never sees, so a run can't reach a customer. Adding a note doesn't change the ticket's status, so the prompt skips tickets that already carry a Sentry triage: note. Otherwise every run would note them again.

Step 5: Review, then reply

Open the ticket in the AgentStack Inbox. The note has the Sentry link, the suspected file and a drafted reply. You then choose one of three paths:

  • Need more info. Edit the draft and send it from the Inbox. The ticket moves to on_customer on its own.
  • Real bug. Assign the ticket to yourself and fix it (next step).
  • Not a bug. Reply with the answer and close the ticket. Resolving a ticket lets the AI agent answer that customer's new messages again.

To let Claude Code send the reply instead, approve mcp:send and say so explicitly:

Send the drafted reply on ticket <ticketId> with reply_to_ticket, exactly as written
in the latest note.

Step 6: Fix, and close the loop

Assign the ticket, then ask for the fix in the same session, where the Sentry context is already loaded:

For ticket <ticketId>: reproduce the Sentry issue <issue-link> locally, write a
failing test, fix it on a new branch, and open a PR. Then add_ticket_note with the
PR link. Don't reply to the customer yet.

When the fix ships, tell the customer and close the ticket:

Ticket <ticketId>: the fix is deployed. Draft a short reply telling the customer it's fixed
and what changed for them. Show me the draft before sending.

Optional: run it on a schedule

Claude Code can run a command without a session. From your repo's directory (so it finds .claude/commands):

claude -p "/triage-support" --allowedTools "mcp__agentstack__get_current_organization,mcp__agentstack__list_tickets,mcp__agentstack__get_ticket,mcp__agentstack__get_ticket_thread,mcp__agentstack__add_ticket_note,mcp__sentry"

Put that in cron or CI and the triage notes are waiting when you open the Inbox. We have not tested this headless setup end to end, so keep two cautions in mind:

  • AgentStack's docs say MCP OAuth is meant for interactive clients and recommend REST API keys (/api/v1/inbox/tickets…) for unattended services. Check that Claude Code's stored sign-in still works in a headless job before you rely on it.
  • The command allows only the AgentStack tools the triage needs: reading tickets and adding internal notes. A ticket is text from a stranger, so an unattended run must not be able to reply, close, reassign or change a ticket's status. A person approves what the customer sees. Sentry's server is allowed as a whole; if your Sentry connection can change issues, list only its read tools instead.

Recap

The AgentStack agent answers what your docs cover and turns bug reports into tickets. Claude Code reads those tickets over MCP, matches each one to a Sentry issue, and leaves you a note with a draft reply. You make one decision per ticket instead of copying text between three tabs.

Start with AgentStack →