Skip to main content
Glama
Magento 2 MCP Server

Magento 2 MCP Server

by boldcommerce

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

Related MCP server: keycrm-mcp

Prerequisites

  • Node.js (v14 or higher)

  • A Magento 2 instance with REST API access

  • API token for the Magento 2 instance

Installation

  1. Clone this repository

  2. 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

  1. Check your path node with which node

  2. Go to the Developer settings and click "Edit config". This will open a JSON file.

  3. 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"
      }
    }
  1. Replace /path/to/your/node with the path you checked in step 1

  2. Replace /path/to/mcp-server.js with the path where you cloned this repo

  3. You can get an API token from System > Integrations in the Magento admin

  4. Restart Claude Desktop.

  5. 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 SKU

  • search_products: Search for products using Magento search criteria

  • get_product_categories: Get categories for a specific product by SKU

  • get_related_products: Get products related to a specific product by SKU

  • get_product_stock: Get stock information for a product by SKU

  • get_product_attributes: Get all attributes for a product by SKU

  • get_product_by_id: Get detailed information about a product by its ID

  • advanced_product_search: Search for products with advanced filtering options

  • update_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 range

  • get_revenue: Get the total revenue for a given date range

  • get_revenue_by_country: Get revenue filtered by country for a given date range

  • get_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

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:

  1. A unique name

  2. A description

  3. Input parameters with validation using Zod

  4. An async handler function that processes the request and returns a response

License

ISC

Available Tools

14 tools
get_customer_ordered_products_by_emailC

Get all ordered products for a customer by email address

Inputs: email (required).

get_order_countC

Get the number of orders for a given date range

Inputs: date_range (required), status.

get_product_attributesC

Get all attributes for a product by SKU

Inputs: sku (required).

get_product_by_idB

Get detailed information about a product by its ID

Inputs: id (required).

get_product_by_skuC

Get detailed information about a product by its SKU

Inputs: sku (required).

get_product_categoriesC

Get categories for a specific product by SKU

Inputs: sku (required).

get_product_salesB

Get statistics about the quantity of products sold in a given date range

Inputs: date_range (required), status, country.

get_product_stockC

Get stock information for a product by SKU

Inputs: sku (required).

get_revenueB

Get the total revenue for a given date range

Inputs: date_range (required), status, include_tax.

get_revenue_by_countryC

Get revenue filtered by country for a given date range

Inputs: date_range (required), country (required), status, include_tax.

search_productsC

Search for products using Magento search criteria

Inputs: query (required), page_size, current_page.

update_product_attributeC

Update a specific attribute of a product by SKU

Inputs: sku (required), attribute_code (required), value.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 14 tools

    Disambiguation4/5

    Most tools have distinct purposes focused on specific data retrieval or updates, but there is some overlap between 'advanced_product_search' and 'search_products' which could cause confusion as both search for products. The other tools are clearly differentiated by their target resources (products, orders, customers, revenue) and actions.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using snake_case, with verbs like 'get', 'search', and 'update' clearly indicating actions. This uniformity makes the tool set predictable and easy to navigate, with no deviations in naming conventions.

    Tool Count5/5

    With 14 tools, the server is well-scoped for a Magento 2 e-commerce platform, covering key areas like products, orders, customers, and revenue. Each tool serves a specific purpose without bloat, making the count appropriate for the domain's complexity.

    Completeness4/5

    The tool set provides strong coverage for data retrieval and some updates in the e-commerce domain, including product details, sales, and revenue. However, there are minor gaps such as the lack of tools for creating or deleting products or orders, which agents might need to work around for full CRUD operations.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that lets Claude manage keyCRM catalogue, stock, orders, customers, pipelines, and more via natural language.
      3
      ISC
    • F
      license
      Not graded
      quality
      C
      maintenance
      Freento MCP is a native Magento 2 extension that implements the Model Context Protocol (MCP) — an open standard for connecting AI assistants to external data sources. This server acts as a secure, direct bridge between your Adobe Commerce / Magento 2 store and LLM-powered assistants (like Claude, ChatGPT, and others), allowing you to manage and audit your store using natural language.
      18
      -