WooCommerce MCP

io.github.sadrmanesh由 GitHub 账号 sadrmanesh 发布v0.6.0更新于 Oct 31, 2026

Manage WooCommerce stores: products, orders, customers, coupons, webhooks, and analytics.

已验证STDIO仅桌面数据与分析商业与电商

概览

AI 生成的概览

面向 WooCommerce 商店的本地 MCP 服务器:浏览商品、订单、客户、优惠券与销售分析,并以预览和审计方式执行写入。

可以做什么
  • 浏览与搜索商品、订单、订单备注、客户、优惠券、Webhook、配送区域和税率
  • 创建和更新商品,批量更新最多 100 个商品,调整价格与库存
  • 管理订单:修改状态、增删备注、带物流信息发货,以及全额或部分退款
  • 运营促销:创建、更新、删除优惠券,安排与结束促销,查看优惠券效果
  • 读取分析数据:店铺概览、按日/周/月的销售、热销商品、支付方式和低库存报告
  • 将店铺、商品、订单和 Webhook 投递作为 MCP 资源提供,并提供销售简报、补货计划等提示词
适用场景
适合让助手协助经营 WooCommerce 店铺:回答销售与库存问题、起草促销方案,或在预览与审计记录下执行订单、商品和退款变更。适合希望写操作必须经确认、而非直接改动的运营者。
运行要求
需要 Node.js 20 或更高版本,可通过 npx 或 Docker 镜像运行;默认 stdio,也可选 HTTP 传输。需要 WOOCOMMERCE_URL,以及在 WooCommerce 设置中创建的 REST API 密钥对,分别放入 WOOCOMMERCE_CONSUMER_KEY 和 WOOCOMMERCE_CONSUMER_SECRET。WordPress 固定链接不能设为“朴素”。需能访问店铺网络。
安装前请注意
凭据可访问店铺数据,若使用读写密钥还可进行真实变更:订单、价格、库存、优惠券、退款和 Webhook。写入默认只读,且需确认前先预览,但若未设置 WOOCOMMERCE_APPROVAL_SECRET(并使其远离助手),助手可在同一轮内预览并确认。请求 apiRefund 时退款会实际退回款项。未开启 WOOCOMMERCE_REDACT_PII 时会返回客户个人信息;密钥应放在 env 而非 args。

安装

在 SourceWeft 中

  1. 打开 控制台中的 WooCommerce MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

woocommerce-mcp

[CI] [License: MIT] [Node.js] [Docs] [npm] [DOI] [MCP Registry] [Glama MCP server score] [Listed on mcpservers.org] [WooCommerce MCP on mcprush] [M8ven Score] [M8ven Verified]

A Model Context Protocol server for running one or more WooCommerce stores through the WooCommerce REST API. MCP clients can browse the catalog, work through and fulfill orders, issue refunds, adjust prices and stock in bulk, run promotions, segment customers, react to webhooks, and read sales analytics. Every change is previewed before it is applied and can be written to an audit log.

It runs locally over stdio, or as a remote service over streamable HTTP with bearer-token or OAuth 2.0 authentication, and ships as a Docker image on the GitHub Container Registry.

Documentation: https://sadrmanesh.github.io/woocommerce-mcp/ · Tool explorer: Hugging Face Space

Read more: Safe write tools for agents: preview, confirm, audit, and stale previews in a WooCommerce MCP server on Dev.to · Preview, confirm, audit on LinkedIn · Update: A week of reader feedback: what changed in my four AI-for-commerce tools on Dev.to · What reader feedback taught me about building production-safe AI tooling for commerce on LinkedIn

Listed on the official MCP Registry as io.github.sadrmanesh/woocommerce-mcp, on Glama, and on mcpservers.org.

[woocommerce-mcp MCP server on Glama] [WooCommerce MCP server]

Contents

Highlights

  • Multi-store. Configure any number of stores and pick one per call with store. Each store has its own credentials and its own read-only switch.
  • Safe by default. Stores are read-only until you allow writes. Write tools then return a preview of the exact REST request and apply it only when called again with confirm: true. A confirm is refused if the arguments or the store data the change was computed from changed since the preview. dryRun: true always previews.
  • Signed approvals (optional). Set WOOCOMMERCE_APPROVAL_SECRET and a confirm also needs a short-lived, single-use token signed for that exact preview by someone outside the agent's reach, for example with woocommerce-mcp approve <previewId>. The agent cannot approve its own writes.
  • Audit log. One JSON line per write attempt: applied, previewed, refused, or failed, with the tool, store, arguments, caller, and a preview id that links each confirmed write to its preview.
  • Refunds and bulk operations. Partial or line-item refunds, batch updates of up to 100 products, and percentage or fixed price adjustments.
  • Analytics. Sales by day, week, or month with refunds, average order value, top products, and payment methods, plus a low-stock report that covers variations.
  • Promotions and customers. Coupon performance, scheduled sales, and customer segments such as VIP, repeat, and at risk.
  • Fulfillment. Order notes, shipment tracking, and one-step fulfillment that emails the customer.
  • Webhooks. Manage store webhooks and receive signed deliveries, readable as MCP resources.
  • Shipping and taxes. Read shipping zones, methods, tax rates, and tax classes.
  • Privacy and control. Optional PII redaction, and tool allow and deny lists per deployment or per store.
  • Gentle on the store. Per-store rate limiting, retries with backoff and jitter, and an optional read cache.
  • Remote ready. Streamable HTTP with static bearer tokens (full or read-only) or RFC 7662 token introspection, RFC 9728 protected resource metadata, Host and Origin checks, and a health endpoint.
  • MCP resources and prompts. Read products and orders by URI, and start common workflows such as a sales briefing or a restock plan.
  • Observability. Optional OpenTelemetry traces for every tool call and WooCommerce request.
  • Well tested. Strict TypeScript, Zod validation on every input, and tests against a mocked WooCommerce API.

Quick start

Node.js 20 or newer is required.

bash
npm install -g @sadrmanesh/woocommerce-mcp

Or run the Docker image from the GitHub Container Registry (linux/amd64 and linux/arm64, tags X.Y.Z, X.Y, and latest). The same image is on Docker Hub as sadrmanesh/woocommerce-mcp:

bash
docker run --rm -i -e MCP_TRANSPORT=stdio \  -e WOOCOMMERCE_URL -e WOOCOMMERCE_CONSUMER_KEY -e WOOCOMMERCE_CONSUMER_SECRET \  ghcr.io/sadrmanesh/woocommerce-mcp:0.6.0

The npm package is also on GitHub Packages; see Install options for the .npmrc setup. npmjs.com remains the main registry.

Or from a checkout:

bash
git clone https://github.com/sadrmanesh/woocommerce-mcp.gitcd woocommerce-mcpnpm installnpm run buildcp .env.example .env

Create a REST API key under WooCommerce > Settings > Advanced > REST API. Use a Read key while the store is read-only, and a Read/Write key only when you enable writes. WordPress permalinks must not be set to "Plain", or /wp-json/ will not resolve.

bash
WOOCOMMERCE_URL=https://store.example.com \WOOCOMMERCE_CONSUMER_KEY=ck_... \WOOCOMMERCE_CONSUMER_SECRET=cs_... \woocommerce-mcp

The process then serves MCP on stdin and stdout. Logs go to stderr. npm start in a checkout loads .env from the working directory without overriding variables that are already set.

Connect an MCP client

Most hosts accept an mcpServers map like the ones below. Keep secrets in env, never in args. Docker, Smithery, and MCP Registry installs are in docs/install.md.

stdio

json
{  "mcpServers": {    "woocommerce": {      "command": "npx",      "args": ["-y", "@sadrmanesh/woocommerce-mcp"],      "env": {        "WOOCOMMERCE_URL": "https://store.example.com",        "WOOCOMMERCE_CONSUMER_KEY": "ck_your_consumer_key",        "WOOCOMMERCE_CONSUMER_SECRET": "cs_your_consumer_secret"      }    }  }}

From a checkout, use "command": "node" and "args": ["/absolute/path/to/woocommerce-mcp/dist/index.js"].

Streamable HTTP

bash
MCP_TRANSPORT=http MCP_HTTP_AUTH_TOKENS="$(openssl rand -base64 32)" woocommerce-mcp
json
{  "mcpServers": {    "woocommerce": {      "type": "http",      "url": "https://mcp.example.com/mcp",      "headers": { "Authorization": "Bearer <token>" }    }  }}

Without authentication the HTTP endpoint only binds to loopback. See docs/security.md for tokens, scopes, and OAuth introspection.

Tools, resources, and prompts

Every tool except woocommerce_list_stores accepts an optional store id. Without it, the default store is used.

To browse every tool with its full input schema and build tools/call requests in the browser, open the tool explorer on Hugging Face.

AreaRead toolsWrite tools
Storeslist_stores
Productslist_products, search_products, get_productcreate_product, update_product, bulk_update_products, bulk_adjust_prices
Orderslist_orders, get_order, list_order_notesupdate_order_status, add_order_note, delete_order_note
Fulfillmentget_order_trackingfulfill_order
Refundslist_refunds, get_refundcreate_refund
Customerslist_customers, get_customer, customer_orders, customer_segmentsupdate_customer
Stockget_stock, low_stock_reportupdate_stock
Coupons and saleslist_coupons, get_coupon, coupon_performancecreate_coupon, update_coupon, delete_coupon, schedule_sale, end_sale
Webhookslist_webhooks, get_webhook, list_webhook_eventscreate_webhook, update_webhook, delete_webhook
Shipping and taxeslist_shipping_zones, list_shipping_methods, list_tax_rates, list_tax_classes
Analyticsget_store_summary, sales_analytics

Every name starts with woocommerce_, for example woocommerce_customer_segments. That makes 47 tools: 28 reads and 19 writes.

Resources

URIContent
woocommerce://storesConfigured stores
woocommerce://stores/{store}/products/{id}One product
woocommerce://stores/{store}/orders/{id}One order
woocommerce://stores/{store}/eventsRecent webhook deliveries
woocommerce://stores/{store}/events/{id}One webhook delivery with its payload

Prompts: sales_briefing, restock_plan, order_triage, and price_change_review.

Full argument and response details are in docs/tools.md.

Safe writes

  1. Read-only stores. A store accepts writes only when WOOCOMMERCE_READ_ONLY=false (single store) or "readOnly": false (store list). Otherwise write tools fail with read_only before contacting the store.

  2. Confirmation. With WOOCOMMERCE_REQUIRE_CONFIRMATION=true (the default), the first call returns the planned request and changes nothing:

    json
    {  "status": "confirmation_required",  "store": "default",  "previewId": "pv_4f1c9a2e7b3d0856",  "message": "The change was NOT applied. ...",  "request": { "method": "PUT", "path": "orders/1015", "query": {}, "body": { "status": "completed" } }}

    Calling the tool again with the same arguments and confirm: true applies it. dryRun: true always previews, even with confirmation turned off. Every preview carries a previewId; send it back with confirm: true and the server refuses the call with preview_mismatch if the arguments changed since the preview.

    Tools that compute a write from store data, such as a 10% price increase, resolve it at preview time: the preview lists each record it read under preconditions, with the current values (before) and the absolute values the write will set (after), and the previewId gains a second part that fingerprints that data. On confirm the server reads the same data again, and if it changed, for example because the price was edited in between, the call is refused with stale_preview and nothing is sent. See Stale previews for what is and is not covered.

  3. Scopes. Over authenticated HTTP, write tools also need the woocommerce:write scope. Read-only tokens can never change a store.

  4. Audit. Set WOOCOMMERCE_AUDIT_LOG to a file path or stderr:

    json
    {"time":"2026-10-30T14:02:11.120Z","tool":"woocommerce_update_order_status","store":"default","outcome":"applied","arguments":{"id":1015,"status":"completed"},"client":"static:3f9a1c2b7d10","previewId":"pv_4f1c9a2e7b3d0856","previewMatch":true}
  5. Signed approvals (optional). A preview id binds what is confirmed, not who confirmed it: by default an agent can request a preview and confirm it in the same turn. Set WOOCOMMERCE_APPROVAL_SECRET to require an approval token on every confirm. The token is an HMAC-SHA256 signature over the exact previewId (state part included), tool, store, and an expiry, so it cannot be reused for other arguments or a changed store. Tokens are single-use and expire after 10 minutes by default. A person signs one after reviewing the preview:

    bash
    woocommerce-mcp approve pv_e2a742fe51c807fc_a3510d17b8a51b93 --by "Naser"

    The command shows the previewed change from the audit log, asks for a yes, and prints the token, which the agent passes back as approval with confirm: true. Missing, invalid, expired, mismatched, and reused tokens are refused with approval_required, approval_invalid, approval_expired, approval_mismatch, and approval_replayed. The token format is documented, so an approval page or webhook can sign too.

    What this is not: whoever holds the secret can approve, so keep it out of MCP client configs, prompts, and any host the agent has a shell on. Spent tokens are tracked in memory per process. Without the secret, behavior is exactly as in 0.5.0. See Signed approvals.

Refunds created by woocommerce_create_refund are recorded as manual refunds unless apiRefund: true asks the payment gateway to return the money.

Configuration

The most common settings are below. Every variable, including the multi-store file format, is in docs/configuration.md and .env.example.

VariableDefaultDescription
WOOCOMMERCE_URLStore origin, without /wp-json
WOOCOMMERCE_CONSUMER_KEY / _SECRETREST API credentials
WOOCOMMERCE_READ_ONLYtrueAllow writes for the single store
WOOCOMMERCE_STORES_FILE / WOOCOMMERCE_STORESSeveral stores, as a JSON file or inline JSON
WOOCOMMERCE_DEFAULT_STOREfirst storeStore used when a call omits store
WOOCOMMERCE_REQUIRE_CONFIRMATIONtruePreview writes until confirm: true
WOOCOMMERCE_AUDIT_LOGoffFile path or stderr
WOOCOMMERCE_APPROVAL_SECREToffRequire a signed approval token on every confirmed write. Keep it away from the agent
WOOCOMMERCE_APPROVAL_TTL_SECONDS600Longest approval token lifetime the server accepts
MCP_TRANSPORTstdiostdio or http
MCP_HTTP_HOST / _PORT / _PATH127.0.0.1 / 3000 / /mcpHTTP listener
MCP_HTTP_AUTH_TOKENSFull-access bearer tokens
MCP_HTTP_AUTH_READ_TOKENSRead-only bearer tokens
WOOCOMMERCE_REDACT_PIIfalseMask names, emails, phones, and addresses in results
WOOCOMMERCE_TOOLS_ALLOW / _DENYTool names or * patterns to expose or hide
WOOCOMMERCE_WEBHOOK_SECRETEnables the webhook receiver for the store
WOOCOMMERCE_RATE_LIMIT / _BURST5 / 10Requests per second per store, and burst
WOOCOMMERCE_CACHE_TTL_MS0 (off)Cache read responses
WOOCOMMERCE_OTEL_ENABLEDfalseExport OpenTelemetry traces

Multi-store example (stores.json):

json
{  "defaultStore": "eu",  "stores": [    { "id": "eu", "label": "EU shop", "url": "https://eu.example.com", "consumerKeyEnv": "EU_KEY", "consumerSecretEnv": "EU_SECRET" },    { "id": "us", "url": "https://us.example.com", "consumerKeyEnv": "US_KEY", "consumerSecretEnv": "US_SECRET", "readOnly": false }  ]}

Deployment

bash
cp .env.example .env    # add store credentials and MCP_HTTP_AUTH_TOKENSdocker compose up -d --buildcurl http://127.0.0.1:3000/healthz

The image runs as a non-root user, listens on port 3000, and has a health check. Put it behind a TLS-terminating reverse proxy for remote use. See docs/deployment.md.

Development

bash
npm installnpm run check   # lint, typecheck, tests, build

Tests run against a mocked WooCommerce API and never call a live store. See CONTRIBUTING.md.

Documentation

The full documentation site is at https://sadrmanesh.github.io/woocommerce-mcp/. The same guides are in this repository:

Technical report

[DOI]

Technical Report: WooCommerce Model Context Protocol Server - A Multi-Store, Previewed Safe-Write Architecture for Autonomous AI Agents in E-Commerce. M. N. Sadrmanesh, Zenodo, 2026. https://doi.org/10.5281/zenodo.23897615 Also on ResearchGate and Academia.edu.

bibtex
@techreport{sadrmanesh2026woocommercemcp,  author      = {Sadrmanesh, Mohammad Naser},  title       = {Technical Report: WooCommerce Model Context Protocol Server - A Multi-Store, Previewed Safe-Write Architecture for Autonomous AI Agents in E-Commerce},  institution = {Zenodo},  year        = {2026},  version     = {1.0},  doi         = {10.5281/zenodo.23897615},  url         = {https://doi.org/10.5281/zenodo.23897615}}

License

MIT. Copyright (c) 2026 Naser Sadrmanesh. See LICENSE.

Author

Naser Sadrmanesh: https://github.com/sadrmanesh · https://sadrmanesh.github.io · [email protected]

来源:README.md,提交 2f16b6c

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:服务器未能启动。

版本历史

4
  1. v0.6.0最新Oct 31, 2026
  2. v0.5.0Oct 31, 2026
  3. v0.4.0Oct 31, 2026
  4. v0.3.2Oct 30, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分