commerce-ops-recovery-mcp
Click on "Install 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-recovery-mcpInvestigate order ORD-DEMO-1042 and prepare a recovery plan"
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 Operations Recovery MCP
A remotely hosted TypeScript MCP server for safely recovering a specific commerce failure where a processor payment was captured, but the local order remained blocked because its webhook failed.
The server investigates the current state, prepares an exact recovery plan, waits for approval, and applies the approved changes in one PostgreSQL transaction.
Live MCP demo
Base URL: https://commerce-ops-recovery-mcp.demostore.workers.dev
Route | Purpose |
| Service information |
| Remote Streamable HTTP endpoint |
| Worker health check |
| PostgreSQL connectivity check |
The /mcp route is a protocol endpoint, so opening it directly in a browser
may return Method Not Allowed. Connect through Claude, MCP Inspector, or
another compatible remote MCP client.
Claude custom connector
In Claude, open Customize → Connectors, add a custom connector, and use:
Name: Commerce Operations Recovery
URL: https://commerce-ops-recovery-mcp.demostore.workers.dev/mcpEnable the connector in a new conversation, then try:
Use the Commerce Operations Recovery connector.
First call get_demo_guide. Then investigate ORD-DEMO-1043 and explain whether
it is eligible for recovery.
Do not apply any recovery until I explicitly approve it.MCP Inspector
Launch MCP Inspector:
npx @modelcontextprotocol/inspectorSelect Streamable HTTP, enter the deployed /mcp URL above, connect, and
select List Tools. Start with get_demo_guide, especially if another
reviewer may already have changed the public demo state.
The service uses synthetic commerce data and does not contact real payment or fulfillment providers. Public demo state is mutable, so a successfully recovered order may later appear as already recovered.
Related MCP server: CommerceOps MCP Server
Tech stack
TypeScript
Cloudflare Workers
Hono
Cloudflare Agents SDK for MCP
Model Context Protocol
PostgreSQL
Drizzle ORM
Cloudflare Hyperdrive
Zod
Vitest
The application runs on Cloudflare Workers. Hono handles /health,
/health/database, and /mcp, while Cloudflare's createMcpHandler exposes
the MCP server through Streamable HTTP.
Node.js and pnpm are used for local scripts, tests, database migrations, and development tooling. The application itself is not hosted as a traditional Node.js server.
MCP tools
get_demo_guide— shows the workflow, database availability, repository link, and mutable demo orders.investigate_order— checks current order, payment, webhook, inventory, reservation, and fulfillment state without making changes.prepare_recovery_plan— creates or reuses an expiring record containing the exact proposed changes.apply_recovery— applies an explicitly approved plan atomically and idempotently.
Setup
Install dependencies:
pnpm installCopy the local environment template:
cp .env.example .envSet a direct PostgreSQL connection string in
CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE. The example uses
sslmode=verify-full so TLS certificate and hostname verification remain
explicit across upcoming pg releases.
PROJECT_REPOSITORY_URL is optional. Configure it as a normal public Worker
variable to expose the repository link through get_demo_guide; the guide
returns null when it is absent.
Run database migrations and verify the schema:
pnpm db:migrate
pnpm db:verifySeed the scenarios on a database where they do not already exist:
pnpm db:seeddb:seed is intentionally non-destructive. It creates the complete scenario
set, makes no change when all four orders already exist, and reports a clear
conflict when only part of the set exists.
If the scenarios were changed during testing, deliberately restore them with:
pnpm db:reset-demoThe reset runs in one transaction and removes only the known synthetic demo orders and their related plans, idempotency records, audit events, reservations, webhook evidence, payments, fulfillment rows, items, and dedicated inventory. It does not reset unrelated data.
Start the Worker locally:
pnpm devThe local MCP endpoint is normally:
http://localhost:8787/mcpUse the URL printed by Wrangler if it is different.
Demo orders
Order | Scenario | Purpose |
| Already recovered | Verify safe no-op detection |
| Primary eligible recovery | Full investigate → prepare → apply flow |
| Backup eligible recovery | A second successful test opportunity |
| Insufficient inventory | Verify rejection without mutation |
Demo orders are mutable. Start with get_demo_guide or call
investigate_order before preparing a plan because a successful application
changes an eligible order's state.
Recovery flow
investigate_order
→ prepare_recovery_plan
→ explicit approval
→ apply_recoveryThe read-only guide is optional and helps reviewers discover the workflow:
get_demo_guide
→ investigate_order
→ prepare_recovery_plan
→ apply_recoverySafety
The complete allowed/forbidden mutation contract is documented in Order Recovery Boundary.
Before making changes, the server:
Validates approval and the idempotency request.
Checks for a completed idempotent request.
Locks the recovery plan.
Locks and reloads the latest commerce state.
Checks plan status, expiry, and order version.
Re-runs recovery eligibility.
Confirms that current changes exactly match the approved plan.
Applies every permitted change in one PostgreSQL transaction.
A successful recovery may:
Mark the local payment as paid.
Create the exact approved inventory reservations.
Increase reserved inventory.
Move the order and fulfillment forward.
Increment the order version.
Mark the plan as applied.
Record audit and idempotency evidence.
It does not:
Retry, capture, refund, or void the processor payment.
Change physical on-hand inventory.
Change order-item quantities.
Modify packed or dispatched fulfillment.
Contact a real payment processor or fulfillment provider.
Execute arbitrary SQL or arbitrary status changes.
Idempotency
An approved apply request requires a caller-provided idempotency key.
Same key and same request → return the original result without repeating mutations.
Same key used for different request data →
IDEMPOTENCY_KEY_CONFLICT.Different key used against an applied plan →
PLAN_ALREADY_APPLIED.
Reuse a key only when retrying the same application request.
Health and database connectivity
The Worker exposes:
GET /healthfor service health.GET /health/databasefor a fixed PostgreSQL connectivity check./mcpfor Streamable HTTP MCP clients.
Verify the local database path with:
curl http://localhost:8787/health/databaseThe connectivity endpoint runs only a fixed SELECT 1; it never accepts SQL
from the request. get_demo_guide reports the same availability concept but
still loads safely when PostgreSQL is unavailable.
Local development uses the direct connection string to emulate the
HYPERDRIVE binding. To test the hosted Hyperdrive configuration without a
deployment, use:
pnpm dev:remoteRemote development uses the hosted database, so treat it like a production-data connection.
Database schema
src/db/schema.ts is the source of truth. Generated PostgreSQL migrations and
Drizzle metadata are committed under migrations/.
With the direct connection configured in .env:
pnpm db:generate
pnpm db:migrate
pnpm db:verifydb:verify checks the public table and constraint catalog. Worker traffic uses
the Hyperdrive binding, while local migration and seed scripts use the direct
PostgreSQL connection.
MCP Inspector
With the Worker running, list the registered tools from another terminal:
pnpm dlx @modelcontextprotocol/inspector@latest \
--cli http://localhost:8787/mcp \
--transport http \
--method tools/listSuggested demonstration sequence:
Call
get_demo_guide.Investigate
ORD-DEMO-1043.Prepare its recovery plan.
Call
apply_recoverywithapproved: falseand confirm no mutation.Apply with
approved: trueand a new idempotency key.Repeat with the same key and verify
idempotentReplay: true.Use
ORD-DEMO-1044for a second clean recovery demonstration.
Validation
pnpm test
pnpm typecheck
pnpm lint
pnpm db:verifyScope
The project uses synthetic commerce data and does not communicate with a real payment processor or fulfillment provider.
Approval is represented by approved: true in the MCP call. Operator identity
is not independently authenticated within this assignment.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceMCP server for commerce-operations self-service. Lets an AI agent look up order details and search orders without needing developer or SQL access.12MIT
- FlicenseNot gradedqualityBmaintenanceCommerceOps MCP Server is an AI-native Model Context Protocol server for e-commerce operations, enabling AI agents to autonomously diagnose and resolve operational exceptions such as stuck orders, missed payment webhooks, warehouse delays, and oversold inventory, with built-in safety guardrails and audit logging.
- FlicenseNot gradedqualityBmaintenanceMCP server for investigating payment/webhook drift, classifying order status mismatches, detecting duplicate charges, and escalating findings for human review. It is read-only for payment state and does not automatically retry or correct transactions.
- FlicenseNot gradedqualityBmaintenanceAn MCP server that enables non-technical operations users to resolve common commerce-ops tickets, such as orders charged but failed, through an investigate, recommend, approve, and execute workflow with read-only and write tools.
Related MCP Connectors
A paid remote MCP for hosted MCP server, built to return verdicts, receipts, usage logs, and audit-r
Remote MCP for A2A failure replay MCP, structured receipts, audit logs, and reviewer-ready evidence.
Remote MCP for Universal Cart merchant readiness MCP, structured receipts, audit logs, and reviewer-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/althaf-ka/commerce-ops-recovery-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server