Warden Magento MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with safe, structured access to Magento 2 operations within Warden environments.
README
Warden Magento MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with safe, structured access to Magento 2 operations within Warden environments. Each server instance is bound to a specific Warden project, eliminating confusion when working with multiple environments.
When working with Magento code with this tool enabled, good AI models will call the appropriate tools after edits. The AI knows when to clear cache, run di:compile, and run static:deploy better than most developers. This saves considerable time and eliminates context switching. It also makes accessing logs easier, which is normally a minor pain to do manually.
⨠Features
- šÆ Project-specific servers: Each instance serves one Warden environment
- š§ Comprehensive Magento tools: Cache management, setup, deployment, indexing
- š³ Warden integration: Direct container execution via
warden env exec - š·ļø Clear identification: All responses show which project was targeted
- š Production logging: Winston-based logging with file rotation
- š Safe execution: Structured inputs only, no arbitrary shell access
š Quick Start
Option 1: Install from npm (Recommended)
# Install globally
npm install -g mcp-warden-magento
# Or use directly with npx
npx mcp-warden-magento --warden-root /Users/yourname/Documents/GitLab/warden-envs
Option 2: Build from source
- Install dependencies
pnpm install
- Build the project
pnpm run build
- Test with MCP Inspector
npx @modelcontextprotocol/inspector mcp-warden-magento --warden-root /Users/yourname/Documents/GitLab/warden-envs
Development Mode
For development with auto-reload (local terminal use only):
pnpm run dev --warden-root /Users/yourname/Documents/GitLab/warden-envs
Note: pnpm run dev outputs startup messages that break MCP Inspector's stdio protocol. Use the built version (node dist/index.js) for MCP Inspector and client configurations.
š Requirements
- Node.js ā„ 18
- Warden installed and services running (
brew install wardenenv/warden/warden && warden svc up) - Warden Magento 2 projects initialized (
warden env-init) and started (warden env start)
ā ļø Important: Zod Compatibility
This project requires Zod 3.x for MCP SDK compatibility. If you encounter keyValidator._parse is not a function errors:
pnpm remove zod && pnpm add zod@^3.23.8
pnpm run build
šÆ Primary Supported Clients
1. Cursor IDE (Recommended)
Installation:
- Open Cursor settings:
Cmd/Ctrl + , - Search for "MCP" or go to Extensions ā MCP
- Add server configurations to your workspace or user settings
Configuration Example:
{
"mcp.servers": {
"warden-magento": {
"command": "npx",
"args": ["mcp-warden-magento", "--warden-root", "/Users/yourname/Documents/GitLab/warden-envs"]
},
"warden-anotherwarden": {
"command": "npx",
"args": [
"mcp-warden-magento",
"--warden-root",
"/Users/yourname/Documents/GitLab/anotherwarden/warden-envs-anotherwarden"
]
}
}
}
Alternative: Using global installation
{
"mcp.servers": {
"warden-magento": {
"command": "mcp-warden-magento",
"args": ["--warden-root", "/Users/yourname/Documents/GitLab/warden-envs"]
}
}
}
Usage in Cursor:
- Use
@warden-magentoto target the magento project - Use
@warden-anotherwardento target the anotherwarden project - Example: "Hey @warden-magento, clear the config cache"
2. Claude Desktop
Installation:
- Locate your Claude Desktop config:
~/Library/Application Support/Claude/claude_desktop_config.json - Add MCP server entries
Configuration Example:
{
"mcpServers": {
"warden-magento": {
"command": "npx",
"args": ["mcp-warden-magento", "--warden-root", "/Users/yourname/Documents/GitLab/warden-envs"]
},
"warden-anotherwarden": {
"command": "npx",
"args": [
"mcp-warden-magento",
"--warden-root",
"/Users/yourname/Documents/GitLab/anotherwarden/warden-envs-anotherwarden"
]
}
}
}
Usage in Claude Desktop:
- Restart Claude Desktop after configuration changes
- Claude will automatically detect available tools from both servers
- All responses include project identification:
[magento2 @ magento2.test]
3. Claude Code (VS Code Extension)
Installation:
- Install the Claude Code extension from VS Code marketplace
- Configure MCP servers in VS Code settings
Configuration Example:
Add to your VS Code settings.json:
{
"claude-code.mcpServers": {
"warden-magento": {
"command": "npx",
"args": ["mcp-warden-magento", "--warden-root", "/Users/yourname/Documents/GitLab/warden-envs"]
},
"warden-anotherwarden": {
"command": "npx",
"args": [
"mcp-warden-magento",
"--warden-root",
"/Users/yourname/Documents/GitLab/anotherwarden/warden-envs-anotherwarden"
]
}
}
}
Usage in Claude Code:
- Use Claude Code commands to interact with Magento environments
- Each server appears as a separate MCP connection
- Project identification helps distinguish between environments
š ļø Available Tools
Magento Operations
magento.cacheCleanā Clean Magento cache typesmagento.cacheFlushā Flush Magento cache storagemagento.setupUpgradeā Run setup:upgrade + cache cleanmagento.diCompileā Compile dependency injectionmagento.staticDeployā Deploy static contentmagento.indexerReindexā Reindex all indexersmagento.modeShow/magento.modeSetā Show/set deploy modemagento.configSet/magento.configShowā Manage configuration
Warden Operations
warden.execā Execute commands in containerswarden.varnishFlushā Clear Varnish cachewarden.redisFlushAllā Flush Redis (use with caution)warden.logsTailā View recent container logswarden.showEnvā Display sanitized environment variableswarden.projectInfoā Show current project information
šļø Multi-Project Setup
Your GitLab Layout
~/Documents/GitLab/
āāā
ā āāā warden-envs/ # ā Point --warden-root here
ā āāā app/
ā āāā ...
āāā anotherwarden/
āāā warden-envs-anotherwarden/ # ā Point --warden-root here
āāā app/
āāā ...
Running Multiple Servers
# Terminal 1: magento server
npx mcp-warden-magento --warden-root /Users/yourname/Documents/GitLab/warden-envs
# Terminal 2: anotherwarden server
npx mcp-warden-magento --warden-root /Users/yourname/Documents/GitLab/anotherwarden/warden-envs-anotherwarden
# Or if installed globally:
mcp-warden-magento --warden-root /Users/yourname/Documents/GitLab/warden-envs
Benefits
- ā
Clear server names:
warden-magento-magentovswarden-magento-anotherwarden - ā No parameter confusion: No need to specify project in every tool call
- ā Concurrent usage: Run operations on both projects simultaneously
- ā
Project identification: All responses prefixed with
[project/env @ domain]
š Logging
Log Levels & Environment Configuration
- Development (
NODE_ENV=development): Debug-level console logging with colors (disabled automatically in MCP stdio mode) - Production (
NODE_ENV=production): Warning-level file logging with rotation
File Logging (Production)
When NODE_ENV=production or LOG_TO_FILE=true:
logs/mcp-warden-magento.logā All logs (JSON format, 5MB rotation)logs/mcp-warden-magento-error.logā Error logs only
Environment Variables
NODE_ENVā Set toproductionfor production loggingLOG_TO_FILEā Set totrueto enable file logging in any environmentLOG_DIRā Custom log directory (defaults to./logs)MCP_STDIO_MODEā Whentrue, disables console logging to protect MCP stdio transport
Examples
# Development with debug logging
NODE_ENV=development npx mcp-warden-magento --warden-root /path/to/warden/env
# Production with file logging
NODE_ENV=production npx mcp-warden-magento --warden-root /path/to/warden/env
# Force file logging in development
LOG_TO_FILE=true npx mcp-warden-magento --warden-root /path/to/warden/env
š§ Development
Scripts
pnpm run buildā Compile TypeScript todist/pnpm run devā Run with tsx (development only)pnpm run lintā Check code stylepnpm run formatā Format code with Prettier
Testing
# Test with MCP Inspector
npx @modelcontextprotocol/inspector mcp-warden-magento --warden-root /path/to/warden/env
# Test specific tools
# In Inspector UI, try: magento.cacheClean with { "types": ["config"] }
# Or: warden.projectInfo (no parameters needed)
Automated Tests
- Unit tests (Vitest):
pnpm run test:unit - E2E tests (Playwright):
pnpm run test:e2e
Notes:
- Unit tests cover env parsing/redaction, output cleaning, and input validation.
- E2E scaffolding is in place (Playwright) and ready to extend with a stubbed
wardenbinary and an MCP stdio client.
š Security
- Structured inputs only: All tools use Zod validation, no arbitrary shell execution
- Container isolation: Commands run inside Warden containers via
warden env exec - Environment validation: Server validates Warden project structure on startup
- Smart timeouts: Commands have execution timeouts (5 minutes default, 15 minutes for long operations like DI compile)
- Sanitized output: Environment variables are redacted in logs and responses
šØ Troubleshooting
Common Issues
"keyValidator._parse is not a function"
- Install Zod 3.x:
pnpm remove zod && pnpm add zod@^3.23.8
"WARDEN_ENV_NAME missing"
- Ensure you're pointing to the correct warden environment folder
- Run
warden env-initin your Magento project if needed
"Command not found: warden"
- Install Warden?
- Start services:
warden svc up
MCP client can't connect
- Ensure absolute paths in client configuration
- Check that the built
dist/index.jsfile exists - Verify Node.js ā„ 18 is installed
"Request timed out" for DI compile or static deploy
- These operations can take 10-20 minutes on large projects
- MCP Inspector: Increase timeout in Configuration ā
MCP_SERVER_REQUEST_TIMEOUTto 1200000 (20 minutes) - Cursor/Claude: The server automatically extends timeouts for long operations (20 minutes for DI compile)
- If still timing out, the operation may be stuck - check Magento logs
Debug Mode
NODE_ENV=development LOG_TO_FILE=true npx mcp-warden-magento --warden-root /path/to/env
# Check logs/mcp-warden-magento.log for detailed information
š¦ Publishing to npm
For maintainers:
# Test the package locally
pnpm run publish:dry
# Publish to npm (requires npm login)
npm publish
# Or publish with pnpm
pnpm publish
The prepublishOnly script will automatically run tests, linting, and build before publishing.
š¤ Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For questions or issues, please open a GitHub issue with:
- Your client configuration
- Server logs (with sensitive data redacted)
- Steps to reproduce the problem
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.