Skip to content

[Feature Request] Xdebug proxy + MCP #340

@madmages

Description

@madmages

It would be great to have an Xdebug proxy that also exposes an MCP server interface.

The basic idea is:

PHP / Xdebug -> xdebug_proxy -> IDE
                         |
                         -> MCP server

This would allow a developer and an LLM agent to collaborate during the same debugging session.

Motivation

Today, when debugging PHP applications with Xdebug, the IDE is the primary consumer of the debugging session. While an LLM can help analyze source code, it typically has no direct access to the current runtime state exposed by the debugger.

An Xdebug proxy with MCP support could bridge this gap. During a debugging session, a developer could identify unexpected behavior, describe the issue to an LLM, and allow the LLM to inspect the current execution state directly through MCP.

For example, the LLM could inspect:

  • Current file and line
  • Stack frames
  • Local variables
  • Object properties
  • Evaluated expressions
  • Breakpoints
  • Step results

This would create a more collaborative debugging workflow: the developer retains visual control through the IDE, while the LLM can analyze the same runtime state and assist with investigation.

Proposed Behavior

The proxy would sit between Xdebug and the IDE.

Xdebug would connect to the proxy, and the proxy would forward the DBGp session to the IDE. At the same time, the proxy would expose an MCP server that allows an LLM agent to inspect and interact with the debugging session.

Through MCP, the following debugger operations could be exposed:

  • Continue execution
  • Step over
  • Step into
  • Step out
  • Inspect stack frames
  • Read variables
  • Evaluate expressions
  • Manage breakpoints (if supported)

IDE Visibility

One possible implementation would allow the proxy to temporarily take control of the debugging session for an LLM-driven action and then return visibility to the IDE.

For example:

  1. Xdebug connects to xdebug_proxy
  2. xdebug_proxy connects to the IDE
  3. The developer sees the current breakpoint and execution state in the IDE
  4. The LLM performs a debugger action through MCP
  5. The proxy advances the Xdebug session
  6. The proxy synchronizes or reconnects the session so the developer can see the updated state in the IDE

This ensures that actions performed by the LLM remain visible to the developer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions