WooCommerce MCP Server

WooCommerce MCP Server

Enables AI agents to manage WooCommerce stores, including products, orders, customers, categories, coupons, attributes, variations, order notes, refunds, reports, payment gateways, meta data, reviews, settings, data, posts, and system status through natural language.

Category
访问服务器

README

WooCommerce MCP Server

A Model Context Protocol (MCP) server for WooCommerce integration, providing AI agents and Claude with tools to manage WooCommerce stores.

What Changed

This server has been completely rewritten to properly implement the MCP standard:

Before (Issues)

  • ❌ Custom JSON-RPC implementation instead of MCP SDK
  • ❌ No proper MCP protocol support (initialization, capabilities, etc.)
  • ❌ Custom readline-based transport
  • ❌ Massive switch statement with 100+ cases
  • ❌ No input validation or proper error handling
  • ❌ Not compatible with MCP clients like Claude Desktop

After (Fixed)

  • ✅ Uses official MCP TypeScript SDK (@modelcontextprotocol/sdk)
  • ✅ Proper MCP protocol implementation with capabilities
  • ✅ Standard stdio transport for MCP clients
  • ✅ Clean tool-based architecture with proper schemas
  • ✅ Zod validation for all inputs
  • ✅ Proper error handling and user-friendly responses
  • ✅ Compatible with Claude Desktop and other MCP clients

Features

📦 Product Management

  • get_products - Retrieve products with filtering options
  • get_product - Get specific product by ID
  • create_product - Create new products
  • update_product - Update existing products
  • delete_product - Delete products

📋 Order Management

  • get_orders - Retrieve orders with filtering
  • get_order - Get specific order by ID
  • create_order - Create new orders
  • update_order - Update existing orders
  • delete_order - Delete orders

👥 Customer Management

  • get_customers - Retrieve customers
  • get_customer - Get specific customer by ID
  • create_customer - Create new customers
  • update_customer - Update existing customers
  • delete_customer - Delete customers

🏷️ Categories & Tags

  • get_product_categories - Retrieve product categories
  • get_product_category - Get specific category by ID
  • create_product_category - Create new categories
  • update_product_category - Update existing categories
  • delete_product_category - Delete categories
  • get_product_tags - Retrieve product tags
  • get_product_tag - Get specific tag by ID
  • create_product_tag - Create new tags
  • update_product_tag - Update existing tags
  • delete_product_tag - Delete tags

🎫 Coupon Management

  • get_coupons - Retrieve coupons with filtering
  • get_coupon - Get specific coupon by ID
  • create_coupon - Create new coupons
  • update_coupon - Update existing coupons
  • delete_coupon - Delete coupons

🔧 Product Attributes

  • get_product_attributes - Retrieve product attributes
  • get_product_attribute - Get specific attribute by ID
  • create_product_attribute - Create new attributes
  • update_product_attribute - Update existing attributes
  • delete_product_attribute - Delete attributes

🔄 Product Variations

  • get_product_variations - Retrieve variations for variable products
  • get_product_variation - Get specific variation by ID
  • create_product_variation - Create new product variations
  • update_product_variation - Update existing variations
  • delete_product_variation - Delete variations

📝 Order Notes

  • get_order_notes - Retrieve notes for orders
  • get_order_note - Get specific order note
  • create_order_note - Add notes to orders
  • delete_order_note - Delete order notes

💰 Order Refunds

  • get_order_refunds - Retrieve refunds for orders
  • get_order_refund - Get specific refund details
  • create_order_refund - Process order refunds
  • delete_order_refund - Delete refunds

📊 Reports & Analytics

  • get_sales_report - Get sales data and analytics
  • get_products_report - Get products performance report
  • get_orders_report - Get orders analytics report
  • get_customers_report - Get customers analytics report
  • get_categories_report - Get categories performance report
  • get_stock_report - Get stock levels report
  • get_coupons_report - Get coupons usage report
  • get_taxes_report - Get taxes report

💳 Payment Gateways

  • get_payment_gateways - Retrieve all payment gateways
  • get_payment_gateway - Get specific payment gateway
  • update_payment_gateway - Update payment gateway settings

🔗 Meta Data Operations

  • get_product_meta - Retrieve product meta data
  • set_product_meta - Set (create/update) product meta data
  • delete_product_meta - Delete product meta data
  • get_order_meta - Retrieve order meta data
  • set_order_meta - Set (create/update) order meta data
  • delete_order_meta - Delete order meta data
  • get_customer_meta - Retrieve customer meta data
  • set_customer_meta - Set (create/update) customer meta data
  • delete_customer_meta - Delete customer meta data

⭐ Product Reviews

  • get_product_reviews - Retrieve product reviews
  • get_product_review - Get specific review by ID
  • create_product_review - Create new product review
  • update_product_review - Update existing review
  • delete_product_review - Delete review

⚙️ Settings Management

  • get_settings - Retrieve WooCommerce settings groups
  • get_setting_options - Get options for specific settings group
  • update_setting_option - Update specific setting options

🌍 Data & Geography

  • get_data - Retrieve general WooCommerce data
  • get_continents - Get continents and their countries
  • get_countries - Get a list of countries
  • get_currencies - Get available currencies
  • get_current_currency - Get current currency information

📄 WordPress Posts Management

  • create_post - Create new WordPress posts
  • get_posts - Retrieve WordPress posts
  • update_post - Update existing posts
  • get_post_meta - Get WordPress post meta data

⚙️ System Information

  • get_system_status - Get WooCommerce system status and diagnostics
  • get_system_status_tools - Get available system status tools
  • run_system_status_tool - Execute system status tools

Installation

  1. Clone the repository:
git clone https://github.com/lord-dubious/woocommerce-mcp-server.git
cd woocommerce-mcp-server
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Configuration

Set up your environment variables in a .env file:

# Required for WooCommerce API
WORDPRESS_SITE_URL=https://your-site.com
WOOCOMMERCE_CONSUMER_KEY=ck_your_consumer_key
WOOCOMMERCE_CONSUMER_SECRET=cs_your_consumer_secret

# Optional for WordPress API (if needed)
WORDPRESS_USERNAME=your_username
WORDPRESS_PASSWORD=your_password

Getting WooCommerce API Keys

  1. Go to your WordPress admin dashboard
  2. Navigate to WooCommerce > Settings > Advanced > REST API
  3. Click Add Key
  4. Set permissions to Read/Write
  5. Copy the Consumer Key and Consumer Secret

Usage

With Claude Desktop

Add to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "woocommerce": {
      "command": "node",
      "args": ["/path/to/woocommerce-mcp-server/build/index.js"],
      "env": {
        "WORDPRESS_SITE_URL": "https://your-site.com",
        "WOOCOMMERCE_CONSUMER_KEY": "ck_your_key",
        "WOOCOMMERCE_CONSUMER_SECRET": "cs_your_secret"
      }
    }
  }
}

Command Line Testing

You can test the server directly:

npm start

Then send MCP messages via stdin (for debugging).

Example Usage in Claude

Once configured, you can ask Claude to:

  • "Show me the latest 10 products from my WooCommerce store"
  • "Create a new product called 'Test Product' with price $29.99"
  • "Get the details of order #123"
  • "Show me this month's sales report"
  • "List all customers who signed up this week"
  • "Create a 20% off coupon for electronics"
  • "Add a note to order #456"
  • "Process a refund for order #789"
  • "Get all variations for product #123"

Tool Parameters

Credentials (Optional for all tools)

You can override environment variables per request:

{
  credentials: {
    siteUrl: "https://different-site.com",
    consumerKey: "different_key",
    consumerSecret: "different_secret"
  }
}

Product Tools

  • get_products: perPage, page, search, category, tag, featured, on_sale, min_price, max_price, stock_status
  • get_product: productId
  • create_product: productData (name, type, regular_price, description, etc.)
  • update_product: productId, productData
  • delete_product: productId, force

Order Tools

  • get_orders: perPage, page, search, after, before, status, customer, product
  • get_order: orderId
  • create_order: orderData (billing, shipping, line_items, etc.)
  • update_order: orderId, orderData
  • delete_order: orderId, force

Customer Tools

  • get_customers: perPage, page, search, email, role
  • get_customer: customerId
  • create_customer: customerData (email, first_name, last_name, billing, shipping)
  • update_customer: customerId, customerData
  • delete_customer: customerId, force, reassign

Category Tools

  • get_product_categories: perPage, page, search, parent, hide_empty
  • get_product_category: categoryId
  • create_product_category: categoryData (name, slug, parent, description, etc.)
  • update_product_category: categoryId, categoryData
  • delete_product_category: categoryId, force

Tag Tools

  • get_product_tags: perPage, page, search, hide_empty
  • get_product_tag: tagId
  • create_product_tag: tagData (name, slug, description)
  • update_product_tag: tagId, tagData
  • delete_product_tag: tagId, force

Coupon Tools

  • get_coupons: perPage, page, search, after, before, code
  • get_coupon: couponId
  • create_coupon: couponData (code, amount, discount_type, etc.)
  • update_coupon: couponId, couponData
  • delete_coupon: couponId, force

Attribute Tools

  • get_product_attributes: perPage, page
  • get_product_attribute: attributeId
  • create_product_attribute: attributeData (name, slug, type, etc.)
  • update_product_attribute: attributeId, attributeData
  • delete_product_attribute: attributeId, force

Report Tools

  • get_sales_report: period, date_min, date_max
  • get_products_report: period, date_min, date_max, perPage, page
  • get_orders_report: period, date_min, date_max, perPage, page
  • get_customers_report: perPage, page

Payment Gateway Tools

  • get_payment_gateways: No parameters
  • get_payment_gateway: gatewayId
  • update_payment_gateway: gatewayId, gatewayData (enabled, title, description, settings)

Error Handling

The server provides detailed error messages for:

  • Missing credentials
  • Invalid API responses
  • Network errors
  • Validation errors

All errors are returned in a user-friendly format with context.

Development

Adding New Tools

  1. Define input schema with Zod
  2. Register tool with server.registerTool()
  3. Implement async handler function
  4. Add proper error handling
  5. Update documentation

Testing

The server includes a comprehensive testing system to validate all tools and functionality.

Quick Test (Schema Validation)

npm test

This runs basic schema validation tests without requiring WooCommerce credentials.

Full API Testing

# Set up test credentials
export TEST_WORDPRESS_SITE_URL='https://your-test-site.com'
export TEST_WOOCOMMERCE_CONSUMER_KEY='ck_your_test_key'
export TEST_WOOCOMMERCE_CONSUMER_SECRET='cs_your_test_secret'

# Run full API tests
npm run test

Advanced Testing

npm run test:full  # Run comprehensive MCP server tests
npm run validate   # Validate build and schemas only

Test Configuration

Copy tests/test-config.example.env to .env and configure your test credentials:

TEST_WORDPRESS_SITE_URL=https://your-test-site.com
TEST_WOOCOMMERCE_CONSUMER_KEY=ck_your_test_key
TEST_WOOCOMMERCE_CONSUMER_SECRET=cs_your_test_secret

⚠️ Important: Always use a test/staging site, never your production store!

What Gets Tested

  • ✅ All 91 WooCommerce tools
  • ✅ Schema validation for all data types
  • ✅ Error handling and edge cases
  • ✅ API connectivity and authentication
  • ✅ Response format validation
  • ✅ Performance metrics

License

MIT License - see LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Support

For issues and questions:

  • Open an issue on GitHub
  • Check WooCommerce REST API documentation
  • Review MCP specification

Related Links

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选