Lets agents debug PHP applications through Xdebug, connecting over Unix socket or TCP.
接入配置
选择客户端,复制配置,再按项目文档补齐环境变量。
claude mcp add xdebug --env LOG_LEVEL='<LOG_LEVEL>' --env XDEBUG_PORT='<XDEBUG_PORT>' -- npx -y xdebug-mcp~/.codex/config.toml
[mcp_servers.xdebug]
command = "npx"
args = ["-y", "xdebug-mcp"]
env = { LOG_LEVEL = "<LOG_LEVEL>", XDEBUG_PORT = "<XDEBUG_PORT>" }
# codex mcp add xdebug --env LOG_LEVEL='<LOG_LEVEL>' --env XDEBUG_PORT='<XDEBUG_PORT>' -- npx -y xdebug-mcp~/.cursor/mcp.json
{
"mcpServers": {
"xdebug": {
"command": "npx",
"args": [
"-y",
"xdebug-mcp"
],
"env": {
"LOG_LEVEL": "<LOG_LEVEL>",
"XDEBUG_PORT": "<XDEBUG_PORT>"
}
}
}
}.vscode/mcp.json
{
"servers": {
"xdebug": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"xdebug-mcp"
],
"env": {
"LOG_LEVEL": "<LOG_LEVEL>",
"XDEBUG_PORT": "<XDEBUG_PORT>"
}
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"xdebug": {
"command": "npx",
"args": [
"-y",
"xdebug-mcp"
],
"env": {
"LOG_LEVEL": "<LOG_LEVEL>",
"XDEBUG_PORT": "<XDEBUG_PORT>"
}
}
}
}claude_desktop_config.json
{
"mcpServers": {
"xdebug": {
"command": "npx",
"args": [
"-y",
"xdebug-mcp"
],
"env": {
"LOG_LEVEL": "<LOG_LEVEL>",
"XDEBUG_PORT": "<XDEBUG_PORT>"
}
}
}
}.trae/mcp.json
{
"mcpServers": {
"xdebug": {
"command": "npx",
"args": [
"-y",
"xdebug-mcp"
],
"env": {
"LOG_LEVEL": "<LOG_LEVEL>",
"XDEBUG_PORT": "<XDEBUG_PORT>"
}
}
}
}需要的环境变量
LOG_LEVELXDEBUG_PORT
把占位值换成你自己的密钥;不要把密钥提交到代码仓库。