All posts

Let Claude Code triage your production errors: setting up Bugsly's MCP in 5 minutes

Swap the DSN in @sentry/nextjs, connect Claude Code, Cursor or Claude Desktop over MCP, and ask for a triage. Every step marked tested or untested.

TL;DR

  • Two changes get you there: swap the DSN your @sentry/nextjs app reports to, and add Bugsly's MCP server to your AI client. Claude Code needs one command: claude mcp add bugsly -e BUGSLY_TOKEN=... -- npx -y @bugsly/mcp-server.
  • The server exposes 16 tools. Twelve only read; resolve_issue and ignore_issue are marked destructive; create_project and get_checkout_url change state without being destructive.
  • On 2026-11-18 I ran the install and connection steps for Claude Code (a stdio server that connects, and a hosted server that asks for sign-in) and the server's own test suite (13 of 13 pass). I did not run a triage against live data or test Cursor or Claude Desktop; each step below is marked tested or untested.

We build Bugsly, a hosted error tracker that accepts Sentry SDK events. This post is the shortest path from "errors are piling up" to "my coding agent has read the top one".

What you need

  • Node.js 18.17 or newer (the engines field of @bugsly/mcp-server).
  • A Bugsly account and a project. New projects show their DSN in the dashboard under /setup.
  • An app that already uses the Sentry SDK, or five minutes to add it. This guide uses Next.js.
  • An MCP client: Claude Code, Cursor or Claude Desktop.

Step 1: send errors to Bugsly (the DSN swap)

A DSN is a URL that tells the SDK where to send events. Bugsly's has the form https://<public_key>@bugsly.dev/<project_id> (the format is documented in Bugsly's test-event.ts and on the migration page). If your app already runs @sentry/nextjs, change only the value:

# .env.local  (the variable name is whatever your Sentry.init reads)
NEXT_PUBLIC_SENTRY_DSN=https://<public_key>@bugsly.dev/<project_id>
// instrumentation-client.ts  (unchanged apart from where the DSN points)
import * as Sentry from "@sentry/nextjs";

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  tracesSampleRate: 0.2,
});
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;

That is how Bugsly's own dashboard is wired: frontend/instrumentation-client.ts imports @sentry/nextjs and reads NEXT_PUBLIC_SENTRY_DSN, and it runs @sentry/nextjs ^10.68.0. I have not tested v11 (npm's latest is 11.14.0 today). Source maps go through sentry-cli with SENTRY_URL=https://bugsly.dev; the migration guide has the commands.

Starting without Sentry? The setup page offers npm install @bugsly/nextjs, which wraps @sentry/nextjs, and an "Ask your AI" tab with a prompt that lets your agent work out your framework itself.

To prove events arrive, throw one on purpose, for example a route that does throw new Error("Hello from Bugsly!"), and open it. Then check the issue in the dashboard. Untested by me: sending an event writes to a production project, which I did not do for this post.

Step 2: create a token

In Bugsly open your project, then Settings → AI Agent / MCP → Generate Token. The token starts with bgs_, lasts 90 days, acts as your user in every organization you belong to, and can be revoked on the same page. It is shown once; Bugsly stores only a hash.

Prefer no token? The hosted server uses OAuth instead (see the Claude Code step below).

Step 3: connect your client

Claude Code (tested)

claude mcp add bugsly -e BUGSLY_TOKEN=YOUR_BUGSLY_TOKEN -- npx -y @bugsly/mcp-server
claude mcp list

What I saw on 2026-11-18, Claude Code 2.1.322, in a throwaway home directory with a placeholder token:

Added stdio MCP server bugsly with command: npx -y @bugsly/mcp-server to local config
...
bugsly: npx -y @bugsly/mcp-server - ✔ Connected

✔ Connected proves the package downloads, starts and speaks MCP. It does not prove the token is valid; a bad one fails later, when a tool calls the API. The command saves the server for the current project; add --scope user for all projects.

The hosted alternative needs no install and no token in a file:

claude mcp add --transport http bugsly https://bugsly.dev/api/mcp

Then run /mcp inside Claude Code and sign in. Before signing in, claude mcp list showed bugsly-remote: https://bugsly.dev/api/mcp (HTTP) - ! Needs authentication, which is correct. A plain curl -X POST https://bugsly.dev/api/mcp returns HTTP 401 with a WWW-Authenticate header pointing at the OAuth metadata. The OAuth sign-in itself is untested (it needs a browser and a real account). If you would rather send a token to the hosted endpoint, add --header "Authorization: Bearer YOUR_BUGSLY_TOKEN"; with a fake value I got Failed to connect ... HTTP 401 ... invalid_token, so a wrong token is reported clearly.

To share the config with your team, use .mcp.json and keep the token out of git:

{
  "mcpServers": {
    "bugsly": {
      "command": "npx",
      "args": ["-y", "@bugsly/mcp-server"],
      "env": { "BUGSLY_TOKEN": "${BUGSLY_TOKEN}" }
    }
  }
}

In my test Claude Code listed this server as Pending approval (run claude to approve): project-scoped servers need a one-time approval. I did not go further.

Cursor (untested)

~/.cursor/mcp.json for all projects, or .cursor/mcp.json for one:

{
  "mcpServers": {
    "bugsly": {
      "command": "npx",
      "args": ["-y", "@bugsly/mcp-server"],
      "env": { "BUGSLY_TOKEN": "YOUR_BUGSLY_TOKEN" }
    }
  }
}

Claude Desktop (untested)

Settings → Developer → Edit Config opens claude_desktop_config.json (~/Library/Application Support/Claude/ on macOS, %APPDATA%\Claude\ on Windows). Paste the same block as for Cursor and restart the app.

The Cursor and Claude Desktop snippets come from the package's README and are the same JSON as the Claude Code .mcp.json entry, which Claude Code recognised. I did not open either app.

Step 4: ask for a triage

Start with questions that cannot change anything. This prompt is on Bugsly's own MCP page:

Use Bugsly to read the most frequent unresolved issue, find the failing line in this repository, and propose a fix. Do not change the issue's status.

Behind it the agent should call, in this order (arguments from backend/app/mcp/tools.json):

StepToolArgumentsWhy
1list_projectsnoneFind your project ID. Returns the DSN too, which can only send events.
2list_issuesproject_id, status: "unresolved", sort: "event_count"The noisiest open issue first. sort also takes last_seen and first_seen.
3get_issue_eventsissue_id, limit (default 5, max 20)Stack traces and breadcrumbs for the latest occurrences.
4resolve_issueissue_idOnly after you merge the fix. Reported again as a regression if the error recurs.

Bugsly does not write the patch. Your agent reads the stack trace and the code in your repository; you review the diff. In my manual triage of our 12 largest issues, about one fifth of the error volume needed only a code change (see the 16-apps post); the rest needed config or infrastructure. That was not an agent run, and I have not measured an agent's fix rate.

All 16 tools, grouped by what they can do to your data:

GroupTools
Read-only (12)list_projects, list_issues, get_issue, get_issue_events, search_errors, get_project_stats, get_usage, get_crash_free, list_monitors, get_monitor, list_uptime_monitors, get_uptime_status
Destructive hint (2)resolve_issue, ignore_issue (change status for everyone on the project; reversible in the dashboard)
Changes state (2)create_project, get_checkout_url (a link to the billing page; no checkout is created)

Keep the agent on a short leash

Error events are text written by your users and by anyone who knows your DSN. A hostile string in an error message could try to instruct your agent. The package's README says tools that return event text wrap it in <untrusted_event_data> tags, cap it at 60,000 characters, drop user email, IP, username and extra data from get_issue_events, hash the user ID and strip query strings from request URLs, and that the server tells the agent to ask before it resolves, ignores or creates anything. I read that in the code and the passing test suite; I did not attack it.

Practical rules: leave resolve_issue and ignore_issue behind your client's confirmation prompt and revoke tokens you stop using. The hosted server limits each user to 60 tool calls a minute.

Frequently asked questions

Does this work with Cursor and Claude Desktop, not just Claude Code?

The server is a standard stdio MCP server, so any client that can launch npx -y @bugsly/mcp-server with an environment variable should work. Claude Code is the only client I tested.

Do I need to replace @sentry/nextjs?

No. Bugsly accepts Sentry SDK envelopes, so you change the DSN and keep the SDK. Compatibility is a subset, not everything: Bugsly has no SSO or SAML, no minidump ingestion and no history import from Sentry. Sentry is a trademark of its owner; Bugsly is not affiliated with or endorsed by Sentry.

Hosted OAuth or a local token: which one?

The hosted server lets you revoke access without handling a secret file. The local package runs on your machine over stdio and works in clients that cannot call a URL. Both read the same tool definition, so they expose the same 16 tools.

What does it cost?

I am not quoting limits here because they change; see bugsly.dev/pricing. If an organization has no active plan or trial, the API answers HTTP 402 with the code trial_required, and the repository's README tells agents not to retry but to tell you.

My token stopped working. What now?

Tokens expire after 90 days. Create a new one in Settings → AI Agent / MCP and update BUGSLY_TOKEN.

Can the agent create projects or change my billing?

It can create a project (create_project), and get_checkout_url returns a link to the billing page. Neither charges anything; a person has to accept terms on that page. There is no tool to delete projects, edit alert rules or create monitors.

Methodology and data

  • Date: 2026-11-18. Machine: macOS, Node 24, Claude Code 2.1.322, using a fresh empty HOME so no existing configuration was touched.
  • Tested: claude mcp add (stdio and HTTP, with and without --header) and claude mcp list output quoted above; an MCP tools/list handshake against the published npm package, which returned 16 tools; npm ci && npm test in the repository's mcp/ folder at origin/main 910c051 (13 tests, 13 passed, against a local stub API; no request left the machine); curl on the hosted endpoint, which returned 401.
  • Version note: the repository is at @bugsly/mcp-server 0.5.2; npm served 0.5.1 on 2026-11-18, and that is the version I connected. The tool list is identical.
  • Not tested: any call with a real token against real data, the OAuth sign-in, Cursor, Claude Desktop, a Next.js app actually sending an event to Bugsly, and @sentry/nextjs 11.
  • Sources: mcp/README.md, mcp/src/index.ts, backend/app/mcp/tools.json, frontend/src/lib/mcp-info.ts, frontend/src/components/setup/quick-start.tsx, frontend/src/lib/sentry-migration.ts and frontend/instrumentation-client.ts in the Bugsly repository.
  • Disclosure: we build and sell Bugsly. It is hosted and closed source.

Try Bugsly free, no card

Free plan, no card: 1 project, 100 new issues and 50,000 events a month, 7-day retention, 10 AI explanations a month. Paid plans from $19/month, 7-day money-back, cancel anytime.

Start free, no card

From the same team