Skip to main content
Glama
woocommerce-mcp

woocommerce-mcp

by mubasher1111
README.md
# šŸ›’ woocommerce-mcp

**Talk to your WooCommerce store.** An MCP server that connects Claude, Cursor, VS Code and other AI
assistants to your store: exact sales reports, orders, products, low stock and customers.
Read-only by default.

> "How much did we sell this month, and what were the top 5 products?"
> "Which items are about to run out?"
> "Show me Sana's last order and its notes."

Every number comes from your store's real orders, calculated by code, not guessed by the AI.

[![Tests](https://github.com/mubasher1111/woocommerce-mcp/actions/workflows/test.yml/badge.svg)](https://github.com/mubasher1111/woocommerce-mcp/actions/workflows/test.yml)
[![npm](https://img.shields.io/npm/v/woocommerce-mcp)](https://www.npmjs.com/package/woocommerce-mcp)
![License](https://img.shields.io/badge/license-MIT-blue)
![MCP](https://img.shields.io/badge/MCP-server-8A2BE2)

šŸ“– **[Full guide](https://zexcart.site/woocommerce-mcp/)**

---

## Tools

| Tool | What it does |
|---|---|
| `store_overview` | Orders by status, product count, out-of-stock count, latest orders. |
| `sales_report` | For any date range: orders, gross and net sales, refunds, discounts, shipping, tax, average order value, items sold, sales by day, top products, top customers, payment methods and cities. |
| `list_orders` | Find orders by status, date or search (order number, name, email, phone). |
| `get_order` | One order in full: customer, addresses, items, totals, refunds, coupons and notes. |
| `list_products` | Products with price, stock and total sales; search by name or SKU; sort by best-selling. |
| `low_stock` | Products **and variations** out of stock or at/below a threshold, so you know what to reorder. |
| `find_customers` | Registered customers by name or email. |

**Changes (off by default)**: with `WOOCOMMERCE_ALLOW_WRITES=true` and a Read/Write key, four more
tools appear: `update_order_status`, `add_order_note`, `update_stock` and `update_price`. Claude is
told to confirm each change with you first, and every result shows the value before and after.

## Setup

### 1. Create an API key in WooCommerce

WordPress admin → **WooCommerce → Settings → Advanced → REST API → Add key**.
Choose your user, set **Permissions: Read** (or Read/Write if you'll enable changes), and click
**Generate API key**. Copy the Consumer key (`ck_…`) and Consumer secret (`cs_…`).

Your store must use `https://`.

### 2. Add the server

You need [Node.js](https://nodejs.org) 20 or newer.

**Claude Desktop**: Settings → Developer → Edit Config:

```json
{
  "mcpServers": {
    "woocommerce": {
      "command": "npx",
      "args": ["-y", "woocommerce-mcp"],
      "env": {
        "WOOCOMMERCE_URL": "https://yourstore.com",
        "WOOCOMMERCE_KEY": "ck_xxxxxxxxxxxxxxxx",
        "WOOCOMMERCE_SECRET": "cs_xxxxxxxxxxxxxxxx"
      }
    }
  }
}
```

Restart Claude Desktop and ask: *"Give me an overview of my store."*

**Claude Code**:

```bash
claude mcp add woocommerce \
  -e WOOCOMMERCE_URL=https://yourstore.com \
  -e WOOCOMMERCE_KEY=ck_xxx -e WOOCOMMERCE_SECRET=cs_xxx \
  -- npx -y woocommerce-mcp
```

**Cursor / VS Code**: the same `command`, `args` and `env` in `.cursor/mcp.json` or `.vscode/mcp.json`.

### 3. (Optional) Allow changes

Use a **Read/Write** key and add `"WOOCOMMERCE_ALLOW_WRITES": "true"` to `env`. Leave it out to keep
the assistant strictly read-only.

## Privacy and safety

- The server runs on your computer and talks only to your store. Your key stays in your local config.
- Order data you ask about is sent to your AI assistant (for example Anthropic for Claude), like
  anything else you share in a chat.
- Read-only unless you enable changes. Changing an order status can make WooCommerce email the
  customer, as it would from the admin.

## Troubleshooting

| Message | Fix |
|---|---|
| rejected the API key (401) | Check the key and secret; the key's user must be a shop manager or admin. Some hosts strip the Authorization header: ask them to allow it, or check your security plugin. |
| isn't allowed (403) | The key is Read-only. Create a Read/Write key for changes. |
| has no WooCommerce API | Check the URL; WooCommerce must be active and Settings → Permalinks must not be "Plain". |
| didn't return WooCommerce data | A firewall or security plugin is blocking `/wp-json/`. Allow it for your IP. |

## Limits

- `sales_report` and `low_stock` read up to 2,000 orders/products per call; for bigger stores use
  shorter date ranges. Totals are by order date in the store's timezone.
- Sales are counted from orders (completed, processing and on-hold by default), so they can
  differ slightly from WooCommerce Analytics, which has its own settings for which statuses count.

## Development

```bash
git clone https://github.com/mubasher1111/woocommerce-mcp.git
cd woocommerce-mcp
npm install
npm test     # runs the server over stdio against a fake WooCommerce store
```

## License

[MIT](LICENSE). Made by [ZexCart](https://zexcart.site). More free tools:
[zexcart.site/dev-tools](https://zexcart.site/dev-tools/). Need a custom store integration?
[Get in touch](https://zexcart.site/contact/).

If it saves you time, please ⭐ **star the repo**.