Skip to content

feat(xdebug): MCP tools to drive a session without an IDE - #395

Merged
butschster merged 4 commits into
masterfrom
feat/xdebug-mcp-control
Nov 7, 2026
Merged

butschster merged 4 commits into
masterfrom
feat/xdebug-mcp-control

Conversation

@butschster

@butschster butschster commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Part 2 of "Xdebug without an IDE" (part 1 #392 is merged).

AI agents can now drive a debug session Buggregator runs itself (no IDE attached).

New MCP tools (behind xdebug.allow_control, default on)

tool does
xdebug_step mode: into / over (default) / out; waits for the next pause (≤30 s) and returns file, line, function and source around it, or that the script ended
xdebug_continue run to the next breakpoint or xdebug_break(); same wait
xdebug_stop mode: detach (default, script runs to its end) or stop (ends the request now)
xdebug_wait block (≤60 s) until a session pauses; returns at once when one already is
  • All control tools are refused while an IDE drives the session.
  • The agent's MCP client name is stored as last_continuation_agent, so the UI can show who stepped. Every call goes to the session's agent log, as the read tools do.
  • xdebug.allow_control / XDEBUG_PROXY_ALLOW_CONTROL (default true); false keeps the Xdebug tools read-only. xdebug_eval still needs allow_eval (default false). GET /api/xdebug shows allow_control.

Tests

  • modules/xdebug/control_mcp_test.go (in-memory MCP client + fake DBGp engine): step returns the new location and records the agent; continue to the end reports stopped; stop detaches by default; all control tools refused while an IDE drives; xdebug_wait times out, then catches a session that pauses later.
  • TestMCPTools_EvalOffByDefault also checks the control tools are absent with allow_control off.
  • go test -race -count=3 ./modules/xdebug/ ./internal/app/ ok.

Made with harnsy

- xdebug_step (into/over/out), xdebug_continue: send the continuation and
  wait (<=30 s) for the next pause; return file, line, function and source,
  or that the script ended / still runs.
- xdebug_stop: detach (default, script runs on) or stop (ends the request).
- xdebug_wait: block (<=60 s) until a session pauses; returns at once when
  one already is.
- Refused while an IDE drives the session. The agent's MCP client name is
  shown as last_continuation_agent; every call goes to the agent log.
- xdebug.allow_control (XDEBUG_PROXY_ALLOW_CONTROL), default true; false
  keeps the tools read-only. GET /api/xdebug shows allow_control.
@butschster butschster added the type: feature Net-new functionality label Nov 7, 2026
@butschster
butschster changed the base branch from feat/xdebug-standalone to master November 7, 2026 09:19
@butschster butschster closed this Nov 7, 2026
@butschster butschster reopened this Nov 7, 2026
@butschster
butschster merged commit fe25d82 into master Nov 7, 2026
3 checks passed
@butschster
butschster deleted the feat/xdebug-mcp-control branch November 7, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Net-new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant