MCP WooCommerce Server

MCP WooCommerce Server

Enables AI assistants to interact with WooCommerce stores through 37 specialized tools for managing products, orders, customers, categories, and coupons. Includes n8n webhook integration for automated e-commerce workflows and is optimized for Docker deployment on EasyPanel.

Category
访问服务器

README

MCP WooCommerce Server - Real Protocol Implementation

🚀 Project Overview

Complete MCP (Model Context Protocol) server for WooCommerce integration with native protocol support

  • Name: mcp-woocommerce-server
  • Goal: True MCP protocol implementation for WooCommerce automation with n8n
  • Features: 44+ WooCommerce tools via native MCP protocol with Mexican market support (MXN currency), customer analytics, order email lookup, and real API integration

🎯 URLs & Endpoints

Production URLs

  • GitHub: https://github.com/Marckello/mcp_woo_marckello
  • Demo Server: https://3000-i0pmg1zszswkdqf58h7ot-6532622b.e2b.dev

MCP Protocol Endpoints

  • WebSocket MCP: ws://hostname:3000/mcp-ws (for n8n MCP node)
  • Server-Sent Events: GET /mcp-sse (HTTP streaming)
  • HTTP JSON-RPC: POST /mcp (fallback endpoint)
  • Health Check: GET /health
  • Store Info: GET /info
  • N8n Webhook: POST /webhook/n8n

🏗️ MCP Protocol Architecture

Native MCP Implementation

  • MCPTransport (src/transport/mcp-transport.ts): WebSocket & SSE transport layers
  • MCPProtocolHandler (src/protocol/mcp-handler.ts): JSON-RPC 2.0 message handling
  • Session Management: UUID-based session tracking with capabilities
  • Bidirectional Communication: Real-time MCP protocol compliance

MCP Protocol Features

  • Protocol Version: MCP 2024-11-05
  • JSON-RPC 2.0: Full compliance with MCP specification
  • Multiple Transports: WebSocket, SSE, HTTP support
  • Tool Discovery: Dynamic tool listing and execution
  • Resource Management: Store info and settings via MCP resources
  • Smart Date Detection: Intelligent date parsing with timezone context
  • Mexico Timezone: Native UTC-6 (America/Mexico_City) support

🔧 Data Architecture

WooCommerce Integration

  • 44+ MCP Tools: Complete WooCommerce API coverage with customer analytics & order email lookup
  • Product Tools: Create, read, update, delete, batch operations
  • Order Tools: Order management, notes, status updates, email-based order lookup
  • Customer Tools: Customer CRUD operations, top customers analysis, purchase history
  • Analytics Tools: 12 comprehensive sales analytics with smart date detection
  • Promotion Tools: Active promotions, discounts, and special offers management
  • Mexican Market: Native MXN (Pesos Mexicanos) currency support
  • Real API Integration: Direct connection to live WooCommerce stores
  • Authentication: OAuth 1.0a with consumer key/secret
  • Timezone Aware: All date queries use Mexico City timezone (UTC-6)

Storage & Services

  • WooCommerce REST API: v1, v2, v3 support
  • Session Storage: In-memory session management
  • Logging: Winston-based structured logging
  • Validation: Joi schema validation for all inputs

👨‍💻 User Guide

For n8n Users

  1. Add MCP Node: Use n8n's MCP integration node
  2. WebSocket URL: ws://your-server:3000/mcp-ws
  3. Protocol: Select "MCP 2024-11-05"
  4. Tools Available: 44+ WooCommerce automation tools including customer analytics and order email lookup
  5. Authentication: Configure WooCommerce credentials in server .env

Smart Date Detection Features

  • Natural Language: Use "28 de agosto" or "August 28" for date queries
  • Context Aware: Automatically detects if date is past/future based on current time
  • n8n Integration: Use {{ $now }} variable for current date context
  • Mexico Timezone: All calculations in UTC-6 (America/Mexico_City)

Example Analytics Queries:

// Get sales for August 28 (automatically detects correct year)
{
  "name": "wc_get_daily_sales",
  "arguments": {
    "period": "28 de agosto",
    "context_date": "{{ $now }}"  // n8n current datetime
  }
}

// Get top customers by total spending
{
  "name": "wc_get_top_customers",
  "arguments": {
    "metric": "total_spent",
    "limit": 5
  }
}

// Get active promotions and discounts
{
  "name": "wc_get_promotions_active",
  "arguments": {
    "status": "active",
    "type": "coupon"
  }
}

// Get customer purchase history
{
  "name": "wc_get_customer_purchase_history",
  "arguments": {
    "customer_id": 45,
    "include_products": true
  }
}

// Find orders by email address (NEW!)
{
  "name": "wc_get_orders_by_email",
  "arguments": {
    "email": "customer@example.com",
    "status": "completed"
  }
}

For Direct API Usage

// Initialize MCP connection
POST /mcp
{
  "jsonrpc": "2.0",
  "method": "initialize",
  "params": {
    "protocolVersion": "2024-11-05",
    "clientInfo": {"name": "my-client", "version": "1.0.0"},
    "capabilities": {"tools": {}}
  },
  "id": 1
}

// List available tools
POST /mcp
{
  "jsonrpc": "2.0", 
  "method": "tools/list",
  "id": 2
}

// Execute WooCommerce tool
POST /mcp
{
  "jsonrpc": "2.0",
  "method": "tools/call", 
  "params": {
    "name": "wc_get_products",
    "arguments": {"per_page": 10}
  },
  "id": 3
}

🚀 Deployment

Current Status

  • Platform: E2B Sandbox (Development)
  • Status: ✅ Active - MCP Protocol Real Implementation Complete
  • Tech Stack: Node.js + TypeScript + Hono + WebSocket + MCP SDK
  • Process Manager: PM2 with ecosystem.config.cjs

EasyPanel Deployment

  1. Repository: Use GitHub repo mcp_woo_marckello
  2. Docker: Multi-stage build with production optimization
  3. Environment: Copy .env.easypanel template
  4. Port: 3000 (HTTP + WebSocket)
  5. Health: /health endpoint for monitoring

Local Development

# Install dependencies
npm install

# Build TypeScript
npm run build

# Start with PM2
pm2 start ecosystem.config.cjs

# Test MCP protocol
curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "initialize", "id": 1}'

🏪 WooCommerce API Setup

Required API Permissions

For real WooCommerce integration, ensure your API key has proper permissions:

  1. WordPress AdminWooCommerceSettingsAdvancedREST API
  2. Create API Key or Edit existing key
  3. Permissions: Set to "Read/Write" or minimum "Read" for analytics
  4. User: Select admin user with WooCommerce access
  5. Generate/Update and copy credentials to .env file

Currency Configuration

  • Default Currency: Mexican Pesos (MXN)
  • Market Focus: Mexican e-commerce market
  • Realistic Values: All demo data scaled for Mexican market
  • Real Integration: Connects to live WooCommerce for accurate MXN data

🎯 Implementation Status

✅ Completed Features

  • Native MCP Protocol: Complete JSON-RPC 2.0 implementation
  • Multiple Transports: WebSocket, SSE, HTTP support
  • 44+ WooCommerce Tools: Full API coverage via MCP with customer analytics & order email lookup
  • Smart Analytics: 12 analytics tools with intelligent date detection
  • Mexican Market Support: MXN currency, realistic pricing, Mexico timezone
  • Real API Integration: Direct connection to live WooCommerce stores
  • Mexico Timezone: Native UTC-6 support with n8n {{ $now }} integration
  • Session Management: UUID-based session tracking
  • Production Ready: PM2, logging, error handling
  • GitHub Integration: Source control with deployment ready
  • Docker Support: Multi-stage production builds

📋 Ready for Next Steps

  1. EasyPanel Deployment: Repository ready for container deployment
  2. N8n Integration: Native MCP WebSocket connection support
  3. Real Credentials: Update .env with actual WooCommerce API keys
  4. Production Scaling: PM2 cluster mode and load balancing

🔄 Integration Flow

n8n MCP Node → WebSocket → MCP Transport → Protocol Handler → WooCommerce Tools → API Response → MCP Response → n8n

Last Updated: August 30, 2025 - v2.3.0 Production Testing Verified Complete ✅

🏆 Production Testing Results - v2.3.0

PRODUCTION TESTING COMPLETED

Date: August 30, 2025 | Status: ✅ ALL TESTS PASSED

📊 Sales Analytics Verified

  • ✅ Query: "¿Cuáles fueron mis ventas del mes pasado?"
  • ✅ Real orders processed: August 2025 data
  • ✅ Revenue formula corrected: Net = Total - Shipping
  • ✅ Matches WooCommerce Dashboard exactly

🎯 Coupon Performance Verified

  • ✅ Query: "¿Cómo va mi cupón holasalud?"
  • ✅ Real data: 100 orders using holasalud coupon
  • ✅ Net Revenue: $441,676.70 (verified accurate)
  • ✅ Average Order Value: $4,416.77

🏆 Customer Analytics Verified

  • ✅ Query: "¿Quiénes son mis mejores clientes?"
  • ✅ Top Customer: MAGDA ALDACO ($245,783.08 - 4 orders)
  • ✅ Real LTV calculations working correctly
  • ✅ Customer metrics match actual store data

📈 Product Analytics Verified

  • ✅ Query: "¿Cuáles productos venden más?"
  • ✅ Top Product: Rhodiola Rosea (3,886 sales)
  • ✅ Real inventory and pricing data
  • ✅ Popularity metrics from actual sales

🚫 ZERO DEMO DATA POLICY

  • 100% Real Data: All responses use live WooCommerce API
  • No Fallbacks: Eliminated all demo data from codebase
  • Source Validation: All responses marked "source": "woocommerce_api"
  • Production Ready: No development artifacts in code

🚀 v2.3.0 Latest Features - PRODUCTION TESTED

  • 🔥 PRODUCTION TESTING COMPLETED: Comprehensive testing with real WooCommerce data verified
  • 🚫 ZERO DEMO DATA: Complete elimination of hardcoded demo data from entire codebase
  • 💰 CORRECTED REVENUE FORMULA: Net Revenue = Total - Shipping (matches WooCommerce Dashboard exactly)
  • ✅ REAL API VALIDATION: All 44+ tools tested with actual production queries
  • 🎯 COUPON ANALYTICS VERIFIED: holasalud coupon tested - 100 orders, $441,676.70 net revenue
  • 🏆 CUSTOMER METRICS TESTED: Real customer analytics with top spenders and LTV calculations
  • 📊 SALES ANALYTICS VERIFIED: Monthly sales reports with Mexico City timezone (UTC-6)
  • 🔒 SECURE GIT WORKFLOW: Production-ready with protected credentials and clean codebase
  • Order Email Lookup: wc_get_orders_by_email - Find orders by customer email address for support queries
  • Real API Integration: 100% real WooCommerce data - no fallbacks or demo modes
  • Enhanced Routing: Smart tool routing for orders, customers, analytics, and coupons
  • Mexican Market Support: Native MXN currency and Mexico timezone support
  • Schema Optimization: All schemas optimized for n8n compatibility (no default values)

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选