MCP Integration for WooCommerce
🚀 Description
WordPress/WooCommerce plugin that implements the Model Context Protocol (MCP) to allow full control of the store by AI agents.
📍 Repository
📦 Installation
⚠️ IMPORTANT: How to Install Correctly
GitHub adds branch name to ZIP (-main), then you need to rename the folder:
Method 1: Rename and Repack (Recommended)
- Clique em Code → Download ZIP no GitHub
- Extract the file
mcp-woocommerce-integration-main.zip - Renomeie the folder extracted from
mcp-woocommerce-integration-mainparamcp-woocommerce - Compact the folder again
mcp-woocommerce(right click → Send to → Compacted folder) - No WordPress: Plugins → Add New → Submit Plugin
- Upload the new ZIP file and click Install Now
- Ative o plugin
Method 2: Via FTP (Faster)
- Download and extract the GitHub ZIP
- Rename the folder to
mcp-woocommerce - Send via FTP to
/wp-content/plugins/mcp-woocommerce/ - Active in the WordPress dashboard
Method 3: Clone via Git (Advanced)
cd /caminho/para/wp-content/plugins/
git clone https://github.com/marcelosolelua-ux/mcp-woocommerce-integration.git mcp-woocommerceExpected Structure After Installation
/wp-content/plugins/mcp-woocommerce/
├── mcp-woocommerce.php (arquivo principal)
├── README.md
├── inc/
│ ├── rest.php
│ ├── utils.php
│ ├── executor.php
│ ├── class-admin.php
│ └── methods/
│ ├── class-product.php
│ ├── class-order.php
│ ├── class-customer.php
│ └── class-store.php
└── logs/Requirements
- WordPress 5.0+
- WooCommerce 5.0+
- PHP 7.4+
🛠️ Configuration
- After activating, go to MCP WooCommerce no menu lateral
- Clique em Generate New Token
- Give a name and select the permissions (Read/Write/Admin)
- Copy the generated token
- Use o endpoint:
https://seusite.com/wp-json/mcp/v1/execute
Quick setup in GPTMaker (MCP Terminal)
- MCP server URL:
https://seusite.com/wp-json/mcp/v1/execute - Authentication: send the token to the header
X-MCP-Key:ouAuthorization: Bearer(GPTMaker usually uses the Bearer standard). - Automatic Capabilities:
https://seusite.com/wp-json/mcp/v1/capabilitiesreturns the JSON manifest ready to be imported into the GPTMaker panel (includes support forAuthorization: Bearer). - Formato: JSON-RPC 2.0 (campos
jsonrpc,id,method,params).
🔐 Authentication
All requests must include the header:
X-MCP-Key: seu_token_de_64_caracteres📡 Endpoint
POST /wp-json/mcp/v1/execute
Content-Type: application/json📝 Example of Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "wc.list_products",
"params": {
"page": 1,
"per_page": 10
}
}Exemplo com cURL
curl -X POST https://seusite.com/wp-json/mcp/v1/execute \
-H "Content-Type: application/json" \
-H "X-MCP-Key: seu_token_aqui" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "wc.get_product",
"params": {"id": 123}
}'📚 Available Methods
Products
wc.get_product- Get product by IDwc.search_products- Search products by name/SKUwc.list_products- List products with paginationwc.update_stock- Update stockwc.update_price- Update pricewc.create_product- Create a new product
Orders
wc.get_order- Order by IDwc.list_orders- List orderswc.create_order- Create new orderwc.update_order_status- Update order status
Clients
wc.get_customer- Get customer by ID or emailwc.list_customers- List customerswc.create_customer- Create new customer
Shop
wc.get_store_info- General store informationwc.get_categories- List product categorieswc.get_coupons- List active coupons
🛡️ Security
- ✅ Rate limiting: 60 requests/minute per token
- ✅ Automatic locking after 5 consecutive errors
- ✅ Detailed logs of all operations
- ✅ Complete sanitation of inputs
- ✅ Granular permission system (read/write/admin)
- ✅ 64-character tokens generated with random_bytes()
📄 Capabilities JSON
The plugin generates the automatic manifest for AI agents:
- Endpoint REST:
https://seusite.com/wp-json/mcp/v1/capabilities - Local file (optional):
https://seusite.com/wp-content/plugins/mcp-woocommerce/capabilities.json
🐛 Problem Solving
Plugin not listed
- Check if the folder is named as
mcp-woocommerce(sem-main) - Confirm that the file
mcp-woocommerce.phpis at the root of the plugin folder - Check if WooCommerce is active
Error Activating
- Make sure WooCommerce is installed
- Check PHP version (minimum 7.4)
- Check logs in
/wp-content/plugins/mcp-woocommerce/logs/
Token does not work
- Check if the header is
X-MCP-Key(with name) - Confirm that the token is active in the admin panel
- See the logs for details of the error
📝 Logs
All logs are saved to:
/wp-content/plugins/mcp-woocommerce/logs/mcp-logs.logYou can also view them in the panel MCP WooCommerce → Recent Logs
✅ Local rapid tests
To validate PHP syntax before installing on WordPress, run at the root of the repository:
for f in mcp-woocommerce.php $(find inc -name '*.php'); do php -l "$f"; doneThe command should return "No syntax errors detected" for all files.
The file capabilities.json is automatically regenerated on each plugin load if the version or protocol changes, ensuring that the manifest used by GPTMaker is always synchronized.
📄 License
MIT License
👨💻 Author
Developed by ChatGPT according to RPD v1.0 specifications
