Magento 2 Coding Standards MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/Midhun-edv/magento-coding-standard-mcp.git
cd magento-coding-standard-mcp
npm install
npm run build
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add magento-coding-standard -- node "<FULL_PATH_TO_MAGENTO_CODING_STANDARD_MCP>/dist/index.js"

Replace <FULL_PATH_TO_MAGENTO_CODING_STANDARD_MCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

Provides AI assistants with comprehensive Magento 2 coding standards.

Magento 2 Coding Standards MCP Server

An MCP (Model Context Protocol) server that provides comprehensive Magento 2 coding standards knowledge, enabling AI assistants to write Magento-compliant code naturally — vibe coding for Magento.

Works with Claude Code, Claude Desktop, Cursor IDE, VS Code Copilot, Gemini CLI, Continue.dev, Windsurf, Augment Code, and any MCP-compatible client.


Why This Exists

Writing Magento 2 code correctly is hard. There are 83+ coding standard rules, 150+ discouraged functions, 50+ restricted classes, theme-specific conventions, and security requirements that developers must follow. AI assistants don't know these rules — they generate code that looks correct but violates Magento standards.

This MCP server teaches AI assistants Magento's rules so they write compliant code from the start:

  • Ask for a "jQuery widget" with Hyva theme active → get Alpine.js component instead
  • Paste PHP code → get instant validation with line numbers and fix suggestions
  • Ask "how to read a file" → get DriverInterface pattern, not file_get_contents()

Features

  • 83+ Coding Standard Rules — Security, Legacy, PHP, Functions, Templates, LESS/CSS, GraphQL, HTML, Framework, Exceptions, and more
  • 150+ Discouraged Functions — Every PHP function Magento wants you to avoid, with the correct replacement
  • 50+ Restricted Classes — Zend Framework → Laminas migrations, deprecated class replacements
  • 25+ jQuery Deprecations — Deprecated jQuery methods with modern replacements
  • 19 LESS/CSS Rules — Frontend styling standards
  • 7 MCP Tools — Pattern lookup, code validation, security checking, rule explanations, theme management
  • 4 Built-in Theme Presets — Hyva, Luma, Breeze, Porto with full validation rules and pattern overrides
  • Custom Theme Support — Add your own theme standards via JSON files
  • Multi-Platform — Works with every major AI coding tool

Quick Start

1. Clone and Build

git clone https://github.com/Midhun-edv/magento-coding-standard-mcp.git
cd magento-coding-standard-mcp
npm install
npm run build

2. Connect to Your AI Tool

Pick your platform below and add the MCP server:

Claude Code (CLI)
claude mcp add magento-coding-standard -- node /path/to/magento-coding-standard-mcp/dist/index.js
Claude Desktop

Add to your claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "magento-coding-standard": {
      "command": "node",
      "args": ["/path/to/magento-coding-standard-mcp/dist/index.js"]
    }
  }
}
Cursor IDE

Add to .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "magento-coding-standard": {
      "command": "node",
      "args": ["/path/to/magento-coding-standard-mcp/dist/index.js"]
    }
  }
}
VS Code Copilot

Add to .vscode/mcp.json in your project root:

{
  "servers": {
    "magento-coding-standard": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/magento-coding-standard-mcp/dist/index.js"]
    }
  }
}
Gemini CLI

Add to ~/.gemini/settings.json:

{
  "mcpServers": {
    "magento-coding-standard": {
      "command": "node",
      "args": ["/path/to/magento-coding-standard-mcp/dist/index.js"]
    }
  }
}
Continue.dev

Add to ~/.continue/config.json:

{
  "mcpServers": [
    {
      "name": "magento-coding-standard",
      "command": "node",
      "args": ["/path/to/magento-coding-standard-mcp/dist/index.js"]
    }
  ]
}
Windsurf

Add to Windsurf MCP settings:

{
  "mcpServers": {
    "magento-coding-standard": {
      "command": "node",
      "args": ["/path/to/magento-coding-standard-mcp/dist/index.js"]
    }
  }
}
Augment Code

Add in Augment Code settings:

{
  "mcpServers": {
    "magento-coding-standard": {
      "command": "node",
      "args": ["/path/to/magento-coding-standard-mcp/dist/index.js"]
    }
  }
}

Note: Replace /path/to/ with your actual installation path. On Windows, use forward slashes: C:/Users/name/magento-coding-standard-mcp/dist/index.js


Available Tools

1. `get_magento_pattern`

Get the correct Magento 2 way to accomplish a task. Returns the proper pattern, code example, what to avoid, and why.

Task: "read a file"
→ Returns: DriverInterface::fileGetContents() with full example, avoidPatterns, explanation

Supported tasks: File operations, Escaping (HTML/URL/JS/CSS), JSON/Serialization, Validation, Templates/ViewModels, HTTP requests, JavaScript (RequireJS, UI Components, Widgets), Translation, Logging, Database queries

When a theme is active, patterns are automatically overridden with theme-specific versions (e.g., "jQuery widget" → Alpine.js component when Hyva is active).

2. `validate_code`

Validate code ag

Tools (2)

get_magento_patternGet the correct Magento 2 way to accomplish a task including patterns, code examples, and what to avoid.
validate_codeValidate PHP code against Magento 2 coding standards and receive fix suggestions.

Configuration

claude_desktop_config.json
{"mcpServers": {"magento-coding-standard": {"command": "node", "args": ["/path/to/magento-coding-standard-mcp/dist/index.js"]}}}

Try it

What is the correct Magento 2 pattern for reading a file?
Validate this PHP code snippet for Magento 2 compliance: [paste code]
How do I implement a jQuery widget when the Hyva theme is active?
Show me the restricted classes I should avoid when migrating from Zend Framework to Laminas.

Frequently Asked Questions

What are the key features of Magento 2 Coding Standards?

83+ coding standard rules covering security, PHP, and framework conventions. 150+ discouraged functions with recommended replacements. Theme-specific validation for Hyva, Luma, Breeze, and Porto. Real-time code validation with line-by-line fix suggestions. Pattern lookup for Magento-compliant implementation of common tasks.

What can I use Magento 2 Coding Standards for?

Ensuring AI-generated code follows Magento 2 security and performance standards. Migrating legacy Zend Framework code to modern Laminas-based Magento structures. Switching between frontend stack patterns like jQuery and Alpine.js based on the active theme. Automating code reviews for Magento 2 modules to catch discouraged functions.

How do I install Magento 2 Coding Standards?

Install Magento 2 Coding Standards by running: git clone https://github.com/Midhun-edv/magento-coding-standard-mcp.git && cd magento-coding-standard-mcp && npm install && npm run build

What MCP clients work with Magento 2 Coding Standards?

Magento 2 Coding Standards works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Magento 2 Coding Standards docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare