home / mcp / magento 2 dev mcp server

Magento 2 Dev MCP Server

An MCP server to help with Magento 2 development

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "elgentos-magento2-dev-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@elgentos/magento2-dev-mcp"
      ],
      "env": {
        "MAGERUN2_COMMAND": "n98-magerun2"
      }
    }
  }
}

You can run Magento 2 development tooling through an MCP server designed to integrate with AI agents. This server exposes Magento 2 development commands via a lightweight, scriptable interface so your AI assistant can perform module creation, DI inspection, deployment tasks, and system checks directly from your conversations.

How to use

To use this MCP server, configure your MCP client to connect to the local or remote server endpoint described below. You will send requests for Magento 2 development actions such as listing modules, creating modules, inspecting DI preferences, and managing caches. Your AI agent will then display results and let you chain commands through the assistant.

How to install

Prerequisites you need on your machine before installation:

1) Node.js installed on your system. You can verify with node -v and npm -v.

2) npm or yarn available to install and run MCP server commands.

Docker Environment Support

The MCP server automatically detects Docker-based Magento environments and routes magerun2 commands through the container. It supports multiple environments and chooses the correct command prefix based on the detected setup.

Supported environments and prefixes include the following:

- Warden: detected via WARDEN_ENV_TYPE in the .env file; use: warden shell -c '...'.

- DDEV: detected by the presence of the .ddev/ directory; use: ddev exec ... .

- docker-magento: detected by bin/clinotty; use: bin/clinotty ... .

- docker-compose: detected by docker-compose.yml or compose.yaml; use: docker compose exec -T <service> ... . The server will try common service names such as phpfpm, php-fpm, and php in that order.

If Docker execution fails, the server falls back to running the commands locally using magerun2.

Environment Variables

You can override the magerun2 binary name or path by setting MAGERUN2_COMMAND. This is useful when your system installs the binary under a different name or requires an absolute path.

Tools and usage notes

The server exposes a collection of Magento 2 development tools. Use them through your MCP client by invoking the corresponding tool names. Each tool returns results that you can review in the MCP client and, if supported, continue chaining with additional actions.

Available tools

get-di-preferences

Retrieve the Magento 2 dependency injection preferences for a given scope. Returns the DI configuration preferences across multiple scopes such as global, adminhtml, frontend, and API contexts.

dev-module-list

List all Magento 2 modules with their status. Supports filtering by enabled or disabled and various output formats.

dev-module-observer-list

List all module observers that are registered in Magento 2, with optional event filtering.

dev-theme-list

List all available Magento 2 themes, including metadata for each theme.

dev-module-create

Create and register a new Magento 2 module with a rich set of options for blocks, helpers, models, setup, and metadata like author and description.

dev-plugin-list

Analyze dependency injection plugins (interceptors) for a class, resolving inheritance and providing full execution order per scope.

sys-info

Produce a structured snapshot of Magento 2 system information in table, json, or csv formats.

sys-check

Validate system requirements and configuration for Magento 2 to ensure readiness for development or deployment.

cache-clean

Clear specific or all Magento 2 caches to ensure clean state during development.

cache-flush

Flush cache data to ensure changes are reflected and persisted.

cache-enable

Enable specific Magento 2 cache types to improve performance during development.

cache-disable

Disable specific Magento 2 cache types to facilitate debugging.

cache-status

Check the current status of Magento 2 caches.

cache-view

Inspect cache entries to inspect individual cache contents.

config-show

View Magento 2 configuration values, with optional path, scope, and scopeId.

config-set

Set Magento 2 configuration values with options for scope and encryption.

config-store-get

Get store-specific configuration values at the store level.

config-store-set

Set store-specific configuration values at the store level.

db-query

Execute SQL queries directly on the Magento 2 database and fetch results in multiple formats.

setup-upgrade

Run Magento 2 setup:upgrade to update database schema and data during development or deployment.

setup-di-compile

Compile Magento 2 dependency injection configuration to optimize performance.

setup-db-status

Check database status to determine if setup:upgrade is needed.

setup-static-content-deploy

Deploy Magento 2 static content and assets with options for languages, themes, and parallelism.

sys-store-list

List all Magento 2 stores, websites, and store views.

sys-store-config-base-url-list

List all base URLs for Magento 2 stores.

sys-url-list

Get all Magento 2 URLs with optional filtering by store.

sys-website-list

List all Magento 2 websites.

sys-cron-list

List all Magento 2 cron jobs and their configuration.

sys-cron-run

Run Magento 2 cron jobs, with options to target specific jobs or groups.