Download the PHP package ikarolaborda/php-xdebug-mcp without Composer

On this page you can find all versions of the php package ikarolaborda/php-xdebug-mcp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-xdebug-mcp

php-xdebug-mcp

tests PHP

A production-grade Model Context Protocol server that exposes Xdebug step debugging via DBGp as typed, safe, model-friendly tools and resources. Treat it as an IDE-grade debug adapter for AI coding agents — not as a raw protocol tunnel.

php-xdebug-mcp lets an AI agent attach to a live PHP process, set breakpoints by local workspace path, step through code, inspect stack frames and variables, and (when explicitly opted in) evaluate expressions against the running runtime. It works for plain CLI scripts, PHP-FPM behind nginx, queue workers, and PHP running inside Docker containers.

It is built on php-mcp/server and the Xdebug DBGp protocol.


Highlights


Quickstart

1. Install

Requires PHP 8.5+. Install via Composer:

Or clone and use directly:

2. Configure Xdebug

Drop a 99-xdebug.ini into your PHP environment:

For Docker, replace 127.0.0.1 with host.docker.internal and add extra_hosts: ["host.docker.internal:host-gateway"] to your compose service. See docs/docker-recipes.md for the full story including the PHP-FPM clear_env trap and the Linux loopback gotcha.

3. Wire the MCP client

Point any MCP client at the binary over stdio. Examples for the most common clients live in examples/agent-clients/:

4. Drive a debug session

The agent's typical flow:

The full set of tools is described inline in docs/architecture.md.


Architecture

Three boundaries make Docker deployments work cleanly:

Boundary Owned by Notes
MCP transport php-mcp/server stdio (default) or Streamable HTTP (scaffolded)
DBGp transport this project length-prefixed XML, NUL-delimited, asymmetric framing
Workspace ↔ runtime this project adapter-level path mapping with diagnostics

Long-form: docs/architecture.md.


Safety modes

Mode Read-only resources Breakpoints / stepping / inspection Eval & property mutation Stdin push
observe yes no no no
control (default) yes yes no no
full_control yes yes yes yes

xdebug_stop and xdebug_detach are independently gated by allow_stop and allow_detach. Docker helpers are gated by docker_helpers_enabled (default false).

Disabled tools are not registered with the MCP server, so tools/list accurately reflects the surface that the current process can use.

See docs/safety-modes.md.


Tools at a glance

Session — xdebug_server_status, xdebug_wait_for_session, xdebug_list_sessions, xdebug_get_session, xdebug_claim_session, xdebug_release_session.

Control — xdebug_continue, xdebug_step_into, xdebug_step_over, xdebug_step_out, xdebug_break_execution (async only), xdebug_wait_for_state, xdebug_stop, xdebug_detach.

Breakpoints — xdebug_set_breakpoint, xdebug_list_breakpoints, xdebug_update_breakpoint, xdebug_remove_breakpoint, xdebug_run_to_cursor.

Inspection — xdebug_get_stack, xdebug_get_contexts, xdebug_get_variables, xdebug_get_property, xdebug_get_source, xdebug_get_executable_lines, xdebug_get_typemap, xdebug_eval (full_control), xdebug_set_property (full_control).

I/O — xdebug_configure_output, xdebug_send_stdin (full_control).

Helpers — php_debug_run_cli, php_debug_http_request, php_debug_docker_exec (gated), php_debug_docker_run (gated).

Resources — xdebug://sessions, xdebug://session/{id}, xdebug://session/{id}/{stack,breakpoints,events,stdout,stderr}, xdebug://session/{id}/source/{path} template.


Configuration

config/php-xdebug-mcp.php ships with sensible defaults; environment variables override (XDEBUG_MCP_*). Notable knobs:

Key Env override Default Notes
listen_host XDEBUG_MCP_LISTEN_HOST 127.0.0.1 Use 0.0.0.0 for Docker on Linux
listen_port XDEBUG_MCP_LISTEN_PORT 9003 Xdebug 3 default
safety_mode XDEBUG_MCP_SAFETY_MODE control observe / control / full_control
allow_stop — true gates xdebug_stop
allow_detach — true gates xdebug_detach
path_rules[] — [] local ↔ remote prefix rules
workspace_roots[] — [cwd()] used by inverse-mapping suggestions
continuation_timeout_ms — 30000 per-tool deadline for run/step
inspection_timeout_ms — 5000 per-tool deadline for stack/locals
docker_helpers_enabled XDEBUG_MCP_DOCKER_HELPERS_ENABLED false exposes the two docker helpers
docker_extra_hosts[] — host.docker.internal:host-gateway passed to docker run as --add-host
log_path XDEBUG_MCP_LOG_PATH php://stderr stdout MUST stay clean in stdio mode

Documentation


Examples

Folder Layout
examples/cli/ host PHP CLI script driven via php_debug_run_cli
examples/fpm/ FPM behind nginx on the host
examples/docker/ Docker compose with bind-mounted source
examples/docker/php-fpm-compose/ full FPM-in-compose recipe with clear_env=off
examples/agent-clients/ Claude Code, Codex, Copilot config snippets
examples/pointerpro-e2e/ curated real-MCP-client trace (handshake → break → stack → variables) against a Laravel app in Docker

Tests

CI runs Unit + Contract on PHP 8.5 against every push and PR to main.


Contributing

Bug reports and PRs welcome. Please:


License

MIT.


All versions of php-xdebug-mcp with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
ext-dom Version *
ext-libxml Version *
ext-mbstring Version *
ext-simplexml Version *
ext-sockets Version *
php-mcp/server Version ^3.3
psr/log Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ikarolaborda/php-xdebug-mcp contains the following files

Loading the files please wait ...