@mercatus-liber/agent-commerce
Makes a store agent-ready: any AI agent (ChatGPT, Claude, Gemini, a shopping assistant) can find
the store, browse it, answer questions about it, fill a cart and hand the person it’s helping a
checkout link. On by default. A store turns it off with agentAccess: false, or with
AGENT_ACCESS=off in its environment (on Vercel, redeploy for an env change to apply).
Status: live on the sample stores. Not yet published to npm.
What a store gets
- A public MCP endpoint (Streamable HTTP, stateless, no sign-in) with shopper tools only:
get_store_info,search_products,get_product,add_to_cart,get_cart,update_cart_item,remove_cart_item,start_checkout,get_order_status. Optional help tools appear when the store supplies their hooks:list_categories,check_discount_code,estimate_shipping, andget_customization_options/price_customizationfor made-to-order products (see the agent-ready stores guide ). Admin tools (products, content, stock) aren’t registered on it at all; they stay on the operator’s own server inai-interface. llms.txtdescribing the store, its policies and how to shop it with an agent.- An MCP Server Card for
/.well-known/mcp.json, so agents find the endpoint without connecting first. - A product feed (
buildProductFeed,productFeedJsonl) and schema.org structured data for product pages (productJsonLd), from the same catalog view the tools use (createCatalogView), so prices and stock agree everywhere. customizationAgentHooks, which plugs@mercatus-liber/customizationinto the personalization tools.- UCP checkout sessions (
handleUcpRequest,ucpProfile): the Universal Commerce Protocol’s REST checkout, 2026-08-25. Buyers finish on the store’s page atcontinue_url. - WebMCP (
@mercatus-liber/agent-commerce/webmcp): registers the shopper tools with an agent in the buyer’s browser, running them through the store’s MCP endpoint. - ACP checkout sessions (
handleAcpRequest,acpDiscovery): the Agentic Commerce Protocol’s REST checkout, 2026-04-17. Off until the store issues API keys to an agent platform.
How buying works
The agent searches, reads products, builds the cart and calls start_checkout with the buyer’s
email. That returns the store’s own hosted checkout link; the person opens it, confirms the
address and pays. The agent never handles card details, and the order is placed through the same
checkout, inventory and webhook paths as a person clicking through the site.
Agent payment without a page (delegated payment tokens such as Stripe’s Shared Payment Tokens) is off until a store opts in; see the agent-commerce epic .
Guard rails
- Only active products in the store’s own catalog are visible (one database can hold several stores).
- At most 10 of one item and 20 lines per cart through an agent (
maxQuantityPerLine,maxLinesPerCart). - Success and cancel URLs are the store’s, never the agent’s; the cart is the checkout’s retry key.
- Order status needs the order id and the checkout email, and returns status and items only (no address).
- Input mistakes come back as fixable messages; other errors are logged and kept vague.
createRateLimiter({ perMinute })throttles each client. Its default store is in memory, so on serverless it’s best effort per instance; pass a sharedRateLimitStorefor a real limit.- A store whose carts don’t survive between requests (in-memory carts on serverless) sets
canShop: falseand offers browsing only.
Usage (Next.js route handler)
import { handleAgentMcpRequest, createRateLimiter } from "@mercatus-liber/agent-commerce";
const allow = createRateLimiter({ perMinute: 60 });
export async function POST(request: Request) {
return handleAgentMcpRequest(request, deps, { env: process.env, allow });
}deps is an AgentCommerceDeps: the store profile, its URLs, and its catalog, search, cart and
checkout services (the real subsystem services fit structurally). The reference storefront wires
it in apps/reference-storefront/lib/agent-commerce.ts and serves /demo/<store>/mcp,
/demo/<store>/llms.txt and /demo/<store>/.well-known/mcp.json; on a standalone store those
are /mcp, /llms.txt and /.well-known/mcp.json.
Try it
npx @modelcontextprotocol/inspector
# Transport: Streamable HTTP, URL: https://commerce.mdostal.com/demo/print-shop/mcp