# inchoo/magento-bricklayer architecture

> Architecture diagram of the GitHub repository inchoo/magento-bricklayer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/inchoo/magento-bricklayer
- Repository: https://github.com/inchoo/magento-bricklayer

## Overview

Magento Bricklayer is an MCP server that gives AI coding agents runtime insight into Magento and development tools. The principal workflow is an agent request entering the MCP server, being dispatched to a registered tool, and querying Magento’s bootstrapped runtime before returning results. The product also provides configuration and agent setup commands, development guidance and resources, and distinct introspection, data-management, diagnostics, and code-generation capabilities. The graph combines README-documented capabilities with relationships visible in sampled source and the SOURCE INDEX; unsampled tool internals are represented without inferred call chains.

Main entry points: [`src/Mcp/Tool/ToolRegistry.php`](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/ToolRegistry.php) (Tool registry), [`src/Bootstrap/MagentoBootstrap.php`](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Bootstrap/MagentoBootstrap.php) (Magento bootstrap), [`src/Mcp/Tool/ContextTools.php`](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/ContextTools.php) (Development context), [`src/Mcp/McpServerFactory.php`](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/McpServerFactory.php) (Server factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and setup"]
  node_mcp_server["MCP server"]
  node_server_factory["Server factory"]
  node_registry["Tool registry<br/>[ToolRegistry.php]"]
  node_cli["CLI application<br/>[Application.php]"]
  node_setup["Agent setup<br/>[InstallCommand.php]"]
  node_config["Tool configuration<br/>[ConfigLoader.php]"]
end

subgraph group_runtime["Magento runtime"]
  node_detector["Magento detection"]
  node_bootstrap["Magento bootstrap"]
  node_component_registration["Component registration"]
end

subgraph group_tools["MCP capabilities"]
  node_introspection["Runtime introspection"]
  node_database["Database inspection<br/>[DatabaseTools.php]"]
  node_eav["EAV inspection<br/>[EavTools.php]"]
  node_routing["Routing and APIs<br/>[RoutingTools.php]"]
  node_catalog["Catalog operations<br/>[CatalogTools.php]"]
  node_orders["Order operations<br/>[OrderTools.php]"]
  node_customers["Customer operations<br/>[CustomerTools.php]"]
  node_diagnostics["Diagnostics and performance"]
  node_code_runner["Code runner"]
  node_code_generation["Code generation"]
  node_search["Tool and docs search<br/>[SearchTools.php]"]
end

subgraph group_guidance["Guidance and resources"]
  node_context["Development context<br/>[ContextTools.php]"]
  node_guidelines["Guidelines compiler"]
  node_overrides["Local overrides"]
  node_resources["MCP resources"]
end

node_agent(("AI coding agent"))

node_agent -->|"requests tools"| node_mcp_server
node_mcp_server -.->|"starts server"| node_server_factory
node_server_factory -->|"loads tools"| node_registry
node_server_factory -->|"initializes runtime"| node_bootstrap
node_registry -->|"registers tools"| node_introspection
node_registry -->|"registers tools"| node_database
node_registry -->|"registers tools"| node_eav
node_registry -->|"registers tools"| node_routing
node_registry -->|"registers tools"| node_catalog
node_registry -->|"registers tools"| node_orders
node_registry -->|"registers tools"| node_customers
node_registry -->|"registers tools"| node_diagnostics
node_registry -->|"registers tools"| node_code_runner
node_registry -->|"registers tools"| node_code_generation
node_registry -->|"registers tools"| node_search
node_bootstrap -->|"finds Magento root"| node_detector
node_bootstrap -->|"registers components"| node_component_registration
node_database -->|"reads Magento services"| node_bootstrap
node_routing -->|"reads route services"| node_bootstrap
node_context -->|"loads guidance"| node_guidelines
node_context -->|"uses overrides"| node_overrides
node_search -->|"finds guidance"| node_context
node_registry -->|"registers tools"| node_context
node_resources -.->|"provides resources"| node_agent
node_cli -->|"registers command"| node_setup
node_setup -->|"generates agent guidance"| node_guidelines
node_setup -.->|"configures tools"| node_config

click node_mcp_server "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Command/McpServerCommand.php"
click node_server_factory "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/McpServerFactory.php"
click node_registry "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/ToolRegistry.php"
click node_cli "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Application.php"
click node_setup "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Command/InstallCommand.php"
click node_config "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Config/ConfigLoader.php"
click node_detector "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Bootstrap/MagentoDetector.php"
click node_bootstrap "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Bootstrap/MagentoBootstrap.php"
click node_component_registration "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Support/ComponentRegistration.php"
click node_introspection "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/ConfigurationTools.php"
click node_database "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/DatabaseTools.php"
click node_eav "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/EavTools.php"
click node_routing "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/RoutingTools.php"
click node_catalog "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/CatalogTools.php"
click node_orders "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/OrderTools.php"
click node_customers "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/CustomerTools.php"
click node_diagnostics "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/DiagnosticTools.php"
click node_code_runner "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/CodeRunnerTools.php"
click node_code_generation "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/CodeGenerationTools.php"
click node_search "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/SearchTools.php"
click node_context "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/ContextTools.php"
click node_guidelines "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Guidelines/GuidelinesCompiler.php"
click node_overrides "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Guidelines/LocalOverrideHelper.php"
click node_resources "https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Resource/GuidelinesResource.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mcp_server,node_server_factory,node_registry,node_cli,node_setup,node_config toneBlue
class node_detector,node_bootstrap,node_component_registration toneAmber
class node_introspection,node_database,node_eav,node_routing,node_catalog,node_orders,node_customers,node_diagnostics,node_code_runner,node_code_generation,node_search toneMint
class node_context,node_guidelines,node_overrides,node_resources toneRose
class node_agent toneIndigo
```

## Components

### Entry and setup

- [MCP server](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Command/McpServerCommand.php): `src/Command/McpServerCommand.php`
- [Server factory](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/McpServerFactory.php): `src/Mcp/McpServerFactory.php`
- [Tool registry](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/ToolRegistry.php): `src/Mcp/Tool/ToolRegistry.php`
- [CLI application](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Application.php): `src/Application.php`
- [Agent setup](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Command/InstallCommand.php): `src/Command/InstallCommand.php`
- [Tool configuration](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Config/ConfigLoader.php): `src/Config/ConfigLoader.php`

### Magento runtime

- [Magento detection](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Bootstrap/MagentoDetector.php): `src/Bootstrap/MagentoDetector.php`
- [Magento bootstrap](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Bootstrap/MagentoBootstrap.php): `src/Bootstrap/MagentoBootstrap.php`
- [Component registration](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Support/ComponentRegistration.php): `src/Support/ComponentRegistration.php`

### MCP capabilities

- [Runtime introspection](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/ConfigurationTools.php): `src/Mcp/Tool/ConfigurationTools.php`
- [Database inspection](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/DatabaseTools.php): `src/Mcp/Tool/DatabaseTools.php`
- [EAV inspection](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/EavTools.php): `src/Mcp/Tool/EavTools.php`
- [Routing and APIs](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/RoutingTools.php): `src/Mcp/Tool/RoutingTools.php`
- [Catalog operations](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/CatalogTools.php): `src/Mcp/Tool/CatalogTools.php`
- [Order operations](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/OrderTools.php): `src/Mcp/Tool/OrderTools.php`
- [Customer operations](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/CustomerTools.php): `src/Mcp/Tool/CustomerTools.php`
- [Diagnostics and performance](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/DiagnosticTools.php): `src/Mcp/Tool/DiagnosticTools.php`
- [Code runner](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/CodeRunnerTools.php): `src/Mcp/Tool/CodeRunnerTools.php`
- [Code generation](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/CodeGenerationTools.php): `src/Mcp/Tool/CodeGenerationTools.php`
- [Tool and docs search](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/SearchTools.php): `src/Mcp/Tool/SearchTools.php`

### Guidance and resources

- [Development context](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Tool/ContextTools.php): `src/Mcp/Tool/ContextTools.php`
- [Guidelines compiler](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Guidelines/GuidelinesCompiler.php): `src/Guidelines/GuidelinesCompiler.php`
- [Local overrides](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Guidelines/LocalOverrideHelper.php): `src/Guidelines/LocalOverrideHelper.php`
- [MCP resources](https://github.com/inchoo/magento-bricklayer/blob/develop/src/Mcp/Resource/GuidelinesResource.php): `src/Mcp/Resource/GuidelinesResource.php`

### Other components

- **AI coding agent**

## Connections

- AI coding agent → MCP server: requests tools (evidence: `README.md`)
- MCP server → Server factory: starts server
- Server factory → Tool registry: loads tools (evidence: `src/Mcp/McpServerFactory.php`)
- Server factory → Magento bootstrap: initializes runtime (evidence: `src/Mcp/McpServerFactory.php`)
- Tool registry → Runtime introspection: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Tool registry → Database inspection: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Tool registry → EAV inspection: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Tool registry → Routing and APIs: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Tool registry → Catalog operations: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Tool registry → Order operations: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Tool registry → Customer operations: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Tool registry → Diagnostics and performance: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Tool registry → Code runner: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Tool registry → Code generation: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Tool registry → Tool and docs search: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- Magento bootstrap → Magento detection: finds Magento root (evidence: `src/Bootstrap/MagentoBootstrap.php`)
- Magento bootstrap → Component registration: registers components (evidence: `src/Bootstrap/MagentoBootstrap.php`)
- Database inspection → Magento bootstrap: reads Magento services (evidence: `src/Mcp/Tool/DatabaseTools.php`)
- Routing and APIs → Magento bootstrap: reads route services (evidence: `src/Mcp/Tool/RoutingTools.php`)
- Development context → Guidelines compiler: loads guidance (evidence: `src/Guidelines/GuidelinesCompiler.php`)
- Development context → Local overrides: uses overrides (evidence: `src/Mcp/Tool/ContextTools.php`)
- Tool and docs search → Development context: finds guidance (evidence: `src/Mcp/Tool/SearchTools.php`)
- Tool registry → Development context: registers tools (evidence: `src/Mcp/Tool/ToolRegistry.php`)
- MCP resources → AI coding agent: provides resources
- CLI application → Agent setup: registers command (evidence: `src/Application.php`)
- Agent setup → Guidelines compiler: generates agent guidance (evidence: `src/Command/InstallCommand.php`)
- Agent setup → Tool configuration: configures tools
