home / mcp / magento 2 dev mcp server
An MCP server to help with Magento 2 development
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.
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.
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.
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.
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.
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.
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.
List all Magento 2 modules with their status. Supports filtering by enabled or disabled and various output formats.
List all module observers that are registered in Magento 2, with optional event filtering.
List all available Magento 2 themes, including metadata for each theme.
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.
Analyze dependency injection plugins (interceptors) for a class, resolving inheritance and providing full execution order per scope.
Produce a structured snapshot of Magento 2 system information in table, json, or csv formats.
Validate system requirements and configuration for Magento 2 to ensure readiness for development or deployment.
Clear specific or all Magento 2 caches to ensure clean state during development.
Flush cache data to ensure changes are reflected and persisted.
Enable specific Magento 2 cache types to improve performance during development.
Disable specific Magento 2 cache types to facilitate debugging.
Check the current status of Magento 2 caches.
Inspect cache entries to inspect individual cache contents.
View Magento 2 configuration values, with optional path, scope, and scopeId.
Set Magento 2 configuration values with options for scope and encryption.
Get store-specific configuration values at the store level.
Set store-specific configuration values at the store level.
Execute SQL queries directly on the Magento 2 database and fetch results in multiple formats.
Run Magento 2 setup:upgrade to update database schema and data during development or deployment.
Compile Magento 2 dependency injection configuration to optimize performance.
Check database status to determine if setup:upgrade is needed.
Deploy Magento 2 static content and assets with options for languages, themes, and parallelism.
List all Magento 2 stores, websites, and store views.
List all base URLs for Magento 2 stores.
Get all Magento 2 URLs with optional filtering by store.
List all Magento 2 websites.
List all Magento 2 cron jobs and their configuration.
Run Magento 2 cron jobs, with options to target specific jobs or groups.