Magento MCP Server
Enables natural language queries about Magento store catalog, sales, and customer data through dynamic tools for AI assistants.
README
Magento MCP Server
A Model Context Protocol (MCP) server that provides dynamic access to Magento e-commerce data for ChatGPT and other AI assistants. This server enables natural language queries about your Magento store's catalog, sales, and customer data.
Features
šļø Catalog Analysis
- Dynamic Product Queries: Ask questions like "How many products don't have images?" or "What's the average price of simple products?"
- Category Insights: Analyze category hierarchies, find categories with low product counts
- Flexible Filtering: Filter products by any field (status, type, price, dates, custom attributes)
š Sales Analytics
- Order Analysis: Get insights on average order value, sales by day of week, monthly trends
- Product Performance: Find top-selling products, analyze sales by time periods
- Revenue Metrics: Calculate revenue distributions, customer purchase patterns
š„ Customer Intelligence
- Behavior Analysis: Segment customers by value, frequency, recency
- Fraud Detection: Identify suspicious email patterns and potential fraud indicators
- Target Marketing: Find high-value customers, at-risk customers, or customers matching specific criteria
Installation
- Clone and Install Dependencies
cd /path/to/magento-mcp-server
npm install
- Configure Environment
cp .env.example .env
Edit .env with your Magento credentials:
MAGENTO_BASE_URL=https://your-magento-store.com
MAGENTO_ACCESS_TOKEN=your_admin_access_token_here
RATE_LIMIT=10
- Build the Project
npm run build
Getting Magento Access Token
- Log into Magento Admin Panel
- Navigate to System > Extensions > Integrations
- Create New Integration:
- Name: "MCP Server Integration"
- Your Password: [your admin password]
- Resources: Select "All" or specific resources you need
- Activate the Integration and copy the Access Token
Usage with ChatGPT
1. Add to ChatGPT Configuration
Add this to your ChatGPT MCP configuration file (usually ~/.config/chatgpt/mcp.json):
{
"mcpServers": {
"magento": {
"command": "node",
"args": ["/path/to/magento-mcp-server/dist/index.js"],
"env": {
"NODE_ENV": "production"
}
}
}
}
2. Start Using Natural Language Queries
Once connected, you can ask ChatGPT questions like:
Catalog Questions
- "How many products are there without any images?"
- "What's the price range of all active products?"
- "Show me categories with less than 20 products"
- "How many simple products vs configurable products do I have?"
Sales Questions
- "What's my average order value this year?"
- "Which day of the week has the most orders?"
- "What are my top 10 selling products in July and August?"
- "Show me monthly revenue trends for 2024"
Customer Questions
- "How many customers have suspicious email patterns?"
- "Who are my most valuable customers?"
- "Which customers haven't ordered in over 6 months?"
- "Find customers with lifetime value over $1000"
Available Tools
The server provides these dynamic tools that ChatGPT can use:
Catalog Tools
get_all_products- Retrieve products with filteringget_all_categories- Get category hierarchyanalyze_products- Custom product analysis with grouping and metricsanalyze_categories- Custom category analysis
Sales Tools
get_all_orders- Retrieve orders with filteringanalyze_orders- Custom order analysis with time groupinganalyze_product_sales- Product sales performance analysis
Customer Tools
get_all_customers- Retrieve customers with filteringanalyze_customers- Custom customer analysisanalyze_customer_behavior- Customer segmentation and behavior analysisfind_target_customers- Find customers matching specific criteria
Example Queries and How They Work
"How many products don't have images?"
ChatGPT will use analyze_products with metrics: ['without_images'] to get this information.
"What's my average order value this month?"
ChatGPT will use analyze_orders with date filters and calculate the average from the results.
"Which customers should I call to congratulate for being valuable?"
ChatGPT will use find_target_customers with minLifetimeValue and other criteria to identify VIP customers.
Development
Running in Development Mode
npm run dev
Building
npm run build
Project Structure
src/
āāā index.ts # Main MCP server entry point
āāā config.ts # Environment configuration
āāā magento-client.ts # Magento API client
āāā tools/
āāā catalog-tools.ts # Product and category analysis
āāā sales-tools.ts # Order and sales analysis
āāā customer-tools.ts # Customer analysis
Security Considerations
- API Token Security: Never commit your
.envfile. The access token has admin privileges. - Rate Limiting: The server includes rate limiting to prevent API abuse.
- Network Security: Ensure your Magento instance is properly secured with HTTPS.
Troubleshooting
Common Issues
-
"Configuration validation failed"
- Check your
.envfile has all required variables - Verify your Magento URL is correct and accessible
- Check your
-
"Failed to get products/orders/customers"
- Verify your access token has the required permissions
- Check if your Magento API is accessible
- Ensure rate limits aren't being exceeded
-
"Connection refused"
- Verify your Magento base URL is correct
- Check if your server can reach the Magento instance
Debug Mode
Set NODE_ENV=development for more detailed error messages.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
For issues and questions:
- Check the troubleshooting section above
- Review Magento API documentation
- Create an issue in the repository
Note: This server provides read-only access to your Magento data. It does not modify any store data, only retrieves and analyzes it for insights.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.