Lets agents debug PHP applications through Xdebug, connecting over Unix socket or TCP.
Setup
Choose your client, copy the config, then fill in any required environment variables.
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>"
}
}
}
}Environment variables
LOG_LEVELXDEBUG_PORT
Replace the placeholders with your own credentials and keep them out of version control.