๐ 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 ็ฝ็ซ URL
consumer_key๏ผ๏ผๅฆๆๅทฒๅจ็ฏๅขๅ้ไธญ่ฎพ็ฝฎ๏ผๅๅฏ้๏ผWooCommerce ๆถ่ดน่
ๅฏ้ฅ
consumer_secret๏ผ๏ผๅฆๆๅทฒๅจ็ฏๅขๅ้ไธญ่ฎพ็ฝฎ๏ผๅๅฏ้๏ผWooCommerce ๆถ่ดน่
ๅฏ้ฅ
- ๅฏนไบ WordPress ๆนๆณ๏ผ
username ๅ password๏ผๅฆๆๅทฒๅจ็ฏๅขๅ้ไธญ่ฎพ็ฝฎ๏ผๅๅฏ้๏ผ
๐ ๅฎๅ
จ่ฏดๆ
่ฆ่ฎฟ้ฎ WooCommerce REST API๏ผๅฟ
้กปๅๅปบ API ๅฏ้ฅใๅฏๅจ WordPress ๆงๅถ้ขๆฟ็ WooCommerce โ ่ฎพ็ฝฎ โ ้ซ็บง โ REST API ไธๅๅปบใ
๐ฆ ็ณป็ป่ฆๆฑ
- Python 3.9 ๆๆด้ซ็ๆฌ
- ๅทฒๅฎ่ฃ
WooCommerce ๆไปถ็ WordPress ็ฝ็ซ
- WooCommerce REST API ๅฏ้ฅ
- Python ่ฝฏไปถๅ
๏ผ
mcp-serverใhttpxใpython-dotenv
๐ ่ฎธๅฏ่ฏ
MIT ่ฎธๅฏ่ฏโโ่ฏฆๆ
่ฏทๅ้
LICENSE ๆไปถ
๐ WooCommerce MCP ๆๅก | Python ็
็จไบๅฐ WooCommerce ๅๅบ่ฟๆฅๅฐ Model Context Protocol ็็ฎๅ้ซๆ่งฃๅณๆนๆก
๐ฎ๐ฑ ๅธไผฏๆฅ่ฏญ็ๆฌ | ๐บ๐ธ ่ฑ่ฏญ็ๆฌ
๐ ่ฟๆฏไปไน๏ผ
ไธไธช็จไบ้ๆ WooCommerce ็ Model Context Protocol๏ผMCP๏ผๆๅก๏ผไธ WordPress REST API ๅ
ผๅฎนใ่ฏฅๅบๆไพๅ
จ้ข็ๅทฅๅ
ท๏ผ็จไบ็ฎก็ไบงๅใ่ฎขๅใๅฎขๆทใ้
้ใ็จ่ดนใๆๆฃๅๅๅบ้
็ฝฎ็ญๅไธชๆน้ขใ
๐ ๅฟซ้ๅฎ่ฃ
# 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)
โ๏ธ ๅจ Railway ไธ้จ็ฝฒ
ๆญคๆๅกๅทฒๅๅคๅฐฑ็ปช๏ผๅฏ็ซๅณ้จ็ฝฒๅฐ Railway ๅนณๅฐ๏ผ
# 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
ๅจ 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 | WordPress ็ฝ็ซ URL๏ผWooCommerce ๆฏ WordPress ๆไปถ๏ผ | โ
|
WOOCOMMERCE_CONSUMER_KEY | WooCommerce REST API ๆถ่ดน่
ๅฏ้ฅ | โ
|
WOOCOMMERCE_CONSUMER_SECRET | WooCommerce REST API ๆถ่ดน่
ๅฏ้ฅ | โ
|
WORDPRESS_USERNAME | ๅ
ทๆ็ธๅบๆ้็ WordPress ็จๆทๅ | โ ๏ธ * |
WORDPRESS_PASSWORD | ็จไบ่บซไปฝ้ช่ฏ็ WordPress ๅฏ็ | โ ๏ธ * |
* ไป
WordPress API ๆนๆณ้่ฆ
๐ ่บซไปฝ้ช่ฏ้้กน
WooCommerce ่บซไปฝ้ช่ฏ
่ฎฟ้ฎ WooCommerce API ้่ฆไฝฟ็จ่
ๅฏ้ฅใไฝ ๅฏไปฅๅจ WordPress ๆงๅถ้ขๆฟไธญ็ WooCommerce โ Settings โ Advanced โ REST API ไธ็ๆ่ฟไบๅฏ้ฅใ
WordPress ่บซไปฝ้ช่ฏ
ๅฏนไบ WordPress ไธๅฑๆนๆณ๏ผไพๅฆ็ฎก็ๆ็ซ ๏ผ๏ผไฝ ้่ฆๆไพ๏ผ
- ็จไบๅบๆฌ่บซไปฝ้ช่ฏ็็จๆทๅๅๅฏ็ ๅญๆฎ
- ไฝ ็็ฝ็ซๅฟ
้กปๅฏ็จ WordPress REST API
๐ API ๆนๆณ
่ฏฅๆๅกๅๆถๆฏๆ WordPress ๅ WooCommerce API ๆนๆณใไปฅไธๆฏๆ็ฑปๅซๅ็ป็ๅฏ็จๆนๆณๅ่กจ๏ผ
WordPress ๅ
ๅฎน็ฎก็
่ฟไบๆนๆณ้่ฆ WordPress ็จๆทๅๅๅฏ็ ๅญๆฎ๏ผไธ็ฌ็ซไบ WooCommerce APIใ
| Method | Description |
|---|
create_post | ๅๅปบไธ็ฏๆฐ็ WordPress ๆ็ซ |
get_posts | ่ทๅ WordPress ๆ็ซ |
update_post | ๆดๆฐ็ฐๆ็ WordPress ๆ็ซ |
get_post_meta | ่ทๅๆ็ซ ๅ
ๆฐๆฎ |
update_post_meta | ๆดๆฐๆ็ซ ๅ
ๆฐๆฎ |
create_post_meta | ๅๅปบๆ็ซ ๅ
ๆฐๆฎ |
delete_post_meta | ๅ ้คๆ็ซ ๅ
ๆฐๆฎ |
WooCommerce ไบงๅ
| Method | Description |
|---|
get_products | ่ทๅไบงๅๅ่กจ |
get_product | ๆ ID ่ทๅๅไธชไบงๅ |
create_product | ๅๅปบๆฐไบงๅ |
update_product | ๆดๆฐ็ฐๆไบงๅ |
delete_product | ๅ ้คไบงๅ |
get_product_meta | ่ทๅไบงๅๅ
ๆฐๆฎ |
create_product_meta | ๅๅปบ๏ผๆดๆฐไบงๅๅ
ๆฐๆฎ |
update_product_meta | ๆดๆฐไบงๅๅ
ๆฐๆฎ๏ผcreate ็ๅซๅ๏ผ |
delete_product_meta | ๅ ้คไบงๅๅ
ๆฐๆฎ |
ไบงๅๅ็ฑป
| Method | Description |
|---|
get_product_categories | ่ทๅไบงๅๅ็ฑป |
get_product_category | ่ทๅๅไธชไบงๅๅ็ฑป |
create_product_category | ๅๅปบๆฐ็ไบงๅๅ็ฑป |
update_product_category | ๆดๆฐไบงๅๅ็ฑป |
delete_product_category | ๅ ้คไบงๅๅ็ฑป |
ไบงๅๆ ็ญพ
| Method | Description |
|---|
get_product_tags | ่ทๅไบงๅๆ ็ญพ |
get_product_tag | ่ทๅๅไธชไบงๅๆ ็ญพ |
create_product_tag | ๅๅปบๆฐ็ไบงๅๆ ็ญพ |
update_product_tag | ๆดๆฐไบงๅๆ ็ญพ |
delete_product_tag | ๅ ้คไบงๅๆ ็ญพ |
ไบงๅๅฑๆง
| Method | Description |
|---|
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 | ๅ ้คๅฑๆงๆฏ่ฏญ |
ไบงๅๅไฝ
| Method | Description |
|---|
get_product_variations | ่ทๅไบงๅๅไฝ |
get_product_variation | ่ทๅๅไธชไบงๅๅไฝ |
create_product_variation | ๅๅปบๆฐ็ไบงๅๅไฝ |
update_product_variation | ๆดๆฐไบงๅๅไฝ |
delete_product_variation | ๅ ้คไบงๅๅไฝ |
batch_update_product_variations | ๆน้ๆดๆฐไบงๅๅไฝ |
ไบงๅ่ฏไปท
| Method | Description |
|---|
get_product_reviews | ่ทๅไบงๅ่ฏไปท |
get_product_review | ่ทๅๅๆกไบงๅ่ฏไปท |
create_product_review | ๅๅปบๆฐ็ไบงๅ่ฏไปท |
update_product_review | ๆดๆฐไบงๅ่ฏไปท |
delete_product_review | ๅ ้คไบงๅ่ฏไปท |
WooCommerce ่ฎขๅ
| ๆนๆณ | ๆ่ฟฐ |
|---|
get_orders | ่ทๅ่ฎขๅๅ่กจ |
get_order | ๆ นๆฎ ID ่ทๅๅไธช่ฎขๅ |
create_order | ๅๅปบๆฐ่ฎขๅ |
update_order | ๆดๆฐ็ฐๆ่ฎขๅ |
delete_order | ๅ ้ค่ฎขๅ |
get_order_meta | ่ทๅ่ฎขๅๅ
ๆฐๆฎ |
create_order_meta | ๅๅปบ/ๆดๆฐ่ฎขๅๅ
ๆฐๆฎ |
update_order_meta | ๆดๆฐ่ฎขๅๅ
ๆฐๆฎ๏ผcreate ็ๅซๅ๏ผ |
delete_order_meta | ๅ ้ค่ฎขๅๅ
ๆฐๆฎ |
่ฎขๅๅคๆณจ
| ๆนๆณ | ๆ่ฟฐ |
|---|
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 | ๆ นๆฎ ID ่ทๅๅไธชๅฎขๆท |
create_customer | ๅๅปบๆฐๅฎขๆท |
update_customer | ๆดๆฐ็ฐๆๅฎขๆท |
delete_customer | ๅ ้คๅฎขๆท |
get_customer_meta | ่ทๅๅฎขๆทๅ
ๆฐๆฎ |
create_customer_meta | ๅๅปบ/ๆดๆฐๅฎขๆทๅ
ๆฐๆฎ |
update_customer_meta | ๆดๆฐๅฎขๆทๅ
ๆฐๆฎ๏ผcreate ็ๅซๅ๏ผ |
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
# 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())
่ทๅไบงๅ็คบไพ
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())
ๅๅปบไบงๅ็คบไพ
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())
๐ ๅฝๆฐๅๆฐ
ๆๆๅฝๆฐ้ฝๆฅๅ็จไบๆง่ก API ๆไฝ็็นๅฎๅๆฐ๏ผไปฅๅไปฅไธๅฏ้ๅๆฐ๏ผ
site_url๏ผ๏ผๅฆๆๅทฒๅจ็ฏๅขๅ้ไธญ่ฎพ็ฝฎ๏ผๅๅฏ้๏ผWordPress ็ซ็น URL
consumer_key๏ผ๏ผๅฆๆๅทฒๅจ็ฏๅขๅ้ไธญ่ฎพ็ฝฎ๏ผๅๅฏ้๏ผWooCommerce consumer key
consumer_secret๏ผ๏ผๅฆๆๅทฒๅจ็ฏๅขๅ้ไธญ่ฎพ็ฝฎ๏ผๅๅฏ้๏ผWooCommerce consumer secret
- ๅฏนไบ WordPress ๆนๆณ๏ผ
username ๅ password๏ผๅฆๆๅทฒๅจ็ฏๅขๅ้ไธญ่ฎพ็ฝฎ๏ผๅๅฏ้๏ผ
๐ ๅฎๅ
จ่ฏดๆ
่ฆ่ฎฟ้ฎ WooCommerce REST API๏ผ้่ฆ็ๆ API ๅฏ้ฅใๅฏไปฅๅจ WordPress ๆงๅถ้ขๆฟ็ WooCommerce โ ่ฎพ็ฝฎ โ ้ซ็บง โ REST API ไธญๅๅปบๅฏ้ฅใ
๐ฆ ็ณป็ป่ฆๆฑ
- Python 3.9 ๆๆด้ซ็ๆฌ
- ๅทฒๅฎ่ฃ
WooCommerce ๆไปถ็ WordPress ็ซ็น
- WooCommerce REST API ๅฏ้ฅ
- Python ่ฝฏไปถๅ
๏ผ
mcp-serverใhttpxใpython-dotenv
๐ ่ฎธๅฏ่ฏ
MIT ่ฎธๅฏ่ฏ - ่ฏฆๆ
่ฏทๅ้
LICENSE ๆไปถ