commerce-ops-harness
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., "@commerce-ops-harnessinvestigate order ord_5001"
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.
Commerce Ops Harness MCP
A remotely hosted Model Context Protocol server (TypeScript + PostgreSQL) that lets a commerce ops person handle the most engineer-dependent exception in the queue — a stuck or delayed order with a carrier exception — through to the refund decision: an automatic refund executed under policy, or a manager escalation that carries the full diagnosis.
The MCP is the product. There is no frontend; any MCP client (Claude, Cursor, MCP Inspector) is the operator console.
MCP endpoint |
|
Health |
|
Source |
|
Demo video |
System design with diagrams: ARCHITECTURE.md. Product decisions, assumptions, and exclusions: PRODUCT_DECISIONS.md. AI usage: AI_WORKLOG.md.
How it works
The AI client does the language; the server owns truth and money. Ops asks in plain English, the client drives the tools, and every dollar-moving decision is computed and enforced server-side in a single transaction — the model can request a refund, but it cannot talk its way past the policy.
A refund executes automatically only when every check passes; otherwise the server files a pending manager escalation with the diagnosis and the exact checks that failed, so the manager decides from evidence instead of re-investigating.
Check | Rule |
| Requested amount > $0 |
| Requested amount ≤ $150.00 |
| Requested amount ≤ refundable balance (paid − already refunded) |
| Order placed no more than 30 days ago |
| Customer risk score < 70 (exactly 70 fails) |
| A lost / damaged / stuck exception derived from the carrier event stream — never a pre-set flag — and not superseded by a later delivery |
Duplicate protection covers the same eligible amount and action: repeating decide_refund for an amount already refunded returns the original refund; repeating it for an amount with a pending escalation returns that escalation. Both are backed by unique indexes, and the decision runs with the order row locked — concurrent requests cannot double-refund. Partial refunds are first-class: ops picks the amount (default: full paid amount) and it passes through the same checks.
Related MCP server: OrderOps MCP
MCP tools
Tool | What it does |
| Seeded orders, one per way the workflow can go — start here |
| Full case: customer + risk score, payments, shipments, carrier events, refunds, escalations |
| Unified chronological timeline across all systems |
| Derives carrier-exception verification from events, classifies root cause with evidence, previews what |
| The single state-changing tool: auto-refund or manager escalation, per the policy above |
| Manager view: pending escalations with failed checks + full diagnosis |
| Audit trail of every decision |
| Reset the synthetic database to its seeds |
Try it (no local setup)
Connect any MCP client to the hosted /mcp URL above, then:
list_scenariosopen_case→get_timeline→diagnosewithord_1001decide_refundwithord_1001→ automatic $89.99 refunddecide_refundagain → the same refund returned, not a second onedecide_refundwithord_1004→ manager escalation (risk score exactly 70)get_escalations→ the escalation with failed checks and diagnosis attached
Seeded scenarios
Order | Scenario | Expected outcome |
| Lost package, all checks pass | Auto-refund $89.99 |
| Damaged, but paid $210 (> cap) | Full refund escalates; partial ≤ $150 auto-executes |
| Lost, order 45 days old | Escalation (age) |
| Stuck, risk score exactly 70 | Escalation (risk) |
| Slow but no exception events | Escalation (exception not verified) |
| Refund already executed | Idempotent — original refund returned |
| Stuck event, later delivered | Escalation (exception superseded by delivery) |
The database is shared — concurrent testers see each other's refunds and escalations. reset_demo_data(confirm=true) restores a clean slate.
Run locally
docker run -d --name commerce-ops-pg -e POSTGRES_PASSWORD=devpass \
-e POSTGRES_DB=commerce_ops -p 5433:5432 postgres:16-alpine
npm install
npm run dev # schema + seeds apply automatically on boot
npm test # 28 tests: policy boundaries, event derivation, idempotency, E2E over MCPDATABASE_URL defaults to the docker container above; point it anywhere else to override.
Deploy (Render)
render.yaml provisions the web service plus a managed PostgreSQL instance and wires DATABASE_URL; schema and seeds apply on first boot. See HOSTING.md.
Design notes
Money is integer cents in storage and policy; the tool boundary accepts dollars and rejects sub-cent amounts. The $150.00 cap is exact, not floating-point-adjacent.
Diagnosis is a deterministic evidence assembler and the policy engine is a pure function — so the boundaries that matter are unit-tested exactly: $150.00 vs $150.01, day 30 vs 31, score 69 vs 70.
Verification is derived, not declared.
shipments.statusexists as carrier metadata but is never consulted for eligibility — onlycarrier_eventsare.One state-changing tool. Everything else is read-only, which keeps the safety review surface small and the audit trail complete.
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect, monitor, and control AI agents — tasks, approvals, schedules, and governance.
The system of record for AI agent authority: playbooks, routed policy questions, reusable rules.
Read-only finance and operations controls for AI agents with evidence and safe next actions.
Agent-native security, trust, reliability, data and procurement tools for AI workflows.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to investigate and resolve e-commerce order exceptions like damages, lost shipments, refunds, and replacements through a unified interface with built-in guardrails.-
- FlicenseNot gradedqualityCmaintenanceEnables AI assistants to investigate and safely resolve commerce order exceptions, such as expired inventory reservations, by providing a workflow across synthetic order, payment, inventory, and fulfillment systems.-
- FlicenseNot gradedqualityBmaintenanceEnables AI assistants to detect and investigate e-commerce payment-fulfillment discrepancies, create durable escalation tickets, and track resolution status.1-
- FlicenseNot gradedqualityBmaintenanceEnables operations teams to diagnose and resolve stuck orders via natural-language queries. It provides evidence-based resolution proposals, but any state-changing action requires explicit human confirmation.-