KX

kpanuragh/xdebug-mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

28 stars 8 forks 品質 80 トレンド 25MIT

PHP Xdebug デバッグ用の MCP サーバー - Unix ソケットと TCP サポートでモデルコンテキストプロトコルを介した AI アシスト PHP デバッグが可能

概要

Xdebug の DBGp プロトコルを介して PHP デバッグ機能を提供する MCP (Model Context Protocol) サーバー。 これは、ClaudeのようなAIアシスタントが直接PHPアプリケーションをデバッグすることを可能にします。 - : ステップ、ステップオーバー、ステップアウト、続行、ストップ - : 行のブレークポイント、条件のブレークポイント、例外のブレークポイント、関数呼び出しのブレークポイント - : すべての変数を表示し、特定の変数を取得し、変数値を設定 - : 現在のコンテキストでPHPの式を評価します - : フルコールスタックを表示 - : 複数のPHPスクリプトを同時にデバッグ - : Dockerコンテナで実行されるPHPで動作します - : 変更検出で各ブレイクに自動評価される永続的な時計 - : {$var}プレースホルダーを使用して実行を停止することなくログメッセージ - : ブレイクポイント間のメモリ使用量と実行時間を追跡 - : デバッグ中に行が実行されたトラック - : キャプチャ $ GET、$ POST、$ SESSION、$ COOKIE、ヘッダーは自動的に - : ステップ中のベンダー/ライブラリのコードをスキップ - : 保存してブレイクポイントを復元...

概要(AI 翻訳)

Xdebug の DBGp プロトコルを介して PHP デバッグ機能を提供する MCP (Model Context Protocol) サーバー。 これは、ClaudeのようなAIアシスタントが直接PHPアプリケーションをデバッグすることを可能にします。

##特徴

コアデバッグ

-フルデバッグコントロール:ステップイン、ステップアウト、続行、停止

  • ブレークポイント: ラインのブレークポイント、条件付きブレークポイント、例外ブレークポイント、関数呼び出しのブレークポイント
  • 可変的な点検:すべての変数を見て下さい、特定の変数を得て下さい、変数値を置いて下さい
  • 表現評価: 現在のコンテキストで PHP の式を評価する
  • スタックトレース:フルコールスタックを見る -複数のセッション:複数のPHPスクリプトを同時にデバッグする
  • ドックサポート: Docker コンテナで動作する PHP で動作します。

高度な機能

  • 腕時計の表現: 変化検出による各ブレイクに自動評価する持続的な時計 -Logpoints: {$var} プレースホルダーを使用して実行を停止することなくログメッセージ
  • メモリープロファイリング: メモリ使用量とブレイクポイント間の実行時間を追跡
  • コードカバレッジ:デバッグ中に行が実行されたトラック

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

Xdebug MCP Server

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

npm install -g xdebug-mcp

From Source

git clone https://github.com/kpanuragh/xdebug-mcp.git
cd xdebug-mcp
npm install
npm run build

MCP Server Configuration

For Claude Code

Add the xdebug-mcp server to your MCP configuration (.mcp.json or Claude settings):

Using npm global install:

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

Using npx:

{
  "mcpServers": {
    "xdebug": {
      "command": "npx",
      "args": ["-y", "xdebug-mcp"],
      "env": {
        "XDEBUG_PORT": "9003",
        "LOG_LEVEL": "info"
      }
    }
  }
}

With Path Mappings (for Docker)

When debugging PHP in Docker containers, you need path mappings to translate container paths to host paths:

{
  "mcpServers": {
    "xdebug": {
      "command": "xdebug-mcp",
      "env": {
        "XDEBUG_PORT": "9003",
        "PATH_MAPPINGS": "{\"/var/www/html\": \"/home/user/projects/myapp\"}",
        "LOG_LEVEL": "info"
      }
    }
  }
}

With DBGp Proxy Registration

GitHub で README 全文を見る

インストール

npx -y xdebug-mcp
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

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