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
DriverInterfacepattern, notfile_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
{"mcpServers": {"magento-coding-standard": {"command": "node", "args": ["/path/to/magento-coding-standard-mcp/dist/index.js"]}}}