Minimal working .bricklayer.json: safe Bricklayer tool config per deploy mode

Just enough configuration to decide what Your AI agent is allowed to do on a Magento instance.

Bricklayer gives agents tools that read, but also tools that write: create products, cancel orders, delete customers, generate code, run PHP. .bricklayer.json in Your Magento root is where You decide which of those are switched on.

Generate it:

vendor/bin/bricklayer init

install calls it for You, and verify creates it if it is missing. The file contains one entry per runtime-configurable tool (36 at the time of writing). The list comes from scanning the source for requireToolEnabled() calls, so every key in the file is one the runtime actually honors. No dead keys.

Defaults depend on the deploy mode Bricklayer detects:

Deploy mode Disabled by default Other changes
developer/default 11 destructive tools: *-delete, order-cancel, order-create, creditmemo-create, 4 generate-* code-runner read-only
production the same 11 plus code-runner database-query.max_rows lowered to 50

Changing settings

Every write tool has an enabled flag. A few have extra options:

Key Default (developer) What it does
tools.code-runner.allow_write false When false, DB changes are rolled back
tools.code-runner.max_timeout 60 Max execution time in seconds
tools.database-query.max_rows 100 Row limit for SELECT queries
tools.log.max_lines 500 Line limit when reading logs

No need to edit JSON by hand. Interactive mode lists all configurable tools with current values and validates input:

vendor/bin/bricklayer config:set

Scripted mode, for automation:

vendor/bin/bricklayer config:set tools.product-delete.enabled true
vendor/bin/bricklayer config:set tools.database-query.max_rows 250
vendor/bin/bricklayer config:set tools.code-runner.allow_write false

Every set is validated and re-read before it counts. You also get a warning if You try to set enabled on a read-only tool that does not honor it, or if an env variable would shadow Your change.

No restart needed. The running MCP server notices the changed file on the next tool call.

Environment variables

Env variables override the file. Take the dot-notation key, prefix with BRICKLAYER_, upper-case it, and replace . and - with _:

BRICKLAYER_TOOLS_CODE_RUNNER_ENABLED=false       # tools.code-runner.enabled
BRICKLAYER_TOOLS_DATABASE_QUERY_MAX_ROWS=50      # tools.database-query.max_rows
BRICKLAYER_TOOLS_PRODUCT_DELETE_ENABLED=true     # tools.product-delete.enabled

The full path matters: BRICKLAYER_CODE_RUNNER_ENABLED targets a key nobody reads and does nothing.

Local development, You want the agent to build things but not destroy them. The generated developer defaults already do that. If You want it to scaffold modules, switch on only what You need:

vendor/bin/bricklayer config:set tools.generate-module.enabled true

Production, the recommendation from the README:

{
    "tools": {
        "code-runner": { "enabled": false },
        "database-query": { "enabled": false },
        "product-delete": { "enabled": false },
        "customer-delete": { "enabled": false },
        "category-delete": { "enabled": false },
        "generate-module": { "enabled": false },
        "generate-model": { "enabled": false },
        "generate-controller": { "enabled": false },
        "generate-api": { "enabled": false }
    }
}
  • In production, code-runner can not be enabled under any circumstances, whatever the file says
  • Destructive tools in production need an explicit "enabled": true, no file or no entry means blocked
  • Sensitive config values (payment/*, carriers/*, oauth/*…) are masked in query results regardless of config

Start coding!

Source: GitHub