Xdebug MCP Server

MCP server for PHP Xdebug debugging with breakpoints, stepping, and variable inspection

Local serverstdio

What is the Xdebug MCP server?

MCP server for PHP Xdebug debugging with breakpoints, stepping, and variable inspection. Exposed over MCP by the xdebug mcp server, that capability becomes something an assistant can invoke while it works, not something you go and do afterwards.

What it actually does

An MCP (Model Context Protocol) server that provides PHP debugging capabilities through Xdebug's DBGp protocol. This allows AI assistants like Claude to directly debug PHP applications.

Its toolset

Everything the assistant can do here goes through one of these:

  • capture_request_context — Capture HTTP request context
  • add_step_filter — Add filter to skip files during stepping
  • list_step_filters — List step filter rules
  • get_function_history — View function call history
  • export_session — Export session as JSON/HTML report
  • capture_snapshot — Capture debug state snapshot
  • Breakpoints — The Breakpoints tool exposed by this server
  • Inspection — The Inspection tool exposed by this server
  • Logpoints — The Logpoints tool exposed by this server
  • Profiling — The Profiling tool exposed by this server
  • Logpoint — The Logpoint tool exposed by this server

Configuration

You will need 6 environment variables: XDEBUG_PORT, LOG_LEVEL, PATH_MAPPINGS, XDEBUG_SOCKET_PATH, DBGP_PROXY_HOST, XDEBUG_HOST. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

Adding it to your client

Installation goes through your MCP client rather than a global install: point it at xdebug-mcp on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

When to reach for it

Among the developer tooling options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. Xdebug's toolset — capture_request_context, add_step_filter, list_step_filters and 8 more — is a fair guide to whether it matches your workflow. It is maintained by kpanuragh; worth a glance at recent repository activity before you build anything load-bearing on it.

This entry was verified against Xdebug's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Caveats

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 11 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Xdebug.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the xdebug mcp server does with a few real requests.

Available tools

ToolWhat it does
capture_request_contextCapture HTTP request context
add_step_filterAdd filter to skip files during stepping
list_step_filtersList step filter rules
get_function_historyView function call history
export_sessionExport session as JSON/HTML report
capture_snapshotCapture debug state snapshot
BreakpointsThe Breakpoints tool exposed by this server.
InspectionThe Inspection tool exposed by this server.
LogpointsThe Logpoints tool exposed by this server.
ProfilingThe Profiling tool exposed by this server.
LogpointThe Logpoint tool exposed by this server.

How to install the Xdebug MCP server

{
  "mcpServers": {
    "xdebug": {
      "command": "xdebug-mcp",
      "env": {
        "XDEBUG_PORT": "9003",
        "LOG_LEVEL": "info"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
XDEBUG_PORTConfiguration value read at startup.Optional
LOG_LEVELConfiguration value read at startup.Optional
PATH_MAPPINGSFilesystem location the server is allowed to use.Optional
XDEBUG_SOCKET_PATHFilesystem location the server is allowed to use.Optional
DBGP_PROXY_HOSTEndpoint or connection string the server talks to.Optional
XDEBUG_HOSTEndpoint or connection string the server talks to.Optional

Example prompts to try

  • Use Xdebug to capture request context.
  • Use Xdebug to add step filter.
  • Use Xdebug to list step filters.

Frequently asked questions

It connects Xdebug to MCP-compatible AI assistants such as Claude and Cursor, exposing 11 tools (capture_request_context, add_step_filter, list_step_filters, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Xdebug directly.