magento2 mcp
A Model Context Protocol server that connects to a Magento 2 REST API, allowing Claude and other MCP clients to query product information, customer data, and order statistics from a Magento store.
A Model Context Protocol server that connects to a Magento 2 REST API, allowing Claude and other MCP clients to query product information, customer data, and order statistics from a Magento store.
This is a Model Context Protocol (MCP) server that connects to a Magento 2 REST API, allowing Claude and other MCP clients to query product information from a Magento store.
npm install
node mcp-server.js
node test-mcp-server.js
which node
mcpServers
: "magento2": {
"command": "/path/to/your/node",
"args": ["/path/to/mcp-server.js"],
"env": {
"MAGENTO_BASE_URL": "https://YOUR_DOMAIN/rest/V1",
"MAGENTO_API_TOKEN": "your-api-token"
}
}
/path/to/your/node
with the path you checked in step 1/path/to/mcp-server.js
with the path where you cloned this repoThe server exposes the following tools:
get_product_by_sku
: Get detailed information about a product by its SKUsearch_products
: Search for products using Magento search criteriaget_product_categories
: Get categories for a specific product by SKUget_related_products
: Get products related to a specific product by SKUget_product_stock
: Get stock information for a product by SKUget_product_attributes
: Get all attributes for a product by SKUget_product_by_id
: Get detailed information about a product by its IDadvanced_product_search
: Search for products with advanced filtering optionsupdate_product_attribute
: Update a specific attribute of a product by SKUget_customer_ordered_products_by_email
: Get all ordered products for a customer by email addressget_order_count
: Get the number of orders for a given date rangeget_revenue
: Get the total revenue for a given date rangeget_revenue_by_country
: Get revenue filtered by country for a given date rangeget_product_sales
: Get statistics about the quantity of products sold in a given date rangeOnce the MCP server is connected to Claude Desktop, you can ask questions like:
For development purposes, the server is configured to bypass SSL certificate verification. In a production environment, you should use proper SSL certificates and remove the httpsAgent
configuration from the callMagentoApi
function.
To add new tools, follow the pattern in the existing code. Each tool is defined with:
ISC