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:
- Xdebug connects to
xdebug_proxy
xdebug_proxy connects to the IDE
- The developer sees the current breakpoint and execution state in the IDE
- The LLM performs a debugger action through MCP
- The proxy advances the Xdebug session
- 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.
It would be great to have an Xdebug proxy that also exposes an MCP server interface.
The basic idea is:
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:
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:
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:
xdebug_proxyxdebug_proxyconnects to the IDEThis ensures that actions performed by the LLM remain visible to the developer.