Magento 2 MCP Server
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.
README
Magento 2 MCP Server
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.
Features
Product Features
- Query product information by SKU or ID
- Search for products using various criteria
- Get product categories
- Get related products
- Get product stock information
- Get product attributes
- Update product attributes by specifying attribute code and value
- Advanced product search with filtering and sorting
Customer Features
- Get all ordered products for a customer by email address
Order and Revenue Features
- Get order count for specific date ranges
- Get revenue for specific date ranges
- Get revenue filtered by country for specific date ranges
- Get product sales statistics including quantity sold and top-selling products
- Support for relative date expressions like "today", "yesterday", "last week", "this month", "YTD"
- Support for country filtering using both country codes and country names
Prerequisites
- Node.js (v14 or higher)
- A Magento 2 instance with REST API access
- API token for the Magento 2 instance
Installation
- Clone this repository
- Install dependencies:
npm install
Usage
Running the server directly
node mcp-server.js
Testing with the test client
node test-mcp-server.js
Using with Claude Desktop
- Check your path node with
which node - Go to the Developer settings and click "Edit config". This will open a JSON file.
- Add the following snippet within the
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"
}
}
- Replace
/path/to/your/nodewith the path you checked in step 1 - Replace
/path/to/mcp-server.jswith the path where you cloned this repo - You can get an API token from System > Integrations in the Magento admin
- Restart Claude Desktop.
- You should now be able to ask Claude questions about products in your Magento store.
Available Tools
The server exposes the following tools:
Product 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 SKU
Customer Tools
get_customer_ordered_products_by_email: Get all ordered products for a customer by email address
Order and Revenue Tools
get_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 range
Example Queries for Claude
Once the MCP server is connected to Claude Desktop, you can ask questions like:
Product Queries
- "What products do you have that are shirts?"
- "Tell me about product with SKU SKU-xxx"
- "What categories does product SKU-xxx belong to?"
- "Are there any related products to SKU-SKU-xxx?"
- "What's the stock status of product SKU-xxx?"
- "Show me all products sorted by price"
- "Update the price of product SKU-xxx to $49.99"
- "Change the description of product ABC-123 to describe it as water-resistant"
- "Set the status of product XYZ-456 to 'enabled'"
Customer Queries
- "What products has customer john.doe@example.com ordered?"
- "Show me the order history and products for customer with email jane.smith@example.com"
Order and Revenue Queries
- "How many orders do we have today?"
- "What's our order count for last week?"
- "How much revenue did we generate yesterday?"
- "What was our total revenue last month?"
- "How much revenue did we make in The Netherlands this year to date?"
- "What's our revenue in Germany for the last week?"
- "Compare our revenue between the US and Canada for this month"
- "What's our average order value for completed orders this month?"
- "How many products did we sell last month?"
- "What are our top-selling products this year?"
- "What's the average number of products per order?"
- "How many units of product XYZ-123 did we sell in Germany last quarter?"
- "Which products generated the most revenue in the US this month?"
Development
SSL Certificate Verification
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.
Adding New Tools
To add new tools, follow the pattern in the existing code. Each tool is defined with:
- A unique name
- A description
- Input parameters with validation using Zod
- An async handler function that processes the request and returns a response
License
ISC
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。