Minimal working Bricklayer setup in Docker, DDEV and Warden

Just enough setup to run Bricklayer when Your Magento lives in a container and Your AI agent lives on the host.

The MCP server has to bootstrap Magento, so it must run where PHP, the database and the codebase are: inside the PHP container. Your agent, on the other hand, starts the MCP server from the host. Something has to bridge that, and that something is the command in .mcp.json.

Good news, You do not have to write it by hand. Run the usual install from the project root:

vendor/bin/bricklayer install

Bricklayer detects whether You are running natively, in DDEV, in Warden or in plain Docker Compose, and writes the matching command.

Generated commands

Environment Command written to .mcp.json
Native php vendor/bin/bricklayer-mcp
DDEV ddev exec php vendor/bin/bricklayer-mcp
Warden warden shell -c php vendor/bin/bricklayer-mcp
Docker Compose docker compose exec -T php php vendor/bin/bricklayer-mcp

For DDEV the generated file looks like this:

{
    "mcpServers": {
        "magento-bricklayer": {
            "command": "ddev",
            "args": ["exec", "vendor/bin/bricklayer-mcp"]
        }
    }
}

For Docker Compose, the container user is resolved too and passed with -u. Precedence: BRICKLAYER_CONTAINER_USER env variable → owner of composer.json → APACHE_USER from .env. If the detected user is wrong, set it explicitly:

BRICKLAYER_CONTAINER_USER=www-data vendor/bin/bricklayer install --force

Container names that change

Compose generates names like projectname-apache-php-1, and they differ between machines. For that case use the wrapper script that ships with the package:

{
    "mcpServers": {
        "magento-bricklayer": {
            "command": "vendor/inchoo/magento-bricklayer/bin/bricklayer-mcp-docker",
            "args": []
        }
    }
}

It finds the PHP container at runtime:

  • matches common names: apache-php, php-fpm, magento, web, app
  • skips utility containers: phpmyadmin, redis, elasticsearch, varnish…
  • returns a proper JSON-RPC error if no container is found, instead of hanging Your agent
  • Magento root inside the container defaults to /var/www/html, change it with MAGENTO_ROOT:
{
    "mcpServers": {
        "magento-bricklayer": {
            "command": "vendor/inchoo/magento-bricklayer/bin/bricklayer-mcp-docker",
            "args": [],
            "env": { "MAGENTO_ROOT": "/var/www/magento" }
        }
    }
}

Verify

Run the health check through the same container You use for Magento CLI, e.g. for DDEV:

ddev exec vendor/bin/bricklayer verify

It checks Magento bootstrap, deploy mode, MCP server creation and tool count, agent config files, PsySH for code-runner, database connectivity and log directory permissions. If all is green, open Your agent from the project root on the host and ask it to call application-info. If You get Magento and PHP versions back, the bridge works.

  • .mcp.json with a container command is environment-specific. If teammates use different setups, the wrapper script is the safer thing to commit
  • Switched from Docker to DDEV? Run vendor/bin/bricklayer install --force to regenerate

Start coding!

Source: GitHub · Agent integration wiki