Stalled Fulfillment Recovery MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Stalled Fulfillment Recovery — MCP Server
An MCP server that lets ops (via an AI assistant) diagnose and recover orders stuck in "processing" due to missing or failed fulfillment tasks.
Safety by construction: the only write tools are retry_fulfillment (resets a fulfillment task) and escalate_order (writes an audit entry). There are no payment mutation tools — the domain boundary is the safety boundary.
Product Decisions & Assumptions
Problem: Operations teams can't independently diagnose or fix stalled fulfillment issues — they lack cross-system visibility and safe write access, so even routine cases get escalated to engineers.
Scope: Single-order investigation of stalled fulfillment. We handle three known stall patterns (no fulfillment task, failed task, silently stalled task). Genuinely novel or ambiguous failures escalate to humans via escalate_order.
Assumptions:
User interacts via an MCP-connected AI client (e.g. Claude Desktop) — no custom frontend
Writes are simulated (no real warehouse/carrier API) but safety boundaries (dry-run, rate-limit, escalation) are real
Single-order investigation, not batch operations
Exclusions: Authentication, multi-tenant access control, payment mutations, real carrier integrations, batch operations, frontend.
Related MCP server: ops-mcp
Database Setup (PostgreSQL)
This server uses PostgreSQL for persistent data storage. Tables are auto-created on startup.
# Environment Variable (optional, defaults to postgres://localhost:5432/fulfillment_mcp)
export DATABASE_URL="postgres://username:password@localhost:5432/fulfillment_mcp"Quick Start
npm install
npm run build && npm start # production on :3000
# or
npm run dev # dev server on :3000Health check:
curl http://localhost:3000/healthMCP Inspector:
npx @modelcontextprotocol/inspector --url http://localhost:3000/mcpMCP Capabilities
Tools
Tool | Type | Description |
| Read | Fetches an order + its fulfillment task in one call |
| Read | Fetches a fulfillment task by ID with full failure detail |
| Read | Surfaces all orders stuck in processing (3 stall types) via optimized SQL JOIN |
| Write | Resets a stalled fulfillment to |
| Write (audit only) | Flags an order for human review without mutating state |
| Read | Returns the full action history for an order |
Resources
Resource URI | Description |
| Direct JSON access to an order and its fulfillment task |
| Direct JSON access to a fulfillment task by order ID |
Prompts
Prompt | Description |
| Guided workflow that instructs the AI to discover stalled orders, inspect each, decide retry vs escalate, and summarize actions. Accepts optional |
Stall Detection
list_stalled_orders detects three types of stall for any paid/processing order older than threshold_hours (default: 24h), using a single optimized SQL LEFT JOIN query:
| Condition |
| No FulfillmentTask row was ever created |
| FulfillmentTask.status === |
| Task is |
Example Workflow
Ops: "Show me all stuck orders"
AI: → list_stalled_orders(threshold_hours: 24)
← 3 stalled orders found
AI: → get_order("ORD-1042")
← Order: processing, Fulfillment: failed (warehouse_api_timeout, 2 attempts)
AI: → retry_fulfillment("ORD-1042", confirm=false)
← dry_run: will reset FUL-1042 to pending (attempt 3)
Ops: "Looks good, go ahead."
AI: → retry_fulfillment("ORD-1042", confirm=true)
← success: fulfillment reset, audit entry created
AI: → get_audit_log("ORD-1042")
← [fulfillment_retry @ 2026-08-01T04:15:00Z]Safety Details
Dry-run required:
retry_fulfillmentreturns a preview whenconfirm=falsewithout mutating anything. Show this to the operator before confirming.Rate-limit: A second retry on the same order within 10 minutes is rejected with
double_retry_prevented. This is a rate-limit (time window), not true idempotency — a second retry after the cooldown is permitted, because the first may itself have failed.Escalation path: When an order doesn't match the standard stall pattern, use
escalate_orderto write a permanent audit entry recording why the AI declined to act automatically.No payment tools: There is no refund or payment write tool in this MCP. The scope boundary enforces the safety boundary.
Development & Testing
npm run build # TypeScript compile
npm run test # Vitest safety tests against live PostgreSQL
npm run test:watch # Watch modeTests run against live PostgreSQL and create their own data at runtime — no hardcoded fixtures or seed data dependencies.
Live Hosted Deployment
The MCP server is live and hosted on Render:
Base URL:
https://mcp-ecom.onrender.comMCP Endpoint:
https://mcp-ecom.onrender.com/mcpHealth Check:
https://mcp-ecom.onrender.com/health
Connecting in Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"stalled-fulfillment-recovery": {
"url": "https://mcp-ecom.onrender.com/mcp"
}
}
}Deployment
The server listens on process.env.PORT (default: 3000). Deploy anywhere that runs Node.js and has PostgreSQL access:
Railway / Render / Fly.io / Heroku: push the repo, set
DATABASE_URLandPORTDocker:
node dist/index.jsThe MCP endpoint is
POST /mcp(stateless HTTP, no sessions)
After deploying:
curl https://mcp-ecom.onrender.com/health
npx @modelcontextprotocol/inspector --url https://mcp-ecom.onrender.com/mcpTech Stack
Database: PostgreSQL (
pgdriver)MCP SDK:
@modelcontextprotocol/sdk^1.12 (stable)Transport:
StreamableHTTPServerTransport(stateless, HTTP)Framework: Express 5
Validation: Zod 3
Tests: Vitest — focused safety verification against live PostgreSQL
Language: TypeScript (ESM, strict)
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for mandates, delegation, policy-gated execution, credential grants, and audit.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Read-only MCP server for AIStatusDashboard status, incidents, metrics, and fallback recommendations.
Remote MCP for A2A failure replay MCP, structured receipts, audit logs, and reviewer-ready evidence.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA production-grade MCP server for order management, featuring tools for looking up and refunding orders with safety measures like confirmation tokens, rate limiting, and error handling.-
- FlicenseNot gradedqualityCmaintenanceAn 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.-
- FlicenseNot gradedqualityDmaintenanceAn MCP server for e-commerce operations that enables AI agents to investigate stuck orders, surface fulfillment anomalies, and create escalation records via natural language queries.-
- FlicenseNot gradedqualityCmaintenanceMCP server that helps commerce operations investigate and safely recover orders left inconsistent after captured-payment webhook failures, with atomic recovery actions and audit history.-