AI shopping agents
A buyer can ask an AI agent to shop for them. With the MCP endpoint in the Checkout SDK, that agent can find your products, build a cart and prepare a checkout in your store, then give the buyer a link to COPE’s checkout page. The buyer accepts your terms and pays there themselves. An agent cannot accept terms or pay on the buyer’s behalf. The endpoint runs on your server, under your domain, with your publishable key. It speaks the Model Context Protocol (MCP), which AI agents use to call tools.Requirements
- A COPE publishable key (
cope_pk_live_...). - The success and cancel URLs you use for checkout, registered as redirect URLs in the COPE dashboard.
- A server that runs Node.js 20 or later, Bun, Deno, Cloudflare Workers or a Next.js route handler.
Install
Create a cart key
The endpoint gives agents an encrypted handle for each cart, so an agent never holds the cart’s secret. Create a 32-byte key for that once, and store it as a server-side secret:Mount the endpoint
On Node.js:@modelcontextprotocol/node:
https://shop.example.com/mcp.
Options
Tools
When a tool fails, its result includes a
guidance string telling the agent what to do next.
Rotate the cart key
- Add a new key at the front of
cartRefKeysand deploy. New handles use it, and existing handles still work. - After your longest-lived carts have expired, remove the old key and deploy again.
Security
- The endpoint uses only your publishable key, the same key your storefront already exposes.
- Terms, consents and payment happen on COPE’s checkout page, in the buyer’s own browser.