faizan45640/WooCommerce-MCP-Server
If you are the rightful owner of WooCommerce-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
WooCommerce-MCP-Server is a server implementation designed to facilitate communication between WooCommerce and various model context protocols.
WooCommerce MCP Server
A Model Context Protocol (MCP) server for seamless WooCommerce integration, enabling AI assistants to interact with your WooCommerce store through natural language.
Features
- Product Management: Create, read, update, and delete products with full support for variations, categories, and attributes
- Order Processing: Retrieve and manage orders, update order statuses, and handle order fulfillment
- Customer Management: Access customer data, manage customer accounts, and view purchase history
- Inventory Control: Monitor stock levels, update inventory, and manage product availability
- Analytics & Reporting: Access store analytics, sales reports, and performance metrics
- Category & Tag Management: Organize products with categories and tags
- Coupon Management: Create and manage discount codes and promotional offers
- Store Configuration: Access and modify store settings and configuration options
Installation
- Clone the repository:
git clone https://github.com/faizan45640/WooCommerce-MCP-Server.git
cd WooCommerce-MCP-Server
- Install dependencies:
npm install
- Create a
.envfile with your WooCommerce credentials:
WOOCOMMERCE_URL=https://your-store.com
WOOCOMMERCE_CONSUMER_KEY=your_consumer_key
WOOCOMMERCE_CONSUMER_SECRET=your_consumer_secret
- Start the server:
npm start
Usage
Development
npm run dev
Production
npm start
Configuration
Create a .env file in the root directory with the following variables:
# WooCommerce Store Configuration
WOOCOMMERCE_URL=https://your-store.com
WOOCOMMERCE_CONSUMER_KEY=your_consumer_key
WOOCOMMERCE_CONSUMER_SECRET=your_consumer_secret
WOOCOMMERCE_API_VERSION=v3
# MCP Server Configuration
MCP_SERVER_PORT=3000
LOG_LEVEL=info
Getting WooCommerce API Credentials
- Go to your WordPress admin dashboard
- Navigate to WooCommerce ā Settings ā Advanced ā REST API
- Click "Add Key"
- Set Description (e.g., "MCP Server")
- Select User and Permissions (Read/Write recommended)
- Click "Generate API Key"
- Copy the Consumer Key and Consumer Secret to your
.envfile
Available Tools
The MCP server provides the following tools:
Products
get_products- Retrieve products with filtering optionsget_product- Get a specific product by IDcreate_product- Create a new productupdate_product- Update an existing productdelete_product- Delete a productsearch_products- Search products by termget_product_categories- Get product categories
Orders
get_orders- Retrieve orders with filtering optionsget_order- Get a specific order by IDcreate_order- Create a new orderupdate_order- Update order detailsupdate_order_status- Update order statusget_recent_orders- Get recent ordersget_order_stats- Get order statisticsadd_order_note- Add notes to orders
Customers
get_customers- Retrieve customer listget_customer- Get specific customer detailscreate_customer- Create a new customerupdate_customer- Update customer informationsearch_customers- Search customersget_customer_by_email- Find customer by emailget_customer_orders- Get customer's ordersget_customer_stats- Get customer statisticsget_top_customers- Get top spending customersget_new_customers- Get recently registered customers
Inventory
check_stock- Check product stock levelsupdate_stock- Update product inventoryget_low_stock_products- Get products with low stockget_out_of_stock_products- Get out-of-stock productsget_stock_report- Get comprehensive stock reportbulk_update_stock- Update multiple products' stock
Example Usage with Claude Desktop
Add this server to your Claude Desktop configuration:
{
"mcpServers": {
"woocommerce": {
"command": "node",
"args": ["path/to/WooCommerce-MCP-Server/src/index.js"]
}
}
}
Then you can interact with your WooCommerce store using natural language:
- "Show me the top 10 products by sales"
- "Create a new product called 'Premium T-Shirt' priced at $25"
- "Update order #123 status to 'completed'"
- "List all customers who made purchases this month"
- "Check which products are running low on stock"
- "Get me a summary of today's orders"
Development
Project Structure
src/
āāā index.js # Main server entry point
āāā services/
ā āāā woocommerce.js # WooCommerce API client
ā āāā products.js # Product management service
ā āāā orders.js # Order management service
ā āāā customers.js # Customer management service
āāā tools/
ā āāā index.js # Tool registry
ā āāā products/ # Product-related tools
ā āāā orders/ # Order-related tools
ā āāā customers/ # Customer-related tools
ā āāā inventory/ # Inventory-related tools
āāā utils/
āāā validation.js # Input validation utilities
āāā logger.js # Logging utilities
tests/ # Test files
Running Tests
npm test
Linting
npm run lint
npm run lint:fix
Environment Variables
| Variable | Description | Default | Required |
|---|---|---|---|
WOOCOMMERCE_URL | Your WooCommerce store URL | - | Yes |
WOOCOMMERCE_CONSUMER_KEY | API Consumer Key | - | Yes |
WOOCOMMERCE_CONSUMER_SECRET | API Consumer Secret | - | Yes |
WOOCOMMERCE_API_VERSION | API Version | v3 | No |
LOG_LEVEL | Logging level | info | No |
MCP_SERVER_PORT | Server port | 3000 | No |
Error Handling
The server includes comprehensive error handling:
- Input validation for all tool parameters
- WooCommerce API error responses
- Connection and timeout handling
- Detailed error logging
Security
- Uses OAuth 1.0a for secure API authentication
- Input validation to prevent injection attacks
- No sensitive data in logs
- Environment variable configuration
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Run tests:
npm test - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
License
This project is licensed under the MIT License - see the file for details.
Support
For support, please open an issue on the GitHub repository.
Roadmap
- Support for WooCommerce Subscriptions
- Advanced reporting and analytics
- Bulk operations for products and orders
- Integration with payment gateways
- Multi-store support
- Webhook support for real-time updates
- GraphQL API support
- Rate limiting and caching
- Docker containerization