---
name: commerceforai
description: Add a store to an app or run one for a merchant with CommerceForAI — products, stock, Stripe checkout, orders, shipping, returns, print-on-demand, sales tax. Use when asked to "add a store", "sell products", "add checkout", "track orders or inventory", manage an existing CommerceForAI store, or shop at one.
---

# CommerceForAI

Commerce on the merchant's own Stripe account. Pick the path that matches the job.

## 1. Building a store into code (coding agents)

```bash
npx commerceforai init            # free test store + API key in .env.local, no sign-up
npm install commerceforai
```

- Next.js App Router: `npx commerceforai init --template nextjs` adds a working `/shop`.
- How it should look: offer the user a ready-made theme (complete Next.js + Tailwind store; install steps from MCP `get_theme` or https://commerceforai.com/themes.json) or one of the measured looks in https://commerceforai.com/inspiration.json (MCP `list_design_references`, no key needed). Let them pick one and apply it to every page; don't mix looks.
- Call `commerce.store.setupStatus()` first: it lists every remaining step with the exact fix.
- Prove it works without a browser: `commerce.store.simulateOrder({ items })`.
- React cart: `npx shadcn@latest add https://commerceforai.com/r/cart.json`.
- Full guide: https://commerceforai.com/llms.txt · every docs page as markdown: add `.md` (e.g. https://commerceforai.com/docs/quickstart.md) · API spec: https://api.commerceforai.com/openapi.json

Rules: money is an integer in cents; never mark orders paid or change stock yourself (Stripe events do); keep the API key on the server; don't ask the user to sign up before you've built against the test store.

## 2. Running a store from a chat or agent (merchants)

Connect the MCP server `https://api.commerceforai.com/mcp` (Streamable HTTP). The owner signs in, picks a store and chooses read-only or full access; a store API key also works as the bearer token. Add `?toolsets=core` for a small tool set. Local alternative: `npx -y @commerceforai/mcp` with `COMMERCEFORAI_API_KEY`.

Get the owner's OK before refunds, buying labels, publishing a sync to a live store, or turning on sales tax.

## 3. Shopping at a store (buyer agents)

Every store with public pages has a keyless endpoint:

- MCP: `https://api.commerceforai.com/agent/<store_id>/mcp` — `search_catalog`, `get_product`, `create_checkout`, `ask_business`
- REST: `GET https://api.commerceforai.com/agent/<store_id>` describes the same

`create_checkout` returns a Stripe payment link for the buyer. You never handle card details.

## When a human is needed

Claiming the test store (the `claim_url` from init), connecting Stripe, and going live. Hand the owner the link from `commerce.store.goLiveLink()`.
