xdebug-mcp

MCP.Pizza Chef: kpanuragh

This MCP server connects AI assistants to PHP's Xdebug tool, enabling interactive debugging with features like breakpoints, stepping through code, variable inspection, and expression evaluation. It works locally or with Dockerized PHP setups and supports Unix sockets or TCP connections. You configure it by adding a small snippet to your MCP app and PHP settings, allowing your AI to help you find and fix PHP bugs efficiently.

Coding
Other

Use This MCP server To

Step through PHP code with AI guidance Set and manage breakpoints during PHP debugging Inspect and modify PHP variables on the fly Evaluate PHP expressions in current debug context Debug PHP applications running in Docker containers View full call stack and session state Export debug sessions as reports

README

Xdebug MCP Server

npm version License: MIT

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.

Features

Core Debugging

  • Full Debug Control: Step into, step over, step out, continue, stop
  • Breakpoints: Line breakpoints, conditional breakpoints, exception breakpoints, function call breakpoints
  • Variable Inspection: View all variables, get specific variables, set variable values
  • Expression Evaluation: Evaluate PHP expressions in the current context
  • Stack Traces: View the full call stack
  • Multiple Sessions: Debug multiple PHP scripts simultaneously
  • Docker Support: Works with PHP running in Docker containers

Advanced Features

  • Watch Expressions: Persistent watches that auto-evaluate on each break with change detection
  • Logpoints: Log messages without stopping execution using {$var} placeholders
  • Memory Profiling: Track memory usage and execution time between breakpoints
  • Code Coverage: Track which lines were executed during debugging
  • Request Context: Capture $_GET, $_POST, $_SESSION, $_COOKIE, headers automatically
  • Step Filters: Skip vendor/library code during stepping
  • Debug Profiles: Save and restore breakpoint configurations
  • Session Export: Export debug sessions as JSON or HTML reports

Installation

From npm (Recommended)

xdebug-mcp FAQ

Can I use this to debug my PHP code with AI assistance?
Yes — it lets AI assistants control PHP debugging with breakpoints, stepping, and variable inspection.
Can I use this to debug PHP running inside Docker containers?
Yes — it supports Docker with path mappings to connect your AI debugger to containerized PHP.
Which apps support xdebug-mcp?
It works with MCP-enabled apps like Claude Code and others that support MCP servers.
Do I need an API key or special account to use xdebug-mcp?
No — it runs locally and connects your AI to PHP debugging without extra accounts.
How hard is it to set up xdebug-mcp?
Setup is copy-paste-config — you add a small config snippet to your MCP settings and PHP config.
Can I use Unix sockets instead of TCP ports?
Yes — Unix sockets are supported for faster, secure local debugging.
Does it support multiple simultaneous debug sessions?
Yes — you can debug multiple PHP scripts at once with session management.
Can I set conditional or exception breakpoints?
Yes — it supports line, conditional, exception, and function call breakpoints.