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
Visit Server

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)

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured