KX

koriym/xdebug-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

64 stars 9 forks 质量 66 趋势 34

让AI能够用Xdebug调试PHP。

概览

基于 Xdebug 的基于 PHP 的轨迹调试。从 CLI 驱动工具,或者让 AI 助手通过插件、Skill 或 MCP 集成运行核心工具。 只需告诉你的AI助手你想要什么: 通过插件、Skill或支持MCP的客户端连接后,AI可以选择合适的工具,执行并分析结果。 - PHP 8.2+ - Xdebug 3.x 扩展(已安装,但默认启用)- 可选:AI 助手(Claude Code 插件、Codex Skill 或任何支持 MCP 的客户端) 日常使用时请在php.ini中禁用 Xdebug。该工具只有在需要时才会按需加载 Xdebug。 提供两种集成。:这些工具设计为无状态一次性CLI命令,因此让代理直接运行——并参考技能的使用记录——是最简单且最准确的路径。当客户没有shell访问或无Skill支持时,选择MCP。

概述(AI 翻译)

用运行时数据调试PHP — 无 var_dump(),无猜测

基于 Xdebug 的基于 PHP 的轨迹调试。从 CLI 驱动工具,或者让 AI 助手通过插件、Skill 或 MCP 集成运行核心工具。

-无红色)


自然语言调试

只需告诉你的AI助手你想要什么:

英语:

日本語:

通过插件、Skill或支持MCP的客户端连接后,AI可以选择合适的工具,执行并分析结果。

要求

  • PHP 8.2+
  • Xdebug 3.x 扩展(已安装,但默认未启用)
  • 可选:AI助手(Claude Code插件、Codex Skill或任何支持MCP的客户端)

** 💡 性能提示:** 日常使用时请在php.ini中禁用 Xdebug。该工具仅在需要时加载 Xdebug。

快速启动

1.安装

2.验证 Xdebug

3.(可选)接线一个AI助手

目前有两种集成方案。我们推荐Skill:这些工具设计上是无状态一次性CLI命令,因此让代理直接运行——并根据Skill的使用记录——是最简单、最准确的路径。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Xdebug MCP

Debug PHP with Runtime Data — No var_dump(), No Guesswork

Trace-based debugging for PHP, built on Xdebug. Drive the tools from the CLI, or let an AI assistant run the core tools through plugin, Skill, or MCP integration.


Natural Language Debugging

Just tell your AI assistant what you want:

English:

"Debug script.php and find why $user is null at line 42"
"Profile api.php and find the performance bottleneck"
"Trace the authentication flow in login.php"
"Check test coverage for UserService"

日本語:

"script.phpをデバッグして、42行目で$userがnullになる原因を調べて"
"api.phpのパフォーマンスボトルネックを見つけて"
"login.phpの認証フローをトレースして"
"UserServiceのテストカバレッジを確認して"

When connected through the plugin, Skill, or an MCP-capable client, the AI can select the appropriate tool, execute it, and analyze the results.

Requirements

  • PHP 8.2+
  • Xdebug 3.x extension (installed, but not enabled by default)
  • Optional: an AI assistant (Claude Code plugin, Codex Skill, or any MCP-capable client)

💡 Performance Tip: Keep Xdebug disabled in php.ini for daily use. This tool loads Xdebug on-demand only when needed.

Quick Start

1. Install

composer global require koriym/xdebug-mcp

2. Verify Xdebug

"$(composer global config bin-dir --absolute --quiet)/check-env"

3. (Optional) Wire up an AI assistant

Two integrations are available. We recommend the Skill: these tools are stateless one-shot CLI commands by design, so letting the agent run them directly — guided by the Skill’s usage notes — is the simplest and most accurate path. Choose MCP when your client has no shell access or no Skill support.

Skill (recommended) MCP server
How it works The agent reads SKILL.md and runs the CLI tools directly The client calls the tools over JSON-RPC (stdio)
Setup Plugin install, or copy one directory Register in the client’s MCP config
Best for AI coding agents with shell access (Claude Code, Codex, …) MCP-capable clients without shell/Skill support (e.g. Claude Desktop)

Claude Code — install the plugin (which bundles the Skill):

/plugin marketplace add koriym/xdebug-mcp
/plugin install xdebug@xdebug-mcp

Codex CLI — install the Skill:

git clone --depth 1 https://github.com/koriym/xdebug-mcp.git /tmp/xdebug-mcp
mkdir -p ~/.codex/skills
cp -r /tmp/xdebug-mcp/skills/xdebug ~/.codex/skills/

Any MCP-capable client — see MCP Configuration below.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "xdebug": { "command": "php", "args": ["/ABSOLUTE/PATH/TO/xdebug-mcp"] } } }