A Model Context Protocol (MCP) server that provides seamless integration with Magento 2 e-commerce platforms. This server enables AI assistants like Claude to interact with your Magento 2 store through a comprehensive set of tools for managing products, customers, orders, and more.
The MCP server is built and ready to use! However, you need to configure the Magento integration first:
- Review Setup Instructions: See SETUP.md for detailed configuration steps
- Enable Bearer Tokens: Run
bin/magento config:set oauth/consumer/enable_integration_as_bearer 1on your Magento server - Set Integration Permissions: Grant "All" resource access in Magento Admin β System β Integrations
- Test Connection: Run
npm testto verify everything works - Use with Claude: Add to Claude Desktop config (see USAGE.md)
This MCP server provides 18 powerful tools for interacting with Magento 2:
- magento_get_products - List products with optional search criteria
- magento_search_products - Search products by name
- magento_get_product - Get detailed product information by SKU
- magento_update_product - Update product information
- magento_update_stock - Update product stock levels
- magento_get_stock_status - Check stock status for a product
- magento_get_customers - List customers with optional search criteria
- magento_search_customers - Search customers by email
- magento_get_customer - Get detailed customer information by ID
- magento_get_orders - List orders with optional search criteria
- magento_get_order - Get detailed order information by ID
- magento_search_orders_by_email - Find orders by customer email
- magento_search_orders_by_status - Find orders by status (pending, processing, complete, etc.)
- magento_get_categories - Get category tree structure
- magento_get_category - Get detailed category information
- magento_get_cms_pages - List CMS pages
- magento_get_cms_page - Get specific CMS page content
- magento_get_store_config - Get store configuration
- Node.js 18 or higher
- A Magento 2 store with REST API access
- Magento 2 Integration Token (see setup instructions below)
- Log in to your Magento 2 admin panel
- Navigate to System > Extensions > Integrations
- Click Add New Integration
- Fill in the integration details:
- Name: "MCP Server Integration"
- Your Password: (enter your admin password)
- Go to the API tab
- Select Resource Access - choose "All" or specific resources you want to grant access to
- Click Save
- Click Activate on your new integration
- In the popup, click Allow
- Copy the Access Token - this is your
MAGENTO_ACCESS_TOKEN
Important Security Note: In Magento 2.4.4+, integration tokens are disabled as standalone Bearer tokens by default. To enable them:
bin/magento config:set oauth/consumer/enable_integration_as_bearer 1
bin/magento cache:flushOr enable via Admin: Stores > Configuration > Services > OAuth > Consumer Settings > Allow OAuth Access Tokens to be used as standalone Bearer tokens = Yes
- Clone this repository:
git clone <repository-url>
cd magento-mcp-server- Install dependencies:
npm install- Create a
.envfile in the root directory:
cp .env.example .env- Edit the
.envfile and add your Magento credentials:
MAGENTO_BASE_URL=https://licendi.com
MAGENTO_ACCESS_TOKEN=your_integration_token_here
API_TIMEOUT=30000- Build the project:
npm run buildStart the server:
npm startThe server will run on stdio and communicate via the Model Context Protocol.
Add this server to your Claude Desktop configuration file:
On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"magento": {
"command": "node",
"args": ["/absolute/path/to/magento-mcp-server/build/index.js"],
"env": {
"MAGENTO_BASE_URL": "https://licendi.com",
"MAGENTO_ACCESS_TOKEN": "your_integration_token_here"
}
}
}
}After adding the configuration, restart Claude Desktop.
This server uses the standard MCP protocol and can be integrated with any MCP-compatible client. The server communicates via stdio transport.
Once configured, you can ask Claude questions like:
- "Show me the latest 10 orders from my Magento store"
- "Search for products containing 'shirt' in the name"
- "Get the details of product with SKU 'ABC123'"
- "Update the stock quantity of SKU 'ABC123' to 50 units"
- "Find all orders with status 'pending'"
- "Show me all customers with email containing 'example.com'"
- "Get the category tree for my store"
- "What are the current store configuration settings?"
magento-mcp-server/
βββ src/
β βββ index.ts # Main MCP server implementation
β βββ magento-client.ts # Magento 2 REST API client
βββ build/ # Compiled JavaScript output
βββ package.json
βββ tsconfig.json
βββ .env.example
βββ README.md
Run TypeScript compiler in watch mode:
npm run devCompile TypeScript to JavaScript:
npm run buildThis server uses the Magento 2 REST API v1 endpoints. Key endpoints include:
/rest/V1/products- Product management/rest/V1/customers- Customer management/rest/V1/orders- Order management/rest/V1/categories- Category management/rest/V1/cmsPage- CMS page management/rest/V1/store/storeConfigs- Store configuration
For more information, see the Magento 2 REST API Documentation.
If you receive 401 Unauthorized errors:
- Verify your access token is correct
- Ensure the integration is activated in Magento admin
- Check that Bearer token authentication is enabled (see setup instructions)
- Verify the integration has the necessary API permissions
If you receive connection errors:
- Verify the
MAGENTO_BASE_URLis correct and accessible - Check if your Magento site has SSL/TLS enabled
- Verify firewall rules allow outbound HTTPS connections
- Try increasing the
API_TIMEOUTvalue in your.envfile
If the Magento store returns 503:
- Check if the store is in maintenance mode
- Verify the server is running and accessible
- Check Magento logs at
var/log/in your Magento installation
- Never commit your
.envfile to version control - Use integration tokens with minimal required permissions
- Rotate your access tokens periodically
- Consider using IP whitelisting for API access in production
- Monitor API usage and implement rate limiting if needed
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
For issues and questions:
- Check the Magento 2 REST API Documentation
- Review the Model Context Protocol Documentation
- Open an issue in this repository
Built with:
- Model Context Protocol SDK
- Magento 2 REST API
- TypeScript & Node.js