๐ WooCommerce MCP Server | Python Edition
ืคืชืจืื ืคืฉืื ืืืขืื ืืืืืืจ ืื ืืืืช WooCommerce ืขื Model Context Protocol
๐บ๐ธ English Version | ๐ฎ๐ฑ ืืจืกื ืขืืจืืช
๐ ืื ืื?
ืฉืจืช Model Context Protocol (MCP) ืืืืคืฉืจ ืืื ืืืจืฆืื ืืืื ืขื ืื ืืืืช WooCommerce ืืืืฆืขืืช ื-WordPress REST API. ืืกืคืจืืื ืืกืคืงืช ืืืื ืืงืืคืื ืื ืืืื ืื ืืืืื ืืืืฆืจืื, ืืืื ืืช, ืืงืืืืช, ืืฉืืื, ืืืกืื, ืื ืืืช ืืงืื ืคืืืืจืฆืืืช ืืื ืืช.
๐ ืืชืงื ื ืืืืจื
# ืฉืื 1: ืฉืืคื ืืช ืืจืคืืืืืืจื
git clone https://github.com/yourusername/woocommerce-mcp-server.git
cd woocommerce-mcp-server
# ืฉืื 2: ืืชืงื ืชืืืืืช
pip install -r requirements.txt
# ืฉืื 3: ืืืืจ ืืฉืชื ื ืกืืืื (ืจืื ืืกืืจ ืืืืฉื)
โ๏ธ ืคืจืืกื ื-Railway
ืืฉืจืช ืืืื ืืคืจืืกื ืืืืืืช ืืคืืืคืืจืืช Railway:
# ืฉืื 1: ืฉืืคื ืืช ืืจืคืืืืืืจื ืืืฉืืื GitHub ืฉืื
# ืฉืื 2: ืืืื ืก ื-Railway ืืืชืืืจ ืขื ืืฉืืื GitHub
# https://railway.app/
# ืฉืื 3: ืืืฅ ืขื "New Project" ืืืืจ "Deploy from GitHub repo"
# ืฉืื 4: ืืืจ ืืช ืืจืคืืืืืืจื ืืืฉืืืคื
# ืฉืื 5: ืืืืจ ืืช ืืฉืชื ื ืืกืืืื ืืืืื:
# - WORDPRESS_SITE_URL
# - WOOCOMMERCE_CONSUMER_KEY
# - WOOCOMMERCE_CONSUMER_SECRET
# - WORDPRESS_USERNAME (ืืืคืฆืืื ืื)
# - WORDPRESS_PASSWORD (ืืืคืฆืืื ืื)
# - MCP_HOST=0.0.0.0
# - MCP_PORT=8000
# ืฉืื 6: ืืืชื ืืกืืื ืืื ืืื ืืืคืจืืกื
ืืชืจืื ืืช ืคืจืืกื ื-Railway:
- ๐ ืคืจืืกื ืืืืืืืืช ื-GitHub
- ๐ SSL ืืืืืืื
- ๐ ื ืืืืจ ืืืืืื ืืืื ืื
- ๐ ืืืืืื ืืื ืื ืืืื ื (ืชืช-ืืืืืื ืฉื railway.app)
- โก ืกืงืืืืื ื ืืืืืืื ืืคื ืืฆืืจื
โ๏ธ ืงืื ืคืืืืจืฆืื
ืืฉ ืืืฆืืจ ืงืืืฅ .env
ืืชืืงืืืช ืืืกืืก ืฉื ืืคืจืืืงื ืขื ืืคืจืืื ืืืืื:
WORDPRESS_SITE_URL=https://your-wordpress-site.com
WOOCOMMERCE_CONSUMER_KEY=your-woocommerce-consumer-key
WOOCOMMERCE_CONSUMER_SECRET=your-woocommerce-consumer-secret
WORDPRESS_USERNAME=your-wordpress-username
WORDPRESS_PASSWORD=your-wordpress-password
ืืฉืชื ื ืกืืืื
ืืฉืชื ื | ืชืืืืจ | ื ืืจืฉ |
---|
WORDPRESS_SITE_URL | ืืชืืืช ืืืชืจ ืฉืื (WooCommerce ืืื ืคืืืืื ืฉื WordPress) | โ
|
WOOCOMMERCE_CONSUMER_KEY | ืืคืชื ืฆืจืื WooCommerce REST API | โ
|
WOOCOMMERCE_CONSUMER_SECRET | ืกืื ืฆืจืื WooCommerce REST API | โ
|
WORDPRESS_USERNAME | ืฉื ืืฉืชืืฉ WordPress ืขื ืืจืฉืืืช ืืชืืืืืช | โ ๏ธ * |
WORDPRESS_PASSWORD | ืกืืกืืช WordPress ืืืืืืช | โ ๏ธ * |
* ื ืืจืฉ ืจืง ืขืืืจ ืฉืืืืช WordPress API
๐ ืืคืฉืจืืืืช ืืืืืช
ืืืืืช WooCommerce
ืืืฉื ื-API ืฉื WooCommerce ืืืจืฉืช ืืคืชืืืช ืฆืจืื ืฉื ืืชื ืืืฆืืจ ืืืื ืืืงืจื ืฉื WordPress ืชืืช WooCommerce โ ืืืืจืืช โ ืืชืงืื โ REST API.
ืืืืืช WordPress
ืขืืืจ ืฉืืืืช ืกืคืฆืืคืืืช ื-WordPress (ืืื ื ืืืื ืคืืกืืื), ืืฉ ืืกืคืง:
- ืืืฉืืจื ืฉื ืืฉืชืืฉ/ืกืืกืื ืืืืืืช ืืกืืกื
- ื-REST API ืฉื WordPress ืืืื ืืืืืช ืืืคืขื ืืืชืจ ืฉืื
๐ ืฉืืืืช API
ืืฉืจืช ืชืืื ืืฉืืืืช API ืฉื WordPress ื-WooCommerce. ืืืื ืจืฉืืืช ืืฉืืืืช ืืืืื ืืช ืืงืืืฆืืช ืืคื ืงืืืืจืื:
ื ืืืื ืชืืื WordPress
ืฉืืืืช ืืื ืืืจืฉืืช ืืืฉืืจื ืฉื ืืฉืชืืฉ/ืกืืกืื ืฉื WordPress ืืื ืขืฆืืืืืช ืื-API ืฉื WooCommerce.
ืฉืืื | ืชืืืืจ |
---|
create_post | ืืฆืืจืช ืคืืกื WordPress ืืืฉ |
get_posts | ืงืืืช ืคืืกืืื ื-WordPress |
update_post | ืขืืืื ืคืืกื WordPress ืงืืื |
get_post_meta | ืงืืืช ืืื-ืืืื ืฉื ืคืืกื |
update_post_meta | ืขืืืื ืืื-ืืืื ืฉื ืคืืกื |
create_post_meta | ืืฆืืจืช ืืื-ืืืื ืฉื ืคืืกื |
delete_post_meta | ืืืืงืช ืืื-ืืืื ืฉื ืคืืกื |
ืืืฆืจื WooCommerce
ืฉืืื | ืชืืืืจ |
---|
get_products | ืงืืืช ืจืฉืืืช ืืืฆืจืื |
get_product | ืงืืืช ืืืฆืจ ืืืื ืืคื ืืืื |
create_product | ืืฆืืจืช ืืืฆืจ ืืืฉ |
update_product | ืขืืืื ืืืฆืจ ืงืืื |
delete_product | ืืืืงืช ืืืฆืจ |
get_product_meta | ืงืืืช ืืื-ืืืื ืฉื ืืืฆืจ |
create_product_meta | ืืฆืืจื/ืขืืืื ืืื-ืืืื ืฉื ืืืฆืจ |
update_product_meta | ืขืืืื ืืื-ืืืื ืฉื ืืืฆืจ (ืืื ืื ืืืฆืืจื) |
delete_product_meta | ืืืืงืช ืืื-ืืืื ืฉื ืืืฆืจ |
ืงืืืืจืืืช ืืืฆืจืื
ืฉืืื | ืชืืืืจ |
---|
get_product_categories | ืงืืืช ืงืืืืจืืืช ืืืฆืจืื |
get_product_category | ืงืืืช ืงืืืืจืืืช ืืืฆืจ ืืืืืช |
create_product_category | ืืฆืืจืช ืงืืืืจืืืช ืืืฆืจ ืืืฉื |
update_product_category | ืขืืืื ืงืืืืจืืืช ืืืฆืจ |
delete_product_category | ืืืืงืช ืงืืืืจืืืช ืืืฆืจ |
ืชืืืืช ืืืฆืจืื
ืฉืืื | ืชืืืืจ |
---|
get_product_tags | ืงืืืช ืชืืืืช ืืืฆืจืื |
get_product_tag | ืงืืืช ืชืืืช ืืืฆืจ ืืืืืช |
create_product_tag | ืืฆืืจืช ืชืืืช ืืืฆืจ ืืืฉื |
update_product_tag | ืขืืืื ืชืืืช ืืืฆืจ |
delete_product_tag | ืืืืงืช ืชืืืช ืืืฆืจ |
ืืืคืืื ื ืืืฆืจืื
ืฉืืื | ืชืืืืจ |
---|
get_product_attributes | ืงืืืช ืืืคืืื ื ืืืฆืจืื |
get_product_attribute | ืงืืืช ืืืคืืื ืืืฆืจ ืืืื |
create_product_attribute | ืืฆืืจืช ืืืคืืื ืืืฆืจ ืืืฉ |
update_product_attribute | ืขืืืื ืืืคืืื ืืืฆืจ |
delete_product_attribute | ืืืืงืช ืืืคืืื ืืืฆืจ |
get_attribute_terms | ืงืืืช ืืื ืื ืืืคืืื |
get_attribute_term | ืงืืืช ืืื ื ืืืคืืื ืืืื |
create_attribute_term | ืืฆืืจืช ืืื ื ืืืคืืื ืืืฉ |
update_attribute_term | ืขืืืื ืืื ื ืืืคืืื |
delete_attribute_term | ืืืืงืช ืืื ื ืืืคืืื |
ืืจืืืฆืืืช ืืืฆืจืื
ืฉืืื | ืชืืืืจ |
---|
get_product_variations | ืงืืืช ืืจืืืฆืืืช ืืืฆืจืื |
get_product_variation | ืงืืืช ืืจืืืฆืืืช ืืืฆืจ ืืืืืช |
create_product_variation | ืืฆืืจืช ืืจืืืฆืืืช ืืืฆืจ ืืืฉื |
update_product_variation | ืขืืืื ืืจืืืฆืืืช ืืืฆืจ |
delete_product_variation | ืืืืงืช ืืจืืืฆืืืช ืืืฆืจ |
batch_update_product_variations | ืขืืืื ืืฆืืื ืฉื ืืจืืืฆืืืช ืืืฆืจืื |
ืืขืจืืช ืืืื ื
ืฉืืื | ืชืืืืจ |
---|
get_order_notes | ืงืืืช ืืขืจืืช ืืืื ื |
get_order_note | ืงืืืช ืืขืจืช ืืืื ื ืืืืืช |
create_order_note | ืืฆืืจืช ืืขืจืช ืืืื ื ืืืฉื |
delete_order_note | ืืืืงืช ืืขืจืช ืืืื ื |
ืืืืจื ืืืื ืืช
ืฉืืื | ืชืืืืจ |
---|
get_order_refunds | ืงืืืช ืืืืจื ืืืื ืืช |
get_order_refund | ืงืืืช ืืืืจ ืืืื ื ืืืื |
create_order_refund | ืืฆืืจืช ืืืืจ ืืืื ื ืืืฉ |
update_order_refund | ืขืืืื ืืืืจ ืืืื ื |
delete_order_refund | ืืืืงืช ืืืืจ ืืืื ื |
ืืงืืืืช WooCommerce
ืฉืืื | ืชืืืืจ |
---|
get_customers | ืงืืืช ืจืฉืืืช ืืงืืืืช |
get_customer | ืงืืืช ืืงืื ืืืื ืืคื ืืืื |
create_customer | ืืฆืืจืช ืืงืื ืืืฉ |
update_customer | ืขืืืื ืืงืื ืงืืื |
delete_customer | ืืืืงืช ืืงืื |
get_customer_meta | ืงืืืช ืืื-ืืืื ืฉื ืืงืื |
create_customer_meta | ืืฆืืจื/ืขืืืื ืืื-ืืืื ืฉื ืืงืื |
update_customer_meta | ืขืืืื ืืื-ืืืื ืฉื ืืงืื (ืืื ืื ืืืฆืืจื) |
delete_customer_meta | ืืืืงืช ืืื-ืืืื ืฉื ืืงืื |
ืืฉืืื
ืฉืืื | ืชืืืืจ |
---|
get_shipping_zones | ืงืืืช ืืืืจื ืืฉืืื |
get_shipping_zone | ืงืืืช ืืืืจ ืืฉืืื ืืืื |
create_shipping_zone | ืืฆืืจืช ืืืืจ ืืฉืืื ืืืฉ |
update_shipping_zone | ืขืืืื ืืืืจ ืืฉืืื |
delete_shipping_zone | ืืืืงืช ืืืืจ ืืฉืืื |
get_shipping_methods | ืงืืืช ืฉืืืืช ืืฉืืื |
get_zone_shipping_methods | ืงืืืช ืฉืืืืช ืืฉืืื ืืืืืจ |
get_zone_shipping_method | ืงืืืช ืฉืืืช ืืฉืืื ืกืคืฆืืคืืช ืืืืืจ |
create_zone_shipping_method | ืืฆืืจืช ืฉืืืช ืืฉืืื ืืืฉื ืืืืืจ |
update_zone_shipping_method | ืขืืืื ืฉืืืช ืืฉืืื ืืืืืจ |
delete_zone_shipping_method | ืืืืงืช ืฉืืืช ืืฉืืื ืืืืืจ |
get_shipping_zone_locations | ืงืืืช ืืืงืืืื ืืืืืจ ืืฉืืื |
update_shipping_zone_locations | ืขืืืื ืืืงืืืื ืืืืืจ ืืฉืืื |
ืืืกืื
ืฉืืื | ืชืืืืจ |
---|
get_tax_classes | ืงืืืช ืงืืืืจืืืช ืืก |
create_tax_class | ืืฆืืจืช ืงืืืืจืืืช ืืก ืืืฉื |
delete_tax_class | ืืืืงืช ืงืืืืจืืืช ืืก |
get_tax_rates | ืงืืืช ืฉืืขืืจื ืืก |
get_tax_rate | ืงืืืช ืฉืืขืืจ ืืก ืืืื |
create_tax_rate | ืืฆืืจืช ืฉืืขืืจ ืืก ืืืฉ |
update_tax_rate | ืขืืืื ืฉืืขืืจ ืืก |
delete_tax_rate | ืืืืงืช ืฉืืขืืจ ืืก |
batch_update_tax_rates | ืขืืืื ืืฆืืื ืฉื ืฉืืขืืจื ืืก |
ืื ืืืช/ืงืืคืื ืื
ืฉืืื | ืชืืืืจ |
---|
get_coupons | ืงืืืช ืงืืคืื ืื |
get_coupon | ืงืืืช ืงืืคืื ืืืื |
create_coupon | ืืฆืืจืช ืงืืคืื ืืืฉ |
update_coupon | ืขืืืื ืงืืคืื |
delete_coupon | ืืืืงืช ืงืืคืื |
batch_update_coupons | ืขืืืื ืืฆืืื ืฉื ืงืืคืื ืื |
ืฉืขืจื ืชืฉืืื
ืฉืืื | ืชืืืืจ |
---|
get_payment_gateways | ืงืืืช ืฉืขืจื ืชืฉืืื |
get_payment_gateway | ืงืืืช ืฉืขืจ ืชืฉืืื ืืืื |
update_payment_gateway | ืขืืืื ืฉืขืจ ืชืฉืืื |
ืืืืืช
ืฉืืื | ืชืืืืจ |
---|
get_sales_report | ืงืืืช ืืืืืช ืืืืจืืช |
get_products_report | ืงืืืช ืืืืืช ืืืฆืจืื |
get_customers_report | ืงืืืช ืืืืืช ืืงืืืืช |
get_stock_report | ืงืืืช ืืืืืช ืืืื |
ืืืืจืืช
ืฉืืื | ืชืืืืจ |
---|
get_settings | ืงืืืช ืื ืืืืืจืืช |
get_setting_option | ืงืืืช ืืคืฉืจืืช ืืืืจื ืกืคืฆืืคืืช |
update_setting_option | ืขืืืื ืืคืฉืจืืช ืืืืจื |
batch_update_settings | ืขืืืื ืืฆืืื ืฉื ืืืืจืืช |
ืืฆื ืืขืจืืช
ืฉืืื | ืชืืืืจ |
---|
get_system_status | ืงืืืช ืืฆื ืืขืจืืช |
get_system_status_tools | ืงืืืช ืืื ืืฆื ืืขืจืืช |
execute_system_status_tool | ืืคืขืืช ืืื ืืฆื ืืขืจืืช |
ื ืชืื ืื
ืฉืืื | ืชืืืืจ |
---|
get_countries | ืงืืืช ื ืชืื ื ืืืื ืืช |
get_country_states | ืงืืืช ืืืืืืช/ืืืื ืืช ืขืืืจ ืืืื ื |
get_currencies | ืงืืืช ื ืชืื ื ืืืืขืืช |
get_currency | ืงืืืช ืคืจืืื ืขืืืจ ืืืืข ืกืคืฆืืคื |
get_current_currency | ืงืืืช ืืืืืข ืื ืืืื |
๐ป ืืืืืืืช ืฉืืืืฉ
ืืชืืื ืฉืจืช MCP
import os
from dotenv import load_dotenv
from woocommerce_mcp import initialize
# ืืขืื ืช ืืฉืชื ื ืกืืืื ืืงืืืฅ .env
load_dotenv()
# ืืชืืื ืฉืจืช MCP
mcp = initialize()
# ืืคืขืืช ืืฉืจืช
async def main():
mcp.run()
if __name__ == "__main__":
import asyncio
asyncio.run(main())
ืืืืื ืืงืืืช ืืืฆืจืื
import asyncio
from woocommerce_mcp.products import get_products
async def list_products():
# ืงืืืช ืืืืฆืจืื ืืืืจืื ืื
products = await get_products({
"per_page": 20,
"page": 1,
"status": "publish"
})
for product in products:
print(f"ืืืฆืจ: {product['name']}, ืืืืจ: {product['price']}")
# ืืคืขืืช ืืคืื ืงืฆืื
asyncio.run(list_products())
ืืืืื ืืืฆืืจืช ืืืฆืจ
import asyncio
from woocommerce_mcp.products import create_product
async def add_new_product():
product_data = {
"name": "ืืืืฆืช ืคืจืืืืื",
"type": "simple",
"regular_price": "99.99",
"description": "ืืืืฆืช ืืืชื ื ื ืืื, ืืืื ื ืืืืืื ืืืืืช ืืฆืืขืื.",
"short_description": "ืืืืฆืช ืคืจืืืืื ืืืืืืช ืืืืื.",
"categories": [
{
"id": 19
}
],
"images": [
{
"src": "http://example.com/wp-content/uploads/2022/06/t-shirt.jpg"
}
]
}
result = await create_product(product_data)
print(f"ื ืืฆืจ ืืืฆืจ ืืืฉ ืขื ืืืื: {result['id']}")
# ืืคืขืืช ืืคืื ืงืฆืื
asyncio.run(add_new_product())
๐ ืคืจืืืจืื ืืคืื ืงืฆืืืช
ืื ืืคืื ืงืฆืืืช ืืงืืืืช ืืช ืืคืจืืืจืื ืืกืคืฆืืคืืื ืฉืืื ืืคืขืืืช ื-API, ืื ืืกืฃ ืืคืจืืืจืื ืืืืคืฆืืื ืืืื ืืืืื:
site_url
: (ืืืคืฆืืื ืื ืื ืืืืืจ ืืืฉืชื ื ืกืืืื) ืืชืืืช ืืชืจ WordPress
consumer_key
: (ืืืคืฆืืื ืื ืื ืืืืืจ ืืืฉืชื ื ืกืืืื) ืืคืชื ืฆืจืื WooCommerce
consumer_secret
: (ืืืคืฆืืื ืื ืื ืืืืืจ ืืืฉืชื ื ืกืืืื) ืกืื ืฆืจืื WooCommerce
- ืขืืืจ ืฉืืืืช WordPress:
username
ื-password
(ืืืคืฆืืื ืื ืื ืืืืืจ ืืืฉืชื ื ืกืืืื)
๐ ืืขืจืช ืืืืื
ืืืืฉื ื-REST API ืฉื WooCommerce, ืขืืื ืืืฆืืจ ืืคืชืืืช API. ื ืืชื ืืืฆืืจ ืืืชื ืืืื ืืืงืจื ืฉื WordPress ืชืืช WooCommerce โ ืืืืจืืช โ ืืชืงืื โ REST API.
๐ฆ ืืจืืฉืืช ืืขืจืืช
- Python 3.9 ืืืขืื
- ืืชืจ WordPress ืขื ืคืืืืื WooCommerce ืืืชืงื
- ืืคืชืืืช REST API ืฉื WooCommerce
- ืืืืืืช Python:
mcp-server
, httpx
, python-dotenv
๐ ืจืืฉืืื
MIT License - ืจืื ืงืืืฅ LICENSE ืืคืจืืื ื ืืกืคืื
๐ WooCommerce MCP Server | Python Edition
A simple and efficient solution for connecting WooCommerce stores with Model Context Protocol
๐ฎ๐ฑ Hebrew Version | ๐บ๐ธ English Version
๐ What is it?
A Model Context Protocol (MCP) server for WooCommerce integration, compatible with WordPress REST API. The library provides comprehensive tools for managing all aspects of products, orders, customers, shipping, taxes, discounts, and store configuration.
๐ Quick Installation
# Step 1: Clone the repository
git clone https://github.com/yourusername/woocommerce-mcp-server.git
cd woocommerce-mcp-server
# Step 2: Install dependencies
pip install -r requirements.txt
# Step 3: Configure environment variables (see below)
โ๏ธ Deployment on Railway
The server is ready for immediate deployment on the Railway platform:
# Step 1: Clone the repository to your GitHub account
# Step 2: Log in to Railway and connect with your GitHub account
# https://railway.app/
# Step 3: Click on "New Project" and select "Deploy from GitHub repo"
# Step 4: Select the cloned repository
# Step 5: Configure the following environment variables:
# - WORDPRESS_SITE_URL
# - WOOCOMMERCE_CONSUMER_KEY
# - WOOCOMMERCE_CONSUMER_SECRET
# - WORDPRESS_USERNAME (optional)
# - WORDPRESS_PASSWORD (optional)
# - MCP_HOST=0.0.0.0
# - MCP_PORT=8000
# Step 6: Wait for the build and deployment to complete
Benefits of Deployment on Railway:
- ๐ Automatic deployment from GitHub
- ๐ Automatic SSL
- ๐ Built-in monitoring and logging
- ๐ Free subdomain on railway.app
- โก Automatic scaling based on demand
โ๏ธ Configuration
Create a .env
file in the project root with your credentials:
WORDPRESS_SITE_URL=https://your-wordpress-site.com
WOOCOMMERCE_CONSUMER_KEY=your-woocommerce-consumer-key
WOOCOMMERCE_CONSUMER_SECRET=your-woocommerce-consumer-secret
WORDPRESS_USERNAME=your-wordpress-username
WORDPRESS_PASSWORD=your-wordpress-password
Environment Variables
Variable | Description | Required |
---|
WORDPRESS_SITE_URL | Your WordPress site URL (WooCommerce is a WordPress plugin) | โ
|
WOOCOMMERCE_CONSUMER_KEY | WooCommerce REST API consumer key | โ
|
WOOCOMMERCE_CONSUMER_SECRET | WooCommerce REST API consumer secret | โ
|
WORDPRESS_USERNAME | WordPress username with appropriate permissions | โ ๏ธ * |
WORDPRESS_PASSWORD | WordPress password for authentication | โ ๏ธ * |
* Required only for WordPress API methods
๐ Authentication Options
WooCommerce Authentication
WooCommerce API access requires consumer keys that you can generate in your WordPress dashboard under WooCommerce โ Settings โ Advanced โ REST API.
WordPress Authentication
For WordPress-specific methods (like managing posts), you need to provide:
- Username/password credentials for basic authentication
- The WordPress REST API must be enabled on your site
๐ API Methods
The server supports both WordPress and WooCommerce API methods. Here's a list of available methods grouped by category:
WordPress Content Management
These methods require WordPress username/password credentials and are independent of the WooCommerce API.
Method | Description |
---|
create_post | Create a new WordPress post |
get_posts | Retrieve WordPress posts |
update_post | Update an existing WordPress post |
get_post_meta | Get post metadata |
update_post_meta | Update post metadata |
create_post_meta | Create post metadata |
delete_post_meta | Delete post metadata |
WooCommerce Products
Method | Description |
---|
get_products | Retrieve a list of products |
get_product | Get a single product by ID |
create_product | Create a new product |
update_product | Update an existing product |
delete_product | Delete a product |
get_product_meta | Get product metadata |
create_product_meta | Create/update product metadata |
update_product_meta | Update product metadata (alias for create) |
delete_product_meta | Delete product metadata |
Product Categories
Method | Description |
---|
get_product_categories | Retrieve product categories |
get_product_category | Get a single product category |
create_product_category | Create a new product category |
update_product_category | Update a product category |
delete_product_category | Delete a product category |
Product Tags
Method | Description |
---|
get_product_tags | Retrieve product tags |
get_product_tag | Get a single product tag |
create_product_tag | Create a new product tag |
update_product_tag | Update a product tag |
delete_product_tag | Delete a product tag |
Product Attributes
Method | Description |
---|
get_product_attributes | Retrieve product attributes |
get_product_attribute | Get a single product attribute |
create_product_attribute | Create a new product attribute |
update_product_attribute | Update a product attribute |
delete_product_attribute | Delete a product attribute |
get_attribute_terms | Retrieve attribute terms |
get_attribute_term | Get a single attribute term |
create_attribute_term | Create a new attribute term |
update_attribute_term | Update an attribute term |
delete_attribute_term | Delete an attribute term |
Product Variations
Method | Description |
---|
get_product_variations | Retrieve product variations |
get_product_variation | Get a single product variation |
create_product_variation | Create a new product variation |
update_product_variation | Update a product variation |
delete_product_variation | Delete a product variation |
batch_update_product_variations | Batch update product variations |
Product Reviews
Method | Description |
---|
get_product_reviews | Retrieve product reviews |
get_product_review | Get a single product review |
create_product_review | Create a new product review |
update_product_review | Update a product review |
delete_product_review | Delete a product review |
WooCommerce Orders
Method | Description |
---|
get_orders | Retrieve a list of orders |
get_order | Get a single order by ID |
create_order | Create a new order |
update_order | Update an existing order |
delete_order | Delete an order |
get_order_meta | Get order metadata |
create_order_meta | Create/update order metadata |
update_order_meta | Update order metadata (alias for create) |
delete_order_meta | Delete order metadata |
Order Notes
Method | Description |
---|
get_order_notes | Retrieve order notes |
get_order_note | Get a single order note |
create_order_note | Create a new order note |
delete_order_note | Delete an order note |
Order Refunds
Method | Description |
---|
get_order_refunds | Retrieve order refunds |
get_order_refund | Get a single order refund |
create_order_refund | Create a new order refund |
update_order_refund | Update an order refund |
delete_order_refund | Delete an order refund |
WooCommerce Customers
Method | Description |
---|
get_customers | Retrieve a list of customers |
get_customer | Get a single customer by ID |
create_customer | Create a new customer |
update_customer | Update an existing customer |
delete_customer | Delete a customer |
get_customer_meta | Get customer metadata |
create_customer_meta | Create/update customer metadata |
update_customer_meta | Update customer metadata (alias for create) |
delete_customer_meta | Delete customer metadata |
Shipping
Method | Description |
---|
get_shipping_zones | Retrieve shipping zones |
get_shipping_zone | Get a single shipping zone |
create_shipping_zone | Create a new shipping zone |
update_shipping_zone | Update a shipping zone |
delete_shipping_zone | Delete a shipping zone |
get_shipping_methods | Retrieve shipping methods |
get_zone_shipping_methods | Get shipping methods for a zone |
get_zone_shipping_method | Get a specific shipping method for a zone |
create_zone_shipping_method | Create a new shipping method for a zone |
update_zone_shipping_method | Update a shipping method for a zone |
delete_zone_shipping_method | Delete a shipping method from a zone |
get_shipping_zone_locations | Get locations for a shipping zone |
update_shipping_zone_locations | Update locations for a shipping zone |
Taxes
Method | Description |
---|
get_tax_classes | Retrieve tax classes |
create_tax_class | Create a new tax class |
delete_tax_class | Delete a tax class |
get_tax_rates | Retrieve tax rates |
get_tax_rate | Get a single tax rate |
create_tax_rate | Create a new tax rate |
update_tax_rate | Update a tax rate |
delete_tax_rate | Delete a tax rate |
batch_update_tax_rates | Batch update tax rates |
Discounts/Coupons
Method | Description |
---|
get_coupons | Retrieve coupons |
get_coupon | Get a single coupon |
create_coupon | Create a new coupon |
update_coupon | Update a coupon |
delete_coupon | Delete a coupon |
batch_update_coupons | Batch update coupons |
Payment Gateways
Method | Description |
---|
get_payment_gateways | Retrieve payment gateways |
get_payment_gateway | Get a single payment gateway |
update_payment_gateway | Update a payment gateway |
Reports
Method | Description |
---|
get_sales_report | Retrieve sales reports |
get_products_report | Retrieve products reports |
get_customers_report | Retrieve customers reports |
get_stock_report | Retrieve stock reports |
Settings
Method | Description |
---|
get_settings | Retrieve all settings |
get_setting_option | Retrieve a specific setting option |
update_setting_option | Update a setting option |
batch_update_settings | Batch update settings |
System Status
Method | Description |
---|
get_system_status | Retrieve system status |
get_system_status_tools | Retrieve system status tools |
execute_system_status_tool | Run a system status tool |
Data
Method | Description |
---|
get_countries | Retrieve countries data |
get_country_states | Retrieve states/provinces for a country |
get_currencies | Retrieve currencies data |
get_currency | Get details for a specific currency |
get_current_currency | Get the current currency |
๐ป Usage Examples
Initialize MCP Server
import os
from dotenv import load_dotenv
from woocommerce_mcp import initialize
# Load environment variables from .env
load_dotenv()
# Initialize the MCP server
mcp = initialize()
# Run the server
async def main():
mcp.run()
if __name__ == "__main__":
import asyncio
asyncio.run(main())
Example for Getting Products
import asyncio
from woocommerce_mcp.products import get_products
async def list_products():
# Get latest products
products = await get_products({
"per_page": 20,
"page": 1,
"status": "publish"
})
for product in products:
print(f"Product: {product['name']}, Price: {product['price']}")
# Run the function
asyncio.run(list_products())
Example for Creating a Product
import asyncio
from woocommerce_mcp.products import create_product
async def add_new_product():
product_data = {
"name": "Premium T-Shirt",
"type": "simple",
"regular_price": "29.99",
"description": "Comfortable cotton t-shirt, available in various sizes.",
"short_description": "Premium quality t-shirt.",
"categories": [
{
"id": 19
}
],
"images": [
{
"src": "http://example.com/wp-content/uploads/2022/06/t-shirt.jpg"
}
]
}
result = await create_product(product_data)
print(f"Created new product with ID: {result['id']}")
# Run the function
asyncio.run(add_new_product())
๐ Function Parameters
All functions accept their specific parameters for the API action, plus the following optional parameters:
site_url
: (optional if set in env) WordPress site URL
consumer_key
: (optional if set in env) WooCommerce consumer key
consumer_secret
: (optional if set in env) WooCommerce consumer secret
- For WordPress methods:
username
and password
(optional if set in env)
๐ Security Note
For WooCommerce REST API access, you need to generate API keys. You can create them in your WordPress dashboard under WooCommerce โ Settings โ Advanced โ REST API.
๐ฆ System Requirements
- Python 3.9 or higher
- WordPress site with WooCommerce plugin installed
- WooCommerce REST API keys
- Python packages:
mcp-server
, httpx
, python-dotenv
๐ License
MIT License - See LICENSE file for details