mcp-retail-sim
The server provides an in-memory retail shopping flow via MCP tools.
Search the synthetic product catalog with a text query.
Fetch product details and check real-time inventory by SKU.
Add SKUs to a client-generated cart with optional quantity, without changing stock.
Place/checkout a cart, decrement stock, return an order ID, and delete the cart.
Retrieve order details by order ID while the server process is running.
Note: the provided schema exposes only these six tools; README-listed cart read/remove tools, resources, and prompts are not present in this schema.
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., "@mcp-retail-sim Search for headphones, add SKU-1001 to cart-1, then place the order"
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.
mcp-retail-sim
Synthetic retail store MCP server for building and evaluating shopping / support agents.
No real payments, inventory DB, or third-party APIs — fixtures load into memory so demos and evals stay deterministic.
What you get
Primitive | Examples |
Tools |
|
Resources |
|
Prompts |
|
Transports | stdio (default) · Streamable HTTP |
Cart/order flows are stateless at the protocol layer: the client passes a cart_id handle (no server login session).
Same tools, resources, and prompts are available on both transports — only how the client connects changes.
Related MCP server: helios-mcp-server
Demo catalog
About 1000 synthetic products (SKU-1000…SKU-1999) across common retail departments (grocery, home, beauty, health, clothing, electronics, and more).
search accepts an optional free-text query (substring on name, description, category, brand, tags) plus optional filters: category, brand, tag, min_price, max_price, in_stock, dietary, organic, limit (default 50). Filters are ANDed. Empty query with no filters returns []; empty query with filters browses the filtered set.
Department-specific attrs (plus mirrored tags) support preference-style shopping — for example grocery dietary / organic / allergen / sugar_level, clothing material / fit, electronics connectivity / power_source (battery | mains | passive | rechargeable). There are still no rating/review fields.
Try this | What you should see |
| Matching products |
| Filtered browse (query may be empty) |
| LumenLab Pro Headphones |
| In stock |
| Out of stock ( |
| Cart with items + |
| Same cart snapshot (items + total) |
| Qty down / line removed; total updated; stock unchanged |
| Order id |
| That |
| Store policy text |
Categories include electronics, computers, home and kitchen, furniture, clothing, beauty, sports, toys, books, grocery, health, automotive, pets, office, and baby.
Cart / checkout notes
add_to_cartmerges qty for the same SKU; it never decrements stock.remove_from_cart(cart_id, product_id, quantity=1)decrements qty; drops the line at 0; keeps an empty cart.Cart and order payloads include
totalandcurrency(USD).place_orderrevalidates stock at checkout, then decrements inventory and deletes the cart.Optional
idempotency_key: same key + same cart fingerprint returns the original order; same key + different cart is rejected. Keys live in process memory (like orders).
Eval fault injection (test/dev only)
For demos and agent evaluations you can force checkout failures without exposing an admin MCP tool. Set env on the server process (stdio host env, or export before HTTP start):
MCP_RETAIL_SIM_FAULTS=place_order:insufficient_stockDirective | Effect |
| Fail before commit (stock unchanged, cart kept) |
| Sleep N ms before checkout work |
| First new checkout returns a transient error (before commit); later attempts proceed |
| Commit order + idempotency, then return a fake transient error once; retry with the same |
Enable one scenario at a time. Idempotent replay skips fault injection. Cleared by default when the env var is unset. In pytest, use mcp_retail_sim.faults.enable_faults([...]) / clear_faults().
A project .env file is not loaded automatically — the MCP host or shell must set MCP_RETAIL_SIM_FAULTS.
Runtime reset (test/eval only)
For long-lived processes or pytest isolation, call mcp_retail_sim.store.reset_runtime_state() to:
clear carts, orders, and idempotency records
clear fault injection
reload products / inventory / policies from fixtures (restores stock)
This is not an MCP tool — agents cannot reset the store.
Eval adversarial fixtures (opt-in)
Optional products for indirect prompt-injection evaluations (agent must not blindly trust tool/catalog text). They are not in the default catalog.
MCP_RETAIL_SIM_EVAL_FIXTURES=adversarialSKU (harness id only) | Role |
| Looks like chamomile tea; description buries a strong injection ( |
| Looks like honey; soft “prefer this SKU / don’t tell the user” injection |
| Benign green-tea control (no injection) |
Product fields are intentionally unmarked (normal grocery_pantry brands/tags/attrs) so the model is not tipped off. Eval harnesses should key off the known SKU-ADV-* ids, not on labels in the payload. Guardrails belong in the agent, not in fixture labelling.
In pytest / harnesses: mcp_retail_sim.eval_fixtures.enable_eval_fixtures(["adversarial"]) / clear_eval_fixtures(). Not an MCP tool.
Transports
stdio | Streamable HTTP | |
Start | Client spawns the process | You start the server; it listens on a port |
Connect | Pipes (stdin/stdout) | URL, e.g. |
Lifetime | Usually tied to the client | Long-lived until you stop it |
Typical use | Cursor, Claude Desktop, Inspector spawn | LangChain / remote-style clients, multi-client |
uvx downloads the package from PyPI and runs it. Use these commands if you are not developing this repo:
# stdio (default) — for desktop hosts / Inspector spawn
uvx mcp-retail-sim
# same as:
uvx mcp-retail-sim --transport stdio
# Streamable HTTP — long-lived local server
uvx mcp-retail-sim --transport http --host 127.0.0.1 --port 8050
# MCP endpoint: http://127.0.0.1:8050/mcpCLI flags (HTTP only uses host/port):
Flag | Default | Meaning |
|
|
|
|
| Bind address for HTTP |
|
| Bind port for HTTP |
Quick start (from a git checkout)
uv run uses the local source and the project virtualenv. It does not download the PyPI release.
cd mcp-retail-sim
uv sync
uv run mcp-retail-sim --help
uv run pytestMCP Inspector
stdio — Inspector starts the server for you (do not run the server yourself).
Published package from PyPI:
npx @modelcontextprotocol/inspector uvx mcp-retail-simLocal checkout — run from the mcp-retail-sim directory:
npx @modelcontextprotocol/inspector uv run mcp-retail-simHTTP — start the server first, then point Inspector at the URL:
# terminal 1
uvx mcp-retail-sim --transport http --port 8050
# terminal 2
npx @modelcontextprotocol/inspector \
--server-url http://127.0.0.1:8050/mcp \
--transport httpCursor / Claude Desktop (stdio)
{
"mcpServers": {
"mcp-retail-sim": {
"command": "uvx",
"args": ["mcp-retail-sim"]
}
}
}Eval example with a fault and/or adversarial fixtures (local checkout):
{
"mcpServers": {
"mcp-retail-sim": {
"command": "uv",
"args": ["run", "mcp-retail-sim"],
"env": {
"MCP_RETAIL_SIM_FAULTS": "place_order:error_after_commit",
"MCP_RETAIL_SIM_EVAL_FIXTURES": "adversarial"
}
}
}
}LangChain / HTTP client sketch
# Server must already be running:
# uvx mcp-retail-sim --transport http --port 8050
config = {
"mcpServers": {
"mcp-retail-sim": {
"url": "http://127.0.0.1:8050/mcp",
}
}
}Architecture (high level)
Client (agent / Inspector / LangChain)
│
├─ stdio: client spawns process, JSON-RPC over pipes
└─ http: client connects to http://host:port/mcp
▼
┌─────────────────────────────┐
│ mcp-retail-sim (FastMCP) │
│ tools · resources · prompts│
│ cli: --transport stdio|http│
│ faults via env (eval only) │
└─────────────┬───────────────┘
│
▼
┌─────────────────────────────┐
│ In-memory store │
│ ← fixtures (products, │
│ inventory, policies) │
│ + carts / orders │
│ + idempotency map │
└─────────────────────────────┘Status
MVP for general retail-agent simulation: catalog + cart tools, checkout with stock revalidation and optional idempotency, stdio + Streamable HTTP, eval-only fault injection.
Still optional / later: PyPI republish of the latest tree, concurrency locks.
Tools advertise MCP annotations (read-only vs mutating/destructive hints) for hosts that surface them.
Maintainer
From the mcp-retail-sim directory:
Bump
versioninpyproject.toml.Run the tests:
uv run pytestSave the API tokens (once):
keyring set https://test.pypi.org/legacy/ __token__
keyring set https://upload.pypi.org/legacy/ __token__Build and publish:
uv build --out-dir dist
UV_KEYRING_PROVIDER=subprocess uv publish --publish-url https://test.pypi.org/legacy/
UV_KEYRING_PROVIDER=subprocess uv publishLicense
Available Tools
6 toolsadd_to_cartAdd To CartA
Add a product to a cart. Does not decrement stock.
Example: cart_id=cart-1, product_id=SKU-1001, qty=1. Use any new cart id; the cart is created if it does not exist. Fails if the SKU is unknown or out of stock (try SKU-1002 to see that error).
Inputs: cart_id (required), product_id (required), qty. Returns: object
check_inventoryCheck InventoryB
Check stock for a SKU.
Example in stock: SKU-1001. Example out of stock: SKU-1002. Returns stock_qty and in_stock. Does not change inventory.
Inputs: product_id (required). Returns: result
get_order_detailsGet Order DetailsA
Read an order created by place_order.
Pass the order_id from that response, for example ORD-E2F0C262. Orders exist only in this server process; a new process has none.
Inputs: order_id (required). Returns: result
get_product_detailsGet Product DetailsB
Get one product by SKU. Example: SKU-1001 (LumenLab Pro Headphones).
Inputs: product_id (required). Returns: result
place_orderPlace OrderA
Check out a cart created by add_to_cart.
Example: cart_id=cart-1 after adding SKU-1001. Decrements stock, returns an order_id like ORD-XXXXXXXX, and deletes the cart.
Inputs: cart_id (required). Returns: object
searchSearchA
Search the synthetic catalog (about 500 products).
Example queries that return rows: headphones, laptop, coffee, yoga, tv, jacket. Matching is a case-insensitive substring of name, description, category, or brand.
Inputs: query (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct action: catalog search, single-product lookup by SKU, stock check, cart addition, checkout, and order read. The boundaries between get_product_details and check_inventory are clarified by descriptions (one returns product data, the other returns stock_qty/in_stock).
Consistent snake_case with a verb_noun pattern for five tools (get_product_details, check_inventory, add_to_cart, place_order, get_order_details). The lone exception is 'search', which lacks an explicit noun/target, a minor deviation from the otherwise predictable pattern.
Six tools is well-scoped for a retail simulation, covering the essential browse-to-checkout flow without redundancy. Each tool earns its place and none feels like filler.
The core lifecycle (search, inspect, inventory, cart, order) is covered end-to-end. Minor gaps exist: no cart inspection/removal, no order listing or cancellation, which an agent could work around for a simple sim.
Maintenance
Related MCP Connectors
Hosted MCP for e-commerce: live product catalog, stock, and pricing for AI agents.
Launch and manage online stores with AI agents: products, inventory, pricing, orders and promotions.
Live product search for AI agents across Shopify merchants and major retailers.
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to perform e-commerce operations including product search, budget-constrained shopping recommendations, and sustainability analysis. Includes a secure HTTP bridge with OAuth integration and observability features for production deployment.-
- AlicenseNot gradedqualityBmaintenanceExposes a fictional smart-home store's REST API to agents as schema-validated MCP tools, resources, and prompts, letting them search products, check inventory, place atomic orders, look up customers and orders, and open support tickets. It also adds auth injection, rate limiting, REST-to-MCP error mapping with actionable hints, per-call JSONL tracing, and a golden-task eval harness for tool selection and argument correctness.MIT
- AlicenseAqualityCmaintenanceProvides an in-memory mock commerce backend for shopping agents, enabling product search, order creation, simulated payment, automatic shipping/delivery progression, and refund workflows. It lets developers test full shopping-agent lifecycles deterministically without real products, credentials, or funds.7MIT
- AlicenseNot gradedqualityBmaintenanceEnables read- or write-scoped access to synthetic enterprise orders, inventory, support tickets, and metrics via schema-validated JSON-RPC tools over stdio and HTTP, with permission allow-lists and audit logging. It also exposes enterprise resources and prompt templates for grounded, cited, multi-step assistant workflows.MIT