MCP server for Magento 2 products, orders and revenue
console applicationapt install mcp-server-magentoA Model Context Protocol (MCP) server that lets AI assistants query a Magento 2 store through its REST API.
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.
sudo apt install mcp-server-magento # server, /usr/bin/mcp-server-magento
sudo apt install mcprack-mcp-server-magento # optional: registers it in mcprack (read-only by default)
| Variable | Secret | Description |
|---|---|---|
MAGENTO_API_TOKEN |
yes | Bearer token (required) |
MAGENTO_BASE_URL |
no | e.g. https://shop.example.com/rest/V1 |
MAGENTO_READ_ONLY |
no | true hides tools that modify data |
MAGENTO_INSECURE_TLS |
no | true disables TLS verification (development only) |
MAGENTO_TIMEOUT_MS |
no | HTTP timeout, default 30000 |
All tools are read-only (get_*, search_*, advanced_product_search) except update_product_attribute (modifying, destructive, idempotent).
npm install
node mcp-server.js
node test-mcp-server.js
which nodemcpServers: "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
Tento balíček zatím možná není v naší databázi zaindexován. Zkuste to prosím později, nebo zkontrolujte přímo repozitář balíčků.