PHP code example of koriym / xdebug-mcp

1. Go to this page and download the library: Download koriym/xdebug-mcp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

koriym / xdebug-mcp example snippets

bash
# Install
composer 
echo "@vendor/koriym/xdebug-mcp/docs/debug_guideline_for_ai.md" >> CLAUDE.md
claude mcp add xdebug php "$(pwd)/vendor/bin/xdebug-mcp"

# 🎯 Start with AI-optimized help (recommended first step)
./vendor/bin/xdebug-debug --help     # Learn optimal AI debugging workflow
./vendor/bin/xdebug-coverage --help  # Understand AI coverage analysis
./vendor/bin/xdebug-trace --help     # Master execution flow tracing
./vendor/bin/xdebug-profile --help   # Performance optimization guidance

# Example: Catch null bugs automatically  
./vendor/bin/xdebug-debug --break='script.php:42:$user==null' --exit-on-break -- php script.php
bash
./vendor/bin/xdebug-debug --break='script.php:42:$user==null' --exit-on-break -- php script.php
bash
./vendor/bin/xdebug-debug --break='script.php:17' --steps=100 --json -- php script.php
bash
./vendor/bin/xdebug-debug --break='User.php:85:$user==null' --exit-on-break -- php app.php
bash
./vendor/bin/xdebug-profile --context="API performance" --json -- php api.php
bash
./vendor/bin/xdebug-debug --break='loop.php:45' --steps=100 --json -- php app.php
bash
# Tests pass ✅ but is the code actually efficient?
./vendor/bin/xdebug-trace --context="AI generated algorithm efficiency check" ai_code.php
bash
/x-debug "script.php" "script.php:42:$error!=null" "" "Debug error handling"
/x-trace script="auth.php" context="Login flow analysis"