WooCommerce Agent Connector
Provides read-only access to a WooCommerce store's orders through three validated MCP tools: list recent orders with optional status and date filters, retrieve a single order by numeric ID, and search orders by customer email, status, order number or date range. Responses are normalized into concise agent-facing fields (ID, number, status, currency, total, customer info, timestamps, payment method, line-item summaries), with bounded pagination, timeouts, retry/backoff handling for rate limits and transient errors, and safe structured errors.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@WooCommerce Agent Connectorshow me the 5 most recent orders"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
WooCommerce Agent Connector
A production-oriented read-only WooCommerce connector for AI agents, built for a Forward-Deployed Engineer — Agent Studio technical assignment.
Demo mode is enabled by default. All included merchant/customer data is fictional.
Problem
Agents need a narrow and predictable interface to merchant systems. This connector avoids exposing raw WooCommerce payloads or broad administrative access and instead provides three validated, read-only order primitives.
Related MCP server: mcp-server-woocommerce
Solution
The connector places a small, validated service boundary between an AI agent and WooCommerce. MCP tools call the same OrderService used by the HTTP demo, while the WooCommerce client owns authentication, timeouts, retries and upstream error mapping.
Features
MCP-compatible list/get/search tools
WooCommerce REST API v3 client
Environment-based credentials
Credential-free mock/demo mode
Zod input validation
Bounded pagination
Request timeout
Retry-After aware 429 handling
Bounded exponential backoff for transient 5xx responses
Agent-friendly response normalization
Safe structured errors
Automated tests without a live store
Responsive white-background demo UI
Tech stack
TypeScript + Node.js 20+
Express HTTP demo/API
MCP TypeScript SDK with stdio transport
WooCommerce REST API v3
Zod validation
Vitest tests
ESLint + Prettier
Architecture
Agent / Agent Studio -> MCP Tool Layer -> Order Service -> WooCommerce API Client -> WooCommerce REST API
Detailed design: docs/ARCHITECTURE.md.
Requirements
Node.js 20+ and npm.
Setup
git clone https://github.com/anuragverma4895/woocommerce-agent-connector.git
cd woocommerce-agent-connector
npm install
cp .env.example .envWindows PowerShell:
Copy-Item .env.example .envThe default USE_MOCK_DATA=true requires no credentials.
Configuration
Variable | Purpose | Required |
USE_MOCK_DATA | Use fictional local data instead of WooCommerce | No; defaults to true |
WOOCOMMERCE_STORE_URL | WooCommerce store base URL | Required when mock mode is disabled |
WOOCOMMERCE_CONSUMER_KEY | WooCommerce REST consumer key | Required when mock mode is disabled |
WOOCOMMERCE_CONSUMER_SECRET | WooCommerce REST consumer secret | Required when mock mode is disabled |
PORT | HTTP server port | No; defaults to 3000 |
REQUEST_TIMEOUT_MS | Upstream request timeout | No; defaults to 8000 |
MAX_RETRIES | Maximum retry attempts | No; defaults to 2 |
RETRY_BASE_DELAY_MS | Base exponential-backoff delay | No; defaults to 250 |
MAX_PER_PAGE | Configured pagination ceiling | No; defaults to 50 |
.env.example contains placeholders only. Never commit .env or real merchant credentials.
Run the HTTP demo
npm run devOpen http://localhost:3000.
The demo is pure white with dark typography and includes connector status, demo mode, order listing, filtering/search, order details, loading/error/empty states and pagination.
Endpoints:
GET /health
GET /api/orders
GET /api/orders/:id
GET /api/orders/searchExamples:
GET /api/orders?per_page=5
GET /api/orders/1001
GET /api/orders/search?status=processing
GET /api/orders/search?customer_email=diya@example.test
GET /api/orders/search?order_number=1002Run the MCP server
npm run mcpThe server uses stdio transport. Tool registration is in src/mcp/tools.ts; detailed schemas and examples are in docs/MCP_TOOLS.md.
MCP tools
list_orders
Lists recent orders with optional status and date filters.
get_order
Retrieves one order by positive numeric ID.
search_orders
Searches using supported filters: customer email, status, order number and date range. At least one filter is required.
All tools enforce bounded pagination and return normalized order data.
Production WooCommerce mode
Set:
USE_MOCK_DATA=false
WOOCOMMERCE_STORE_URL=https://your-store.example.com
WOOCOMMERCE_CONSUMER_KEY=ck_...
WOOCOMMERCE_CONSUMER_SECRET=cs_...Credentials are read only from environment configuration and are never returned to the agent.
Response and error handling
The connector normalizes WooCommerce orders into concise agent-facing fields such as ID, number, status, currency, total, relevant customer information, timestamps, payment method and line-item summaries.
Errors are converted into a safe structure:
{
"success": false,
"error": {
"code": "ORDER_NOT_FOUND",
"message": "No order was found with ID 123."
}
}Known cases include invalid input, authentication failure, forbidden access, not found, rate limiting, timeout, network failure and malformed upstream responses. Raw stack traces and credential material are not exposed.
Rate-limit and retry strategy
For 429 and transient 5xx responses the client:
Reads Retry-After when supplied.
Otherwise calculates bounded exponential backoff.
Retries only within MAX_RETRIES.
Caps individual delays.
Returns a structured error when the retry budget is exhausted.
Request timeouts are bounded and aborts are returned as retryable timeout errors.
Security considerations
Secrets are environment-only.
.env is ignored.
MCP operations are read-only.
Pagination is bounded.
Request body size and upstream timeout are bounded.
Retry count is bounded.
Responses are normalized before agent exposure.
Demo data uses fictional .test addresses.
No authentication headers or API credentials are returned.
Testing
npm test
npm run build
npm run lintNo real WooCommerce credentials are needed for tests. The test suite uses mocked upstream responses and covers the required connector behaviors.
Example agent interactions
User: Show me the latest 5 orders.
Agent: Calls list_orders with page=1, per_page=5.
User: Get details for order 1001.
Agent: Calls get_order with order_id=1001.
User: Find processing orders for diya@example.test.
Agent: Calls search_orders with customer_email and status as needed.
User: Get order -4.
Connector: Rejects the request before contacting WooCommerce with INVALID_ORDER_ID.
Demo mode
Demo mode uses fictional orders, customers, emails and products. It demonstrates listing, getting, filtering/searching, pagination, order details and error states without a real WooCommerce store.
Capabilities and limitations
See docs/CAPABILITIES.md.
The implementation intentionally focuses on read-only order access. It does not create, modify, cancel, refund or delete orders; change inventory; access arbitrary WordPress administration data; bypass WooCommerce permissions; or perform arbitrary semantic search.
Customer-email filtering is implemented as a connector-supported filter rather than being presented as arbitrary WooCommerce full-text search.
Project structure
src/
clients/ WooCommerce API client
config/ Environment validation
data/ Fictional demo data
mcp/ MCP server and tools
services/ Business logic and normalization
types/ Domain types
utils/ Validation and errors
app.ts HTTP API + demo UI
server.ts HTTP entry point
docs/
ARCHITECTURE.md
CAPABILITIES.md
MCP_TOOLS.mdAssignment alignment
Authentication: environment-based WooCommerce API credentials
List/get/search primitives: three MCP tools
Rate-limit handling: bounded retry/backoff + Retry-After
MCP specification: actual SDK registration + detailed documentation
Agent boundaries: read-only tools and normalized responses
Setup/run instructions: this README
Assumptions/limitations: docs/CAPABILITIES.md
Automated verification: Vitest, ESLint and TypeScript build
No real customer data, passwords, API keys or credentials are included.
Design decisions
The connector is intentionally read-only so an agent cannot mutate merchant state.
The MCP layer calls the same OrderService used by the HTTP demo, avoiding duplicated business logic.
Mock mode is the default so reviewers can run the project without real merchant credentials.
Responses are normalized before being exposed to an agent to reduce payload size and avoid leaking unrelated WooCommerce fields.
Pagination, retries and request timeouts are bounded to prevent uncontrolled resource usage.
Customer-email search is implemented as a supported connector filter; the project does not claim arbitrary WooCommerce semantic search.
MCP SDK
The MCP implementation uses @modelcontextprotocol/server@^2.3.0 with stdio transport. Tool definitions use the SDK's McpServer.registerTool() API.
Future improvements
Add merchant installation/OAuth and per-tenant secret storage for a multi-merchant deployment.
Add contract tests against a dedicated WooCommerce sandbox.
Add structured observability with sensitive-field redaction.
Add distributed rate-limit coordination for horizontally scaled deployments.
Expand read-only coverage to additional merchant resources only when the agent use case requires them.
This server cannot be deployed
Maintenance
Related MCP Connectors
Federated commerce search across independent WooCommerce merchants. Keyless, read-only MCP server.
MerchantFlow is a hosted, read-only ecommerce analytics MCP server for Shopify and WooCommerce. It gives AI assistants tenant-scoped access to revenue, profit and loss, product and SKU profitability, COGS coverage, fulfillment costs, advertising spend, ROAS, marketing performance, cohorts, LTV, and business valuation across connected commerce and marketing platforms. Connect with OAuth over Streamable HTTP. No local server installation is required.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Security-first WordPress MCP server. 129 tools for Claude, ChatGPT, Gemini. Free on wp.org.
Related MCP Servers
- AlicenseBqualityDmaintenanceA production-grade MCP server for the WooCommerce REST API, enabling AI assistants to manage products, orders, customers, and store settings.3419 PyPI1MIT
- AlicenseBqualityCmaintenanceMCP server for managing WooCommerce stores through AI assistants like Claude. Provides 101 tools covering products, orders, customers, coupons, shipping, taxes, webhooks, settings, reports, and more.100134 npm2MIT
- FlicenseNot gradedqualityDmaintenanceDemo MCP server that exposes order and customer data as read-only tools for AI assistants, simulating a business API or internal data source.-
- FlicenseAqualityCmaintenanceAn MCP server that connects LLM agents to a WooCommerce store via its REST API, providing tools for managing products, orders, customers, coupons, and reports.40-