Commerce MCP App
Enables product discovery, session-scoped carts, and confirmation-gated checkout through natural language, with deterministic routing and safety features.
README
Commerce MCP App
A cross-platform MCP App for product discovery, session-scoped carts, and confirmation-gated checkout.
Tool contract
search_products— the only model-facing product discovery tool. Handles browsing, natural-language queries, categories, price constraints, attributes, ranking, and pagination.list_products— app-only unfiltered catalog loader; hidden from the model to prevent routing ambiguity.add_to_cart— adds an exact product ID to the current session cart.remove_from_cart— removes an exact product ID from the current session cart.view_cart— returns the current session cart.checkout_cart— previews checkout unlessconfirmed=true; accepts an idempotency key for safe retries.
The React UI is served at ui://products/index.html. Every UI-backed tool also returns text content for hosts without MCP Apps support.
Product accuracy pipeline
search_products does not send a conversational sentence to the upstream literal search endpoint. It:
- Normalizes common product synonyms and categories.
- Extracts price bounds and ranking intent from ordinary shopping language.
- Retrieves the full catalog through the resilient API client.
- Applies deterministic constraints.
- Ranks matching candidates by title, category, description, tags, rating, or requested price order.
- Returns the normalized intent in
structuredContentfor debugging and evaluation.
This local retrieval pipeline is appropriate for the small DummyJSON catalog. For a large production catalog, replace candidate retrieval with a search index while retaining the same intent and ranking contract.
Reliability and safety
- Retry with exponential backoff for network, 429, and 5xx failures.
- Request timeout, ETag revalidation, LRU caching, and stale-cache fallback.
- Zod validation at the upstream catalog boundary.
- Optional bearer-token authentication with explicit 401 responses.
- Cart isolation by MCP transport session; stdio processes are naturally one client per process.
- Cumulative per-product quantity limits.
- Explicit confirmation and idempotent replay for checkout.
- MCP annotations describing read-only, destructive, and idempotent behavior.
The sample checkout produces a local receipt. A real deployment must replace it with transactional inventory, order, and payment services.
Commands
npm install
npm run check
npm test
npm run build
npx -y @mcpjam/inspector@latest
Paid model-routing evals are intentionally separate:
npm run eval
Configuration
PRODUCTS_API_ENDPOINT— defaults tohttps://dummyjson.com/productsPRODUCTS_API_BEARER_TOKEN— optionalPRODUCTS_API_TIMEOUT_MS— defaults to8000PRODUCTS_API_MAX_RETRIES— defaults to3PRODUCTS_API_BASE_BACKOFF_MS— defaults to300PRODUCTS_API_MAX_BACKOFF_MS— defaults to3000PRODUCTS_API_CACHE_TTL_MS— defaults to30000PRODUCTS_API_CACHE_MAX_ENTRIES— defaults to100
Evaluation strategy
npm test is deterministic and covers API resilience, response validation, query parsing, ranking, cart isolation, quantity constraints, and UI behavior. npm run eval measures model tool selection and argument extraction without a routing answer sheet. Product-result correctness is covered by deterministic golden-set tests so provider outages or exhausted credits cannot masquerade as zero product accuracy.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.