mcp-commerce-evals
mcp-commerce-evals
Evals for AI shopping assistants over MCP, with a reference store to run them against.
An assistant that shops for a buyer does two things that can go wrong: it finds the wrong part, or it finds the right part and then reasons badly about it. This repo measures both, against any store that speaks MCP (Model Context Protocol) over HTTP. It ships a small store of its own so that you have something to point the evals at, and so that the numbers below can be reproduced in a minute without an account or a key.
Everything is invented: the catalog is 500 generated bicycle parts from 14 fictional brands, and checkout links go to a domain that does not exist.
What is in the repo
Crate | Kind | Purpose |
| binary + library | Reads a queries file, scores a store's search tool, optionally lets a model shop and scores its answer. |
| binary + library | MCP server over Streamable HTTP or stdio with four shopping tools. |
| library | Seeded generator of the parts, and the search engine behind the store: BM25 with typo tolerance, synonyms and filters. |
Rust 1.99.0 (pinned in rust-toolchain.toml), no unsafe code, no unwrap() outside tests. The
store and the catalog set publish = false; the eval CLI is the thing you would install.
Related MCP server: genpark-agentic-commerce-intent-cart-checkout-skill
Quickstart
cargo run --release -p reference-store # listens on 127.0.0.1:8787
curl http://127.0.0.1:8787/health # {"status":"ok"}Connect an assistant that runs on your machine, for example Claude Code:
claude mcp add --transport http shop http://127.0.0.1:8787/mcpA client that starts its servers itself can run the store over stdio instead (--stdio, see
docs/store.md):
cargo build --release -p reference-store
claude mcp add shop -- "$PWD/target/release/reference-store" --stdioThen ask it for "a chain for my 11-speed road bike, under $30" and watch it call
search_products, check_availability and create_cart.
Run the evals against the store from the repo root (no key needed):
cargo run --release -p mcp-commerce-evals -- --url http://127.0.0.1:8787/mcpIt prints a Markdown table and writes eval-results.json (change it with --out). The 44 queries
are compiled into the binary, so the same command works from any directory, with a downloaded
release binary too; --queries <path> uses a file of your own.
To evaluate a store of your own without cloning the repo, install the eval CLI from crates.io:
cargo install mcp-commerce-evals
mcp-commerce-evals --url https://your-store.example/mcpConnecting a hosted assistant
Hosted assistants call your server from their cloud, so the URL must be public HTTPS. Expose the
store through a tunnel or a host you control and tell it which hostname to accept, because it
rejects unknown Host headers (DNS rebinding protection):
reference-store --allowed-host shop.example.org --trust-forwarded-forUse --trust-forwarded-for only behind a proxy that sets X-Forwarded-For. In Claude, add a
custom connector with https://shop.example.org/mcp; ChatGPT needs Developer mode and accepts
remote HTTPS servers only. The proxy rules, the Origin check and the menu paths are in
docs/store.md.
The store's tools
The server is stateless and answers with JSON, so any client can call tools/list and
tools/call without a session. Every tool has an input schema, an output schema, structured
content, and a JSON text block with the same data for clients that read only text.
Tool | Arguments | What it does |
|
| Ranked search. Tolerates typos and synonyms, matches part numbers. Returns stock status, not quantity. |
|
| Full detail: attributes, compatibility, units on the shelf, restock days. |
|
| Per part: available, partial, backorder, unavailable or unknown_part. A part sent on several lines is added up first, as |
|
| Returns a fake |
Money is sent in dollars and in whole cents; the cents are authoritative. Errors come back as
tool errors (isError: true) with a message that says how to recover. The store sheds load: 120
requests per client per minute (429), 256 requests in flight (503), a 30-second deadline (504), and
inputs are length-checked. Every limit and flag is in docs/store.md.
How the evals work
evals/queries.json holds 44 buyer queries of eight kinds (exact part number, plain description,
compatibility, typo, synonym, filter, adversarial, and no_match, for things the catalog does not
sell). The expected ids come from catalog attributes, never from running the search, and a test
re-derives them.
Tool-level (default, no key): calls the search tool for every query and reports hit@1, hit@5, MRR, capped recall@10, nDCG@10 and latency, with Wilson and seeded bootstrap 95% intervals.
Assistant-level (
--assistant anthropic, costs tokens): lets a model shop through the store's tools and scores the part id it commits to on anANSWER:line.--trials Ngives pass@k.Gates and exit codes:
--min-hit5,--min-mrrand--min-accuracyturn a score into exit status 3; 1 means the run could not complete and 2 that a query errored.mcp-commerce-evals render <results.json>prints the tables for a saved report with no network call.
The flags, metrics, report format and MCP client behaviour are in docs/evals.md.
Results
Measured on 2026-11-03 against this store: the tables, the queries that missed and the caveats are in docs/results.md.
Development
cargo fmt --all --check
cargo clippy --locked --workspace --all-targets -- -D warnings # includes clippy::pedantic
cargo test --locked --workspace
RUSTDOCFLAGS='-D warnings' cargo doc --locked --workspace --no-deps
cargo deny --offline check licenses bans sourcesCargo.lock is committed; dependencies are taken after a 14-day cooldown, with an exception for
security fixes. The tests need no network and no key. See docs/development.md.
Threat model
The store is a demo meant to be exposed behind a proxy for a hosted assistant. It defends against:
a spoofed
X-Forwarded-For: only the entry the trusted proxy appended is read, never the client-written ones on its left;oversized bodies (64 KiB), long or numerous inputs, and requests that run too long (504);
slow clients: a client that has not finished the request line and headers within 10 seconds (
--header-read-timeout-secs) has its connection closed, and so does an idle kept-alive connection that sends no next request in that time;connection floods: at most 1024 connections open at once (
--max-connections); a connection over the cap is closed without an answer, never queued. The cap is global, not per IP, and the OS file-descriptor limit (ulimit -n) may need raising to reach it;request floods: a cap on requests in flight (503) and a per-client rate limit;
cross-origin browser calls and DNS rebinding:
HostandOriginare checked, case-insensitively;exhaustion of the client table: it is bounded, with a shared overflow bucket.
It does not provide: authentication or authorisation (every tool is public and read-only apart from the fake cart); rate limits shared across instances (the limiter is in memory and per process, so N instances allow N times the budget); or protection from a distributed or network-layer denial of service, which belongs to the proxy or the network in front.
Limitations
The catalog is synthetic. Descriptions are templated, so a real catalog's mess (inconsistent titles, missing attributes, duplicates) is not represented. Some attributes are generated independently where real parts tie them together: a cassette's tooth range does not depend on its speed.
The search is a reference implementation, not a claim about how any real store should rank.
There is no
/.well-known/ucpprofile. The Universal Commerce Protocol (ucp.dev) describes MCP stores with its own tool names (search_catalog,lookup_catalog,get_product) and an OpenRPC schema in the profile. This store uses different tool names, so publishing a profile for it would tell UCP platforms something untrue. Implementing the UCP catalog binding is a separate piece of work; I read the overview page of the spec, not its transport section.create_cartdoes not take payment, addresses or buyer details. By design the human pays.One run, one machine, one seed.
The store was exercised with a real MCP client (Claude Code) on a local address only; I did not test a connection from the hosted assistants, which need a public hostname this repo does not provide.
The Messages API's acceptance of the
$schemafield in the store's input schemas is unchecked.
License
MIT, see LICENSE.
Available Tools
4 toolscheck_availabilityARead-only
Check whether specific quantities can ship now. Send one to twenty {id, quantity} items. For each item the answer is available (all on the shelf), partial (fewer on the shelf than requested), backorder (ships after restock_days), unavailable (out of stock, no date) or unknown_part. A part sent on several lines is added up first, as create_cart does. Call this before create_cart and tell the buyer about any item that is not available. Changes nothing.
Inputs: items (required). Returns: items
create_cartAIdempotent
Create a cart and get a checkout link for the buyer. Use it only after the buyer has chosen the parts and quantities. Takes one to twenty {id, quantity} items and returns checkout_url, lines and the subtotal; amounts come in dollars and, authoritatively, in cents. The buyer opens checkout_url, reviews the cart and pays there: you never pay and cannot. Refuses unknown parts, out-of-stock parts and quantities above the shelf (a part sent on several lines counts once, with the lines added up); backordered parts are accepted and flagged.
Inputs: items (required). Returns: note, lines, cart_id, currency, +3 more
get_productARead-only
Get everything the store knows about one part: description, technical attributes (speed, wheel size, brake type, axle standard and so on), compatibility list, price, stock status, units on the shelf and restock days. Use it to compare two or three candidates from search_products or to confirm that a part fits the buyer's bike before recommending it.
Inputs: id (required). Returns: id, fits, brand, stock, +8 more
search_productsARead-only
Find bicycle parts. Use this first, whenever the buyer names a part, a part number, a need or a bike. Takes free text (typos, synonyms and part numbers work) plus optional filters: brand, category, fits (such as 11-speed, road, disc-brake, 29in), in_stock_only and max_price_usd. Returns up to limit ranked results with id, title, brand, price, stock status and what each part fits. Search results show stock status but not quantities; call check_availability before promising a quantity. Queries are limited to 200 characters and 20 words; limit is 1 to 25, default 5.
Inputs: fits, brand, limit, query, +3 more. Returns: results, suggestion, total_matches
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool maps to a distinct step in the purchase funnel: discovery (search_products), inspection (get_product), stock verification (check_availability), and purchase handoff (create_cart). Descriptions explicitly state ordering (search first, then availability, then cart), eliminating overlap.
All four names follow a consistent verb_noun snake_case pattern (search_products, get_product, check_availability, create_cart). Verb choices match the action semantics precisely with no stylistic drift.
Four tools is lean but each is essential to the search→inspect→verify→checkout workflow. Nothing is redundant and no plausible operation is obviously missing from the core loop.
The happy-path lifecycle is fully covered, including a deliberate refusal to handle payment (checkout_url handoff). Minor gaps remain: no way to modify or retrieve an existing cart, and no order status/lookup after checkout.
Maintenance
Related MCP Connectors
Hosted MCP for e-commerce: live product catalog, stock, and pricing for AI agents.
Universal Commerce Protocol (UCP 2026-08-25) MCP storefront for AI shopping agents and @shopify/ucp-cli: catalog search, batch lookup, product detail pages, stateful carts, Stripe & USDC checkouts, and order tracking.
Sample shop MCP server: paginated search, idempotent orders, guarded cancellation. Four languages.
Shopping infrastructure for AI agents: product search, category price overviews, price checks and seller vetting across US online retail, as structured facts over MCP.
Related MCP Servers
- FlicenseAqualityDmaintenanceAn MCP server that enables natural language catalog search, cart management, and checkout workflows against the Fake Store API, with strict schemas and session-persistent carts.8-
- AlicenseNot gradedqualityNot gradedmaintenanceEnables agents to translate consumer shopping intent into aggregated item discovery, cross-merchant cart consolidation, and structured transaction checkout payloads across multiple merchants. It runs as a zero-dependency Python MCP server or importable module compatible with Claude Desktop, Cursor, and other work agent frameworks.MIT
- 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
- AlicenseNot gradedqualityBmaintenanceTurns an online store's catalog into MCP tools so agents can search products, fetch details, look up barcodes, analogs, categories, promotions and pickup points, and hand off a cart as a payment link rather than checking out. It is driven by a single TOML config with capability-based tool sets, bilingual model-facing texts, public catalog access plus OAuth 2.1-scoped personal tools like order history, and ready adapters for YML/Google Merchant feeds and WooCommerce across ten store engine presets.Apache 2.0