Ops Lense
Deploys the Ops Lense MCP server to Heroku, providing a hosted endpoint for commerce operations investigation and remediation.
Uses PostgreSQL (specifically Neon) as the database backend for storing synthetic commerce data including orders, payments, inventory, and fulfillment records.
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., "@Ops LenseWhy is order ORD-1001 stuck?"
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.
Ops Lense
Ops Lense is a remotely hosted Model Context Protocol (MCP) server for commerce operations. It helps an operations specialist investigate stuck orders, understand what went wrong, and take the next safe action without needing an engineer for every incident.
This assignment intentionally focuses on one workflow in depth: stuck-order investigation and remediation across orders, payments, inventory, and fulfillment.
What it demonstrates
An operator can ask an MCP-enabled AI client questions such as:
Why is this paid order still stuck?
The AI can use Ops Lense to:
find the order;
inspect its operational timeline;
diagnose the likely failure from backend data;
determine how safely the proposed action can be performed;
preview and execute a bounded remediation after operator confirmation; or
send a high-risk action to a manual-review queue instead of executing it.
The MCP is therefore the core product interface, not an additional integration around a separate application.
Safety model
Not every commerce operation should have the same level of AI autonomy. Ops Lense separates actions into three categories.
Category | Behavior | Examples |
Instant | Read-only investigation can run immediately | Search orders, view timeline, diagnose an order, view statistics |
Confirmation required | MCP previews the change first and executes only after explicit operator approval | Resync a missing inventory reservation |
Manual review only | MCP cannot execute the action; it creates a pending review request | Refund payment, cancel a shipped order, override fulfillment, adjust inventory |
Confirmation flow
resync_inventory_reservation is a guarded write operation.
First call:
confirmed=falseThe server validates the order and returns the proposed effect without changing the database.
After the operator explicitly approves the action, the client may call:
confirmed=trueThe server then performs the bounded mutation and records an audit entry.
Manual-review flow
Critical actions are intentionally unavailable as direct MCP mutations. request_manual_review creates a pending_review audit entry instead.
The separate process where another operator reviews, approves, and executes those requests is deliberately outside the assignment scope. Pending requests remain visible through list_manual_reviews.
MCP tools
Tool | Safety | Purpose |
| Instant | Find recent orders, optionally filtered by status |
| Instant | View the chronological operational history of an order |
| Instant | Detect supported stuck-order conditions from payment and operational evidence |
| Instant | View aggregate order counts and revenue by status |
| Confirmation required | Preview and repair a missing inventory reservation after explicit approval |
| Manual review | Queue a high-risk operation without executing it |
| Instant | View outstanding manual-review requests |
MCP resource
Ops Lense exposes one operational resource:
ops://action-policyIt describes the three action categories and the rules an MCP client should follow when choosing or executing tools.
I chose a resource rather than an MCP prompt because this is stable operational policy that should be available regardless of how the user phrases their request. A dedicated prompt would add little value to this deliberately narrow workflow.
Example end-to-end workflow
A representative incident is an order where payment was captured successfully but the inventory reservation step is missing.
The operator asks why an order is stuck.
The AI uses
search_ordersif it needs to locate the order.It calls
get_order_timelineto inspect what has happened.It calls
diagnose_orderto correlate the payment and operational state.The diagnosis identifies
INVENTORY_RESERVATION_MISSINGand recommendsresync_inventory_reservation.The AI calls the tool with
confirmed=falseand shows the proposed remediation to the operator.The operator approves it.
The AI calls the tool again with
confirmed=true.The MCP performs the remediation and writes an audit record.
The AI calls
get_order_timelineagain to verify the resulting state.
A high-risk request follows a different path. For example, if an operator asks for a refund, the MCP creates a manual-review request rather than modifying payment state. The request can then be inspected with list_manual_reviews.
This gives the demo one coherent story covering investigation → diagnosis → human confirmation → mutation → verification → escalation.
Architecture
MCP-enabled AI client
|
| Streamable HTTP
v
Ops Lense MCP
|
+-- Investigation tools
+-- Diagnostic logic
+-- Safety / action policy
+-- Guarded actions
|
v
Neon PostgreSQL
synthetic commerce dataTechnology:
TypeScript
Bun for local development and scripts
Node.js 24 on Heroku
Model Context Protocol server packages
Express HTTP transport
Neon PostgreSQL
Zod input validation
The synthetic data models the minimum backend systems needed for the workflow: customers, orders, payments, inventory, fulfillment, operational events, investigation history, and action audit records.
Run locally
Prerequisites
You need:
Bun
a PostgreSQL database; Neon works well for the hosted demo
1. Install dependencies
bun install2. Configure environment variables
Create a .env file in the project root:
DATABASE_URL=postgresql://YOUR_DATABASE_URL
MCP_AUTH_TOKEN=YOUR_STRONG_RANDOM_TOKEN
PORT=30003. Create the synthetic database
bun scripts/setup-db.tsThis command drops and recreates the assignment tables. Do not run it against a database containing data you need to keep.
4. Seed demo data
bun scripts/seed-db.tsAll seeded customers, orders, payments, inventory, and fulfillment records are synthetic.
5. Build and start the MCP server
bun run build
bun run startbun run build compiles TypeScript into dist/. The start command then runs the compiled server with Node, matching the Heroku runtime path.
The local MCP endpoint is:
http://localhost:3000/mcpDeploy to Heroku
The repository includes a Procfile that starts the web dyno with npm start. Heroku builds the TypeScript project and runs the compiled Node.js server.
1. Create the Heroku app
heroku create YOUR_APP_NAME2. Configure the database
Set the PostgreSQL connection string and a strong bearer token used to protect the MCP endpoint:
heroku config:set DATABASE_URL="YOUR_DATABASE_URL" MCP_AUTH_TOKEN="YOUR_STRONG_RANDOM_TOKEN" -a YOUR_APP_NAMEHeroku provides PORT automatically, so you do not need to configure it manually.
3. Deploy
git push heroku HEAD:mainDuring deployment Heroku installs the Node dependencies and runs the build script. The web dyno then starts:
node dist/index.jsThe hosted MCP endpoint will be:
https://YOUR_APP_NAME.herokuapp.com/mcpIf your Heroku app uses a custom domain, use that domain with /mcp instead.
4. Verify the deployment
heroku logs --tail -a YOUR_APP_NAMEYou should see the MCP server start and bind to Heroku's assigned port.
The synthetic database can be initialized before deployment from your local machine using the same DATABASE_URL, or by running the setup and seed scripts as one-off Heroku commands if Bun is available in that environment. For the simplest deployment path, initialize and seed Neon locally before deploying the server.
Connect from an AI client
Ops Lense uses a remote HTTP MCP endpoint. In an MCP client that supports remote/Streamable HTTP servers, add the endpoint and bearer token:
{
"serverUrl": "http://localhost:3000/mcp",
"headers": {
"Authorization": "Bearer YOUR_STRONG_RANDOM_TOKEN"
}
}For a deployed instance, replace the local URL with the hosted MCP URL and use the same token configured as MCP_AUTH_TOKEN on the server.
After connecting, the client should discover the tools and ops://action-policy resource automatically.
You can then start naturally, for example:
Show me recent orders that may need attention.Why is this order stuck? Investigate it and tell me what we can safely do.Show me all actions currently waiting for manual review.For confirmation-required operations, the AI should present the preview to the operator and obtain explicit approval before making the second tool call with confirmed=true.
Connect with MCP Inspector
MCP Inspector is useful for testing the server independently of a chat client.
With the local server running:
npx @modelcontextprotocol/inspectorIn Inspector, connect to:
http://localhost:3000/mcpYou can then inspect the discovered tools/resource and invoke the workflow manually.
Verification
Type-check the project with:
npm run typecheckRun the focused Vitest integration suite against the configured synthetic database:
npm testThe tests in tests/operations.test.ts create isolated temporary records, exercise the real tool functions against PostgreSQL, and remove those records afterward. They verify:
captured payment with a missing reservation produces
INVENTORY_RESERVATION_MISSING;terminal orders are not diagnosed as active inventory failures;
confirmed=falseperforms no mutation;confirmed=trueperforms the bounded inventory remediation and records an audit entry;repeating an already completed resync is a safe no-op;
a refund request is queued for review without changing payment state;
duplicate pending review requests are suppressed.
The suite currently contains 8 integration tests. A successful run reports 8 passed.
These tests are intentionally focused on the workflow and safety boundaries rather than broad coverage metrics.
Key product decisions
Keep the workflow narrow
The assignment does not attempt to build a complete commerce backend. Stuck-order operations were selected because they provide a compact workflow involving multiple systems, diagnosis, remediation, safety, and verification.
Give AI useful autonomy, not unrestricted write access
Making every operation read-only would leave the operator dependent on another system to resolve even simple incidents. Allowing every mutation would create unnecessary operational risk.
The three-tier model provides a middle ground: investigation is automatic, bounded remediation requires operator confirmation, and consequential actions remain behind manual review.
Keep critical actions out of MCP execution
Refunds and similar operations could technically be represented as database mutations in this synthetic project, but doing so would demonstrate the wrong production behavior. The MCP instead creates a review request and makes the boundary explicit.
Keep the MCP surface small
Each exposed tool has a clear role in the chosen workflow. The goal is for an AI client to select tools reliably, not to maximize the number of available tools.
Scope and assumptions
Included:
synthetic commerce data
order investigation
deterministic diagnosis of the supported stuck-order condition
guarded inventory remediation
audit logging
manual-review queue
remotely accessible MCP interface
Intentionally excluded:
frontend/admin dashboard
real customer data
production payment or warehouse credentials
user accounts, sessions, OAuth, and role-based access control
direct refund execution
manual-review approval/execution UI
complete commerce backend
broad returns, fraud, catalog, and customer-support workflows
The hosted assignment server uses a single bearer token to avoid exposing the MCP publicly. For a production system, identity-aware authentication, authorization/RBAC, secret rotation, stronger concurrency controls, provider-specific integrations, observability, and a complete review workflow would need to be added.
Repository structure
src/
index.ts
db.ts
resources.ts
tools/
diagnose-order.ts
get-stats.ts
get-timeline.ts
list-manual-reviews.ts
request-manual-review.ts
resync-inventory.ts
search-orders.ts
scripts/
setup-db.ts
seed-db.ts
tests/
operations.test.ts
vitest.config.tsAI worklog
This section should contain the actual AI usage from the assignment before submission:
AI coding tools and exact models used
why each model was chosen for its task
how the work was planned and decomposed
responsibilities handled by AI versus the developer
important prompts/context supplied to AI
at least one AI suggestion that was rejected or substantially changed
how AI-generated work was reviewed and verified
remaining risks or unfinished work
One product decision that changed during development was the treatment of consequential operations. Rather than exposing refunds and similar critical actions as executable MCP tools, they were moved behind a manual-review queue. This preserves useful AI autonomy while keeping financially or operationally consequential decisions outside direct model execution.
Submission
The final submission should include:
hosted MCP URL
source repository URL
this README
verification/tests for the important workflow behavior
completed AI worklog
4–5 minute asynchronous demo
The demo should prioritize the actual product workflow over code walkthroughs: investigate an order, diagnose it, preview a safe remediation, confirm it, verify the result, then show how a critical action is routed to manual review.
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 Connectors
Policy review and purchase discovery for AI-agent commerce actions.
Debug, build, and manage Power Automate cloud flows with AI agents
AI agent run monitoring with incident replay and SLA receipts.
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/qubydev/ops-lense-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server