[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-95919":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":16,"rankGlobal":9,"rankLanguage":9,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":9,"pushedAt":9,"updatedAt":22,"readmeContent":23,"aiSummary":24,"trendingCount":14,"starSnapshotCount":14,"syncStatus":25,"lastSyncTime":26,"discoverSource":27},95919,"claude-for-commerce-examples","Shopify\u002Fclaude-for-commerce-examples","Shopify","Shopify implementations of Anthropic's commerce-agents blueprint: a storefront shopping agent over UCP and Sign in with Shop, and a merchant agent over the Admin API",null,"Python",107,13,1,0,5,3.44,"Apache License 2.0",false,"main",true,[],"2026-09-21 02:04:29","# Claude for Commerce examples\n\n> [!NOTE]\n> If you are interested in building a custom storefront agent on Shopify using Claude,\n> the following example will help you get up and running. Alternatively, you can use\n> [Shopify Inbox](https:\u002F\u002Fapps.shopify.com\u002Finbox) to set up a managed storefront agent —\n> no code required — that can answer consumer questions on your online store.\n\nShopify implementations of\n[Anthropic's commerce-agents blueprint](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents):\n`storefront\u002F` runs the blueprint's shopping agent against a real Shopify store, and\n`merchant\u002F` runs its merchant agent over the same store's Admin API. Each example\nis self-contained — its own API host, web app, fixtures, and tests — and they share only\n`vendor\u002F` and the blueprint's packages, which install from Anthropic's repository at the\ncommit pinned in `requirements.txt`.\n\n## Storefront\n\nA storefront shopping agent for a real Shopify store, built on\n[Anthropic's commerce-agents blueprint](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents)\nand Shopify's [UCP](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fagents) endpoints. Point `SHOP_DOMAIN` at a\nstore and the agent searches its live catalog, builds a real cart, answers from its\npolicies and FAQs, and hands the customer to the store's own checkout page. The web app\nbrands itself from the store — name, logo, colors, best sellers — so the same code is a\nbranded storefront for any shop. Nothing here places an order or takes payment:\ncheckout, shipping, and payment all happen on Shopify's own pages.\n\nThe blueprint's packages (the shopping agent, its gates and skills, and the shared\ncommerce types) install from Anthropic's repository at the commit pinned in\n`requirements.txt`; this repository adds the Shopify storefront on top of them,\nunchanged. `vendor\u002F` carries the blueprint's example scaffolding — see [NOTICE](NOTICE).\n\n## Run\n\nPython 3.11+ and Node 22.\n\n```bash\npython3 -m venv .venv && source .venv\u002Fbin\u002Factivate\npip install -r requirements.txt\ncp .env.example .env                                # add ANTHROPIC_API_KEY\nSHOP_DOMAIN=your-store.com uvicorn storefront.api.main:app --port 8004\n```\n\n```bash\nnpm install && npm run dev -w storefront\u002Fweb       # separate terminal · http:\u002F\u002Flocalhost:3005\n```\n\n`SHOP_DOMAIN` is any domain serving `\u002F.well-known\u002Fucp` (default `demostore.mock.shop`,\na Shopify demo store). `.env.example` lists every variable. To join a cart the store\nalready has, open the storefront with `?cart=\u003Ccart id>` (a storefront's `cart` cookie\nvalue works as-is) or `POST \u002Fapi\u002Fcart\u002Fattach`; writes re-read the cart first, so nothing\ndone elsewhere is overwritten.\n\n## Try\n\n1. I'm looking for a gift under $50 — what do you recommend?\n2. Add the first one to my cart.\n3. What's your return policy?\n\nThe grid, cart drawer, and checkout button in the web app stay in sync with the\nconversation; the checkout button opens the store's hosted checkout page.\n\n## Sign in with Shop (optional)\n\nWith Shop app credentials, buyers can sign in and `search_catalog` returns personalized\nresults. Set `SHOPIFY_UCP_CLIENT_ID` \u002F `SHOPIFY_UCP_CLIENT_SECRET` (issued in the\n[Shopify Dev Dashboard](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fagents)); without them the sign-in\nroutes answer 503 and every session is a guest — the guest path is identical to running\nwith no credentials at all.\n\nSign-in is authorization-code against Shop, server-side. Buyer tokens are keyed by\nsession and never reach the model, the browser, or the logs; each catalog call pairs\nthe token with the buyer's IP, as the catalog requires. An expired token re-mints once;\na failed re-mint falls back to guest.\n\n## Checkout and orders\n\nCheckout is a handoff. A non-empty cart is lazily staged as a UCP checkout\n(`create_checkout`, re-synced after cart writes) and the customer finishes on the\nstore's own page via its `continue_url`. `complete_checkout` is never called — it\nplaces the order and takes payment, which this repository never does.\n\nOrders follow [Order MCP](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fagents\u002Forders\u002Forder-mcp) v1\nsemantics: only orders placed through this agent are visible, on a buyer's ask (never\npolled), and the credential must carry the `read_global_api_orders` scope. Without that\nscope the backend disables its order tools and the agent tells the customer order\ntracking is unavailable, pointing at the confirmation email instead.\n\n## Merchant\n\nThe other side of the same store: the blueprint's merchant agent over the Shopify Admin\nGraphQL API. It reads a store's products, orders, and inventory, proposes changes to them,\nand writes back the ones the operator approves.\n\n```bash\nSHOPIFY_LOCAL_STORE=1 uvicorn merchant.api.main:app --port 8005\n```\n\nThat needs no Shopify account. `SHOPIFY_LOCAL_STORE=1` points the backend at\n`merchant\u002Fapi\u002Flocal_store.py`, an in-process stand-in for one store's Admin API seeded from\n`merchant\u002Fdata\u002Fseed.json`. Against a real development store, put `SHOPIFY_SHOP_DOMAIN` and\n`SHOPIFY_ADMIN_TOKEN` in `merchant\u002F.env` instead — `merchant\u002F.env.example` documents every\nvariable, and `merchant\u002FREADME.md` the scope each read needs — then seed it with `merchant\u002Fscripts\u002Fseed_store.py`\nand check it with `merchant\u002Fscripts\u002Fsmoke_live.py`.\n\nWrites are gated, and that is the part worth reading the code for. The agent's `stage_*`\ntools send no Admin mutation at all: a staged change is recorded in the ledger, and only\n`POST \u002Fapi\u002Fmerchant\u002Fchanges\u002F{id}\u002Fapply` applies it. The Admin token is read once, in\n`merchant\u002Fapi\u002Fagent_config.py`, and handed to the transport; it never reaches the model, a\nroute, or a log.\n\nThis example is the host alone; it ships no web UI. `\u002Fapi\u002Fmerchant` serves the reads, the\nchat stream, and the approval calls, and the operator-facing app is yours to build.\n\n[merchant\u002FREADME.md](merchant\u002FREADME.md) is how to run it, against either store.\n\n## Layout\n\n- `storefront\u002Fapi\u002F`: the FastAPI host — the UCP MCP client (`ucp_client.py`), the\n  blueprint's `StorefrontBackend` over it (`shopify_backend.py`), Sign in with Shop\n  (`identity.py`), brand and catalog warm-up routes, and the agent configuration.\n- `storefront\u002Fweb\u002F`: the branded storefront (Next.js) — product grid, cart drawer, and\n  the assistant rail from the blueprint's shared web components.\n- `storefront\u002Fscripts\u002F`, `storefront\u002Fdata\u002F`: live smoke checks, the fixture recorder,\n  and the recorded MCP responses the tests replay.\n- `merchant\u002Fapi\u002F`: the merchant host — the Admin GraphQL transport (`admin_client.py`),\n  every document it sends (`queries.py`), the catalog and order caches, the\n  `MerchantBackend` (`shopify_backend.py`), the staging layer (`staging.py`), and the\n  in-process local store.\n- `merchant\u002Fscripts\u002F`, `merchant\u002Fdata\u002F`: the store seeder, the live smoke check, the seed\n  catalog, and the alert thresholds.\n- `vendor\u002F`: the blueprint's example scaffolding (`demo_common`, `web-shared`) and its\n  skills, five per agent under `skills\u002Fshopping\u002F` and `skills\u002Fmerchant\u002F`, carried from\n  Anthropic's repository — see [NOTICE](NOTICE) for the small local edits.\n\n## Tests\n\n```bash\npytest                                         # recorded responses, no network\npython storefront\u002Fscripts\u002Fsmoke.py             # live check, guest path\npython storefront\u002Fscripts\u002Fsmoke_signin.py      # signed-in path; no-ops without SHOP_ACCESS_TOKEN\n```\n\nThe storefront's tests replay `storefront\u002Fdata\u002Frecorded_responses.json` through an\n`httpx.MockTransport`; `storefront\u002Fscripts\u002Frecord_fixtures.py` re-records from a live\nstore. The merchant's run the real modules against canned Admin API responses\n(`merchant\u002Fapi\u002Ftests\u002Ffake_admin.py`) and against the local store;\n`merchant\u002Fscripts\u002Fsmoke_live.py` is their live counterpart. None of these scripts needs an\nAnthropic key.\n\n## License\n\nApache-2.0. This repository includes code from\n[anthropics\u002Fcommerce-agents](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fcommerce-agents)\n(Copyright Anthropic PBC) — see [NOTICE](NOTICE).\n","这是一个基于Anthropic Commerce Agents蓝图构建的Shopify电商智能体示例项目，提供面向消费者的 storefront 购物助手和面向商家的 merchant 管理助手两个可运行实例。核心功能包括：通过Shopify UCP（Unified Commerce Platform）实时检索商品目录、动态构建购物车、基于店铺政策与FAQ回答用户问题，并无缝跳转至Shopify原生结账页；同时支持通过Admin API实现商家侧任务自动化。技术上采用Python后端（Uvicorn）、Node.js前端，严格复用Anthropic官方蓝图组件，仅叠加Shopify适配层，确保可移植性与品牌一致性。适用于希望快速验证或自托管AI购物助手的Shopify独立站开发者与技术型商家。",2,"2026-09-06 02:30:05","CREATED_QUERY"]