smart-xdebug
Let AI debug your PHP code - MCP server connecting Claude to XDebug for runtime variable inspection, breakpoints, and step-through debugging
claude mcp add --transport stdio wallter-smart-xdebug-mcp npx -y smart-xdebug-mcp \ --env XDEBUG_MCP_PORT="9003" \ --env XDEBUG_MCP_TIMEOUT="30000" \ --env XDEBUG_MCP_WATCHDOG_TIMEOUT="300000"
How to use
Smart XDebug MCP Server enables Claude to debug PHP applications by connecting to your XDebug-enabled debugger. The server bridges high-level debugging intents from Claude to DBGp commands, allowing AI-driven breakpoint handling, variable inspection, and time-travel queries within your running PHP app. Once the MCP server is running, you can configure Claude to target the xdebug MCP server and let it orchestrate debugging sessions against your PHP process. The tool supports automatic path mapping, breakpoint management, and runtime variable tracking to give Claude actionable visibility into your code as it executes.
How to install
Prerequisites:\n- Node.js 18+ and npm installed on your machine or CI environment.\n- PHP with XDebug 3.x configured for remote debugging.\n- Access to your MCP workflow configuration (Claude MCP or equivalent).\n\nInstallation steps:\n1) Ensure Node.js is installed.\n2) Install the MCP server globally via npm:\n npm install -g smart-xdebug-mcp\n3) Start the MCP server (via npx in MCP config or run the server directly if you cloned the repo):\n npx -y smart-xdebug-mcp\n4) Verify the server is reachable in your MCP settings. Example MCP config entry will typically look like:\n {\n "mcpServers": {\n "xdebug": {\n "command": "npx",\n "args": ["-y", "smart-xdebug-mcp"]\n }\n }\n }\n5) Configure XDebug in your PHP environment (php.ini or equivalent) with remote debugging enabled and set the correct client host/port to match your MCP environment.\n6) Start using Claude in your MCP-enabled workflow to issue debugging requests.
Additional notes
Tips and notes:\n- Environment variables for advanced behavior: XDEBUG_MCP_PORT (default 9003), XDEBUG_MCP_TIMEOUT (default 30000 ms), XDEBUG_MCP_WATCHDOG_TIMEOUT (default 300000 ms). Adjust ports if running inside containers or across networks.\n- Path mappings are auto-detected from .vscode/launch.json or docker-compose.yml where possible. Ensure your PHP project paths align with these mappings for accurate debugging.\n- If you run PHP inside Docker, the XDebug client_host should be set to a reachable host (e.g., host.docker.internal) as documented.\n- When debugging in containerized environments, ensure the container exposes the XDebug port and that the MCP server can reach it.\n- Common issues often relate to mismatched XDebug modes, incorrect client ports, or firewall rules blocking the debugging connection.\n- This MCP server is designed to work with Claude Code or any MCP-compatible AI assistant capable of sending debugging intents and receiving structured responses.\n- Restart the MCP server after changing environment variables or updates to the smart-xdebug-mcp package.
Related MCP Servers
obsidian
MCP server for Obsidian vault management - enables Claude and other AI assistants to read, write, search, and organize your notes
clockwork
MCP server for Laravel Clockwork - debug and analyze Laravel applications with AI assistance. Query performance, N+1 detection, cache analysis, and more.
wordpress-boost
MCP server exposing WordPress internals to AI - hooks, schema, security, and test data. Inspired by Laravel Boost.
harvest
MCP server for Harvest time tracking API - use with Claude Desktop and other AI assistants
warp-sql
🗄️ Model Context Protocol (MCP) server for SQL Server integration with Warp terminal. Execute queries, explore schemas, export data, and analyze performance with natural language commands.
vibewatch
Stop copy-pasting terminal errors to ChatGPT/Claude. VibeWatch wraps your dev commands and lets AI assistants see your terminal in real-time via Model Context Protocol (MCP).