Skip to content

Configuration — MCP (Model Context Protocol) ​

Buggregator includes a built-in MCP server that lets AI assistants query your debugging data directly. Connect Claude Code, Cursor, or any MCP-compatible client to browse events, inspect errors, analyze profiling data, and read variable dumps — without leaving your editor.

Enabling MCP ​

MCP is disabled by default. Enable it in buggregator.yaml:

yaml
mcp:
  enabled: true

Or via environment variable:

bash
MCP_ENABLED=true

Transport Modes ​

Unix Socket (Default) ​

The server listens on a Unix domain socket. This is the recommended mode for local development.

yaml
mcp:
  enabled: true
  transport: socket
  socket_path: /tmp/buggregator-mcp.sock
VariableDefaultDescription
MCP_TRANSPORTsocketTransport type
MCP_SOCKET_PATH/tmp/buggregator-mcp.sockUnix socket path

HTTP/SSE ​

For remote access or when Unix sockets are not available, use HTTP transport:

yaml
mcp:
  enabled: true
  transport: http
  addr: ":8001"
  auth_token: my-secret-token     # Optional bearer token
VariableDefaultDescription
MCP_TRANSPORTsocketSet to http
MCP_ADDR:8001HTTP listen address
MCP_AUTH_TOKEN—Bearer token for authentication (optional)

When MCP_AUTH_TOKEN is set, all requests must include the Authorization: Bearer <token> header.

Integration with AI Assistants ​

Claude Code ​

Add to your .mcp.json or configure via Claude Code settings:

json
{
  "mcpServers": {
    "buggregator": {
      "type": "stdio",
      "command": "buggregator",
      "args": ["mcp"]
    }
  }
}

Or from the command line:

bash
claude mcp add buggregator -- buggregator mcp

The buggregator mcp subcommand bridges stdio to the running Buggregator instance via the Unix socket. command is the path to the binary: buggregator when it is on your PATH, else the full path.

Note: Make sure Buggregator is running with MCP enabled before connecting.

If Buggregator runs in Docker, you can use the HTTP transport instead:

json
{
  "mcpServers": {
    "buggregator": {
      "type": "http",
      "url": "http://localhost:8001/mcp"
    }
  }
}

Or add it from the command line:

bash
claude mcp add --transport http buggregator http://localhost:8001/mcp

With MCP_AUTH_TOKEN set, pass the token as a header:

json
{
  "mcpServers": {
    "buggregator": {
      "type": "http",
      "url": "http://localhost:8001/mcp",
      "headers": {
        "Authorization": "Bearer my-secret-token"
      }
    }
  }
}

The same from the command line:

bash
claude mcp add --transport http buggregator http://localhost:8001/mcp \
  --header "Authorization: Bearer my-secret-token"

Without the header, the server answers 401.

Cursor ​

Add the server to .cursor/mcp.json in your project (or ~/.cursor/mcp.json for all projects):

json
{
  "mcpServers": {
    "buggregator": {
      "command": "buggregator",
      "args": ["mcp"]
    }
  }
}

Over HTTP (e.g. Buggregator in Docker), use url instead; add headers when MCP_AUTH_TOKEN is set:

json
{
  "mcpServers": {
    "buggregator": {
      "url": "http://localhost:8001/mcp",
      "headers": { "Authorization": "Bearer my-secret-token" }
    }
  }
}

Docker Setup ​

When running Buggregator in Docker with MCP enabled:

yaml
services:
  buggregator:
    image: ghcr.io/buggregator/server:latest
    ports:
      - 127.0.0.1:8000:8000
      - 127.0.0.1:8001:8001    # MCP HTTP port
    environment:
      MCP_ENABLED: "true"
      MCP_TRANSPORT: http
      MCP_ADDR: ":8001"

Read-only mode ​

Since server v2.15.0. Read-only mode lets an AI agent look at your events but not change anything. The agent can read errors, dumps, profiles, mock rules and paused debug sessions. It cannot delete events, edit mock rules or step through code.

Use it when you give Buggregator to an agent that should only investigate. Example: a harnsy agent that reaches Buggregator as an MCP connection.

yaml
mcp:
  enabled: true
  read_only: true
VariableDefaultDescription
MCP_READ_ONLYfalsetrue removes every tool that changes data or drives a debug session

It works with both transports. These tools are removed:

AreaRemoved tools
Eventsevent_delete
Mock servermock_rule_create, mock_rule_update, mock_rule_delete, mock_rule_from_request, mock_import_openapi, mock_group_delete
Xdebugxdebug_wait, xdebug_step, xdebug_continue, xdebug_stop, xdebug_breakpoint_set, xdebug_breakpoint_remove, xdebug_eval

A removed tool is not in the tool list. A call to it fails with unknown tool. All other tools stay, including mock_rule_preview (it runs a rule on a sample request and saves nothing) and the Xdebug tools that read a paused session.

Read-only mode wins over the other switches. With read_only: true the tools above are gone even when mcp.mock_write, xdebug.allow_control or xdebug.allow_eval is true.

For agents that connect over HTTP, add a token:

yaml
mcp:
  enabled: true
  transport: http
  addr: 127.0.0.1:8001
  auth_token: your-secret-token
  read_only: true

Without auth_token anyone who reaches the port can use the tools. Then add http://127.0.0.1:8001/ with the header Authorization: Bearer <token> to the agent as an MCP server.

Available Tools ​

MCP clients can use the following tools to query Buggregator data:

Event Management ​

ToolDescription
events_listList events with optional filtering by type and project. Returns metadata (uuid, type, timestamp, project) without payloads. Supports limit parameter (default 20, max 100).
events_facetsList the values events can be filtered by (machines, environments, users, channels, levels, releases, tags) with counts. events_list takes them as host, env, user, channel, level, release, tag, trace and exclude_host: see Feed Filters.
event_getGet a complete event by UUID, including the full payload.
event_deleteDelete an event by UUID. Removed in read-only mode.

Sentry ​

ToolDescription
sentry_eventGet structured details of a Sentry error: message, severity, exception chain with stack traces, environment, platform. Returns clean, AI-friendly data.
queue_jobsQueue jobs seen through Sentry tracing. Without id: jobs, newest first, filtered by queue, job, status (ok, failed, retried), window, project, limit (50, max 500). With id: one job's attempts, the error of each failed attempt and the request that dispatched it. Each error has a frame: file, line and function of the top frame in your own code (in_app; with no in_app frames, the last frame); for the full stack call sentry_event with the error's id as uuid.
sentry_traces_listSentry traces, newest first, one row per trace: root transaction name, op, status, duration of the whole trace, span and error counts, services, n_plus_one_groups. Filters: project, name (the root transaction name contains it, any case), min_duration_ms (the root transaction took at least this long), n_plus_one (only traces with an N+1 query group; looks at the newest 1000 traces), window (15m, 1h, 24h, 7d), limit (20, max 100). Since server 2.17.0.
sentry_trace_getOne trace by trace_id (required): the root transaction, the span tree (op, description, start_offset_ms, duration_ms, error, origin file:line when the SDK sent it), N+1 groups (query, count, total_ms, origin, 3 example span ids), the errors of the trace (each with exception_value, the message, and a frame: file, line, function of the top frame in your own code, else the last frame; full stack: sentry_event with the error's id as uuid), the queue job attempts in it, the number of logs. project keeps only that project's part of a distributed trace; max_spans (300, max 2000) cuts only the span tree. Since server 2.17.0.

VarDumper ​

ToolDescription
vardump_getGet a variable dump with HTML stripped for clean AI consumption. Returns variable type, label, and plain text representation.

Profiler ​

ToolDescription
profiler_summaryQuick overview: total CPU/wall time/memory, slowest function, biggest memory consumer, most called function.
profiler_topTop functions sorted by metric (cpu, wt, mu, pmu, ct, and their exclusive variants). Returns inclusive and exclusive metrics with percentages.
profiler_call_graphFiltered call graph showing function relationships. Use threshold and percentage to control which nodes are shown.

Mock server ​

Tools for the mock server rules. Details and an example flow: Response templates → MCP tools.

ToolDescription
mock_rules_listThe rules in matching order: config rules first (read-only), then stored ones.
mock_rule_getOne rule with its full body.
mock_rule_previewRuns a rule against a sample request without saving it: status, headers, body, matched, error.
mock_requests_listRequests the mock server got, newest first, with the rule that answered.
mock_template_helpersTemplate helpers and fake data generators with their parameters.
mock_rule_createCreates a rule.
mock_rule_updateChanges a stored rule; only the given fields change.
mock_rule_deleteDeletes a stored rule.
mock_rule_from_requestCreates a rule from a captured request (e.g. one that got 404).
mock_import_openapiImports an OpenAPI 3.0/3.1 spec: one rule per operation, in one group.
mock_group_deleteDeletes all stored rules of a group.

The last six change rules. They are on by default; mcp.mock_write: false (env MCP_MOCK_WRITE=false) leaves only the first five. Read-only mode removes them too.

yaml
mcp:
  enabled: true
  mock_write: false

Xdebug ​

With the Xdebug proxy on (xdebug.enabled: true), MCP clients also get these tools. The first six read a paused session, xdebug_breakpoints lists breakpoints; only xdebug_eval (off unless xdebug.allow_eval: true) runs code. While an IDE drives the session, stepping and continuing stay in the IDE.

ToolDescription
xdebug_sessionsList debug sessions, including ones closed in the last 10 minutes. A session can be read only while it is paused (state break).
xdebug_locationCurrent file and line, the function it is in, and the source lines around it.
xdebug_stackThe call stack, one frame per level; 0 is the current frame.
xdebug_variablesVariables of a frame: locals by default (context_id 1 = superglobals, 2 = constants). Arrays and objects show their first level.
xdebug_propertyOne variable or property by its full name ($user, $user->address, $items[0]) with its children. Long strings up to 64 KB.
xdebug_evalThe value of a PHP expression in the current frame. Present only with xdebug.allow_eval: true: the code really runs inside the debugged request.
xdebug_waitWaits until a session pauses (up to 60 s).
xdebug_stepOne step (mode over, into, out); waits for the next pause and returns where the script stopped.
xdebug_continueRuns to the next breakpoint or xdebug_break(); same answer as xdebug_step.
xdebug_stopmode detach (default, the script runs to the end) or stop (ends the request now).
xdebug_breakpointsThe saved breakpoints; with session_id, their state and hit count in that session.
xdebug_breakpoint_setSaves a breakpoint: file + line, or exception; condition only with allow_eval.
xdebug_breakpoint_removeRemoves a saved breakpoint by id.

xdebug_wait, xdebug_step, xdebug_continue, xdebug_stop, xdebug_breakpoint_set and xdebug_breakpoint_remove drive a session that has no IDE (Debug without an IDE). They are left out with xdebug.allow_control: false; stepping is refused while an IDE drives. Read-only mode removes them and xdebug_eval.

session_id can be left out when exactly one session is paused. More in Xdebug → MCP tools.

Xdebug Trace ​

Uploaded function traces (Xdebug Trace). Since server v2.8.0.

ToolArgumentsReturns
xdebug_tracesproject, limit (20, max 100)Traces, newest first: uuid, project, name, url, script, duration (s), peak memory (bytes), calls, depth, truncated
xdebug_trace_summaryuuidTotals, the 20 functions with the most self time, the 20 slowest calls with their offset
xdebug_trace_callsuuid, parent, from, query, limit (50, max 200)No parent: top-level calls. parent=<offset>: its direct callees. A non-null next: call again with from=next and the same parent. query: calls whose function or file contains the text (case ignored), each with path (callers, top-down)
xdebug_trace_calluuid, offsetOne call (arguments, return value, incl/self time, memory change) and its first 50 direct callees. A non-null from: get the rest with xdebug_trace_calls and the parent and from of this answer

Example Usage in Claude Code ​

Once connected, you can ask your AI assistant things like:

  • "Show me the latest Sentry errors"
  • "What's the stack trace for this exception?"
  • "Analyze the profiling data and find the slowest functions"
  • "What value was dumped in the last VarDumper event?"