Skip to Content
PlanningDesign discussion: agent commerce on by default (2026-11-30)

Planning corpus: this is the real design-discussion doc for epic agent-commerce, synced verbatim from this repo’s own internal planning process.

Design discussion: agent commerce on by default (2026-11-30)

Ask (verbatim)

“Let’s ensure mercatus liber is by default ENTIRELY AGENT CAPABLE — it should enable agents to find and shop on our sites and our stores and help and navigate and purchase etc for people END TO END ! — if someone wants they can turn that off, but yeah”

What exists today (checked in the repo, 2026-11-30)

  • packages/ai-interface: MCP server plus tool handlers. Shopper tools: search_products, get_product, add_to_cart, get_cart, start_checkout, get_order_status. Admin tools (create/update product, CMS, inventory, lines, Printful) sit on the same server.
  • apps/reference-storefront/mcp-server.ts: stdio only, fixed to print-shop, admin tools included. An agent on the internet (ChatGPT, Claude, Gemini, Perplexity) can’t reach it. It’s a local developer demo, not a shopping surface.
  • Product pages emit schema.org Product + Offer/AggregateOffer + AggregateRating and BreadcrumbList JSON-LD. No Organization, WebSite/SearchAction, shipping or return policy markup.
  • robots.ts allows everything except admin, sitemap present. No llms.txt, no /.well-known/* agent manifests, no product feed.
  • store-api: key-authenticated (apps like flayr), not for anonymous shopping agents.
  • Checkout: Stripe-hosted. startCheckout returns a payment URL a human opens. Demo stores run in sandbox payment mode.

Where the standards are (checked on the web, 2026-11-30; cite sources in the PR)

  • MCP is how agents call a store directly. Remote servers use Streamable HTTP. Discovery is converging on a Server Card at /.well-known/mcp.json (IETF individual drafts, not final). Shopify ships a Storefront MCP on every store.
  • UCP (Universal Commerce Protocol, Google + Shopify, Apache-2.0, spec 2026-08-25): profile at /.well-known/ucp (needs version, services, payment_handlers, Cache-Control: public, max-age>=60), checkout sessions (create/update/complete_checkout, REST POST /checkout-sessions), transports REST, MCP and A2A, “permissionless onboarding”, and a continue_url that hands the buyer to the normal web checkout when the agent can’t finish. Official TS SDK and conformance tests exist.
  • ACP (Agentic Commerce Protocol, OpenAI + Stripe, beta, latest stable 2026-04-17): checkout session API, delegated payment (Stripe Shared Payment Tokens), cart, feed, order tracking, MCP transport. Reaching ChatGPT’s buyers needs OpenAI’s merchant onboarding (owner’s account action).
  • WebMCP: in-browser tools a page registers for an agent driving the user’s browser. Complementary.

Proposal

One new framework package, @mercatus-liber/agent-commerce, wired by default in the reference storefront (and so in every store scaffolded by create-store). Everything is on unless the store turns it off:

agentAccess?: false | { discovery?: boolean; // llms.txt, JSON-LD, server card, feed. Default true mcp?: boolean; // public shopper MCP endpoint. Default true checkout?: { ucp?: boolean; acp?: boolean }; // agent checkout protocols. Default true delegatedPayment?: boolean; // agent pays with a platform token (ACP SPT / UCP tokenizer). Default true when the payment adapter supports it rateLimit?: { perMinute: number }; // default 60 per client }

Plus an env kill switch, AGENT_ACCESS=off, so an operator can shut it without a deploy of code.

Layers

  1. Find (discovery): per store
    • /llms.txt: what the store sells, its categories, policies, and how to shop it (MCP URL, UCP profile, the web checkout).
    • /.well-known/mcp.json server card, /.well-known/ucp, /.well-known/acp.json.
    • JSON-LD: add Organization, WebSite + SearchAction, OfferShippingDetails, MerchantReturnPolicy, availability, on top of today’s Product.
    • A product feed (/agent/feed.json, ACP feed shape), from the sales catalog only.
    • robots: keep allow-all for shopper routes; name the known AI shopping agents explicitly so a store that wants to block one can.
  2. Shop and get help (public shopper MCP over Streamable HTTP, stateless, JSON responses so it runs on Vercel functions): one endpoint per store. Shopper tools only, never admin tools.
    • Existing: search, product, add to cart, cart, checkout, order status.
    • New: get_store_info (what the store is, shipping, returns, contact, payment methods), list_categories / browse_category, list_lines / get_line (read-only), update_cart_item, remove_cart_item, apply_discount_code, estimate_shipping, customize_product (made-to-order options and measured params, validated by customization), get_page_url (deep link for the human).
    • Order status needs order id and the buyer’s email, so order ids aren’t enough to read PII.
  3. Buy, end to end:
    • Always: start_checkout returns the hosted checkout URL (UCP continue_url). The agent builds the whole order; the person taps pay. Works on every store today, no platform onboarding.
    • UCP checkout sessions (REST + MCP binding) mapped onto cart + checkout-orders, with continue_url escalation by default.
    • ACP checkout sessions mapped the same way.
    • Delegated payment: when the agent platform presents a payment token (ACP Shared Payment Token via Stripe), payments completes the charge without a page. The platform has the buyer’s consent; the store verifies the token, amount and currency. Same order, inventory, webhooks and recovery paths as a human checkout (no second order pipeline).
  4. On the page (later slice): WebMCP tools on the storefront so a browser agent can search, add to cart and check out without screen-scraping.

What stays the same

  • All of it calls the existing subsystem interfaces (same rule as ai-interface: no duplicated business logic). Protocol shapes live in the new package as adapters over cart/checkout-orders, so protocol churn (UCP and ACP both version by date) touches one package.
  • Admin tools stay off the public endpoint. The stdio server keeps them for local operators.

Slices (each its own PR, shipped as it lands)

  1. Package + config + public shopper MCP endpoint per store + server card + llms.txt + kill switch + tests. Demos on by default.
  2. Help and navigation tools (store info, categories, lines, cart edits, discount codes, shipping estimate, customization, deep links) + richer JSON-LD + product feed.
  3. UCP: profile + checkout sessions (REST and MCP), continue_url escalation, run the official conformance tests.
  4. ACP: /.well-known/acp.json, checkout sessions, feed shape, delegated payment with Stripe Shared Payment Tokens in payments (sandbox on the demos).
  5. WebMCP on the storefront, docs (subsystem doc, What’s new, sample-stores “shop with an agent”), sample-health checks for the agent endpoints, and an end-to-end test where a scripted agent finds and buys the dad cap on print-shop in sandbox.

Not this epic

  • Registering with OpenAI / Google Merchant Center / Shopify catalog (owner’s accounts).
  • Agent identity verification (Web Bot Auth / signed agents): design leaves a hook, not built now.
  • shop.mdostal.com turning it on: it’s a consumer; the shop session decides when it upgrades.

Revision after grill round 1 (2026-11-30, 27 findings; see grill-record.md)

The grill changed the order of work. Hardening of today’s code comes first, the public endpoint second, the checkout protocols last.

Slice 0, hardening (ships before anything goes public; it also fixes live gaps):

  • startCheckout: the idempotency key is scoped to the cart (no cross-buyer replay); success and cancel URLs are set by the store, never by the caller (no open redirect).
  • Order status for agents: needs order id + matching email, returns a redacted view (no address, phone or payment link).
  • Stock: a cap on quantity per line and per cart; reservations from unpaid checkouts expire (the sandbox adapter expires its sessions on a timer, the same path Stripe’s checkout.session.expired takes).
  • Tools are scoped to the store they’re mounted on and never return drafts.

Slice 1, public shopper endpoint: a separate shopper-only MCP server (admin tools aren’t registered at all, with a test that proves it), a new server and transport per request (stateless Streamable HTTP), the store-set checkout URLs above. Discovery routes work on both the shared host (/demo/<slug>/...) and standalone hosts (fix the single-tenant rewrite that 404s /llms.txt today). Rate limiting uses the store’s own database where it has one (no new paid service); otherwise best-effort per instance. Broadleaf: carts need a durable home before its endpoint turns on (it runs on Convex; carts persist only on Postgres today), so Broadleaf’s agent checkout waits on that and it’s said plainly.

What “end to end” means by default: the agent finds, asks, chooses options, builds the cart and starts checkout. The person pays on the hosted page the agent hands them. That’s on everywhere.

Agent pays without a page (delegated payment): off by default. Stripe Shared Payment Tokens are a preview that needs the owner’s Stripe opt-in, a preview API version, and tax/address handling the hosted page does today. It’s an owner decision and a later slice, not a default.

UCP and ACP: after MCP + hand-off. UCP first (permissionless onboarding), as an adapter over a new “checkout draft” that doesn’t reserve stock until completion. ACP after that, since reaching ChatGPT needs merchant onboarding.

create-store and shop.mdostal.com: create-store gets the routes in its template. The shop is told about the shared-package changes (idempotency scoping, redaction, reservation expiry) before its next tarball refresh.