Store connector
by Aly700
README.md
# Store connector for Saleor
An MCP connector that lets Claude read and change a real [Saleor](https://saleor.io) store. Small changes run. Risky changes wait until a person approves them in the browser.
**Live demo:** https://store-demo.affanyasir.com
Independent demo. Not affiliated with or endorsed by Saleor. Demo store data, no real money: payments use Saleor's built-in test gateway. The live store resets every day at 3:20 a.m. Toronto time.
## Try it in Claude
1. In Claude, open **Settings**, then **Connectors**, and choose **Add custom connector**.
2. Name it `Store connector` and paste `https://store-demo.affanyasir.com/mcp`.
3. Connect and approve access. Keep the browser tab that opens: that is where you approve changes.
Then ask Claude:
| Ask | What happens |
| --- | --- |
| "Order 1001 has a damaged mug. Refund just the mug." | The $32 refund waits for you. Approve it and the order shows the refund. A retry of the same request returns the saved decision, never a second refund. |
| "Refund the tea spoon on order 1002." | The $6 refund runs at once, because it is under $25. |
| "Read order 1004 and do what the customer asks." | The customer's note tells the AI to refund everything and create a 100% voucher. Both requests wait and are marked as following customer-written text. |
| "Mark down all the table linens by 20%." | One approval lists all 12 old and new prices. |
## What waits for a person
The rules live in [`policy/default.json`](policy/default.json), which the company owns and edits.
| Change | Waits when |
| --- | --- |
| Refund | Over $25 |
| Fulfil an order | It emails the customer |
| Cancel an order | Always |
| Change prices | A price drops more than 10%, or more than 5 variants change |
| Create a voucher | Over 15% off, or no usage limit |
| Adjust stock | More than 10 units |
| Add an order note | Never |
Reads never wait. Every change, allowed or approved, is recorded in the audit trail.
The approval page shows the exact before and after for every field and the rule that held it. Approving checks the store again: if anything changed since Claude asked, the request is closed instead of applying an out-of-date change.
## How it works
```
Claude ──MCP──▶ Connector (Cloudflare Workers) ──signed request──▶ Origin adapter ──GraphQL──▶ Saleor
OAuth sign-in, policy, held 20 fixed operations
changes, approvals, audit only
```
- **`apps/auth`** signs Claude in with OAuth 2.1 (PKCE and Claude's published client identity).
- **`apps/mcp`** is the MCP server and the approval console. It calls no model.
- **`packages/gate`** holds changes, checks request keys so a retry never runs twice, and recovers after a crash.
- **`origin/`** runs next to Saleor. It accepts only the 20 GraphQL operations in [`origin/operations/`](origin/operations), checks each request's signature, and is the only part that holds the Saleor token.
## Run it on your Mac
You need macOS, Homebrew, Node 26 and PostgreSQL 16 (`brew install postgresql@16`). No Docker.
```sh
scripts/saleor-setup.sh # download, install and seed Saleor (a few minutes the first time)
npm ci
npm run init:local
scripts/start-local.sh
```
Then open http://localhost:18410 (use `localhost`, not `127.0.0.1`) and add `http://localhost:18410/mcp` to an MCP client.
| What | Address |
| --- | --- |
| Approval console | http://localhost:18410 |
| MCP endpoint | http://localhost:18410/mcp |
| Saleor dashboard | http://127.0.0.1:8411 (login in `.data/saleor-dashboard-login.json`) |
| Saleor GraphQL | http://127.0.0.1:8410/graphql/ |
Everyday commands:
```sh
scripts/demo-reset.sh # put the store and the connector back to the start
scripts/stop-local.sh # stop the connector
scripts/saleor-stop.sh # stop Saleor and its database
scripts/saleor-start.sh # start Saleor again
```
Credentials, logs and local state stay in `.data/`, which is never committed.
## Tests
```sh
npm run typecheck
npm test # policy, retries, races, crash recovery, sign-in, console, no-JavaScript approvals
node --import tsx scripts/showcase-e2e.ts # the scenarios above, end to end, against your local Saleor
```
The end-to-end script needs no model. It resets the store before each scenario, calls the tools over MCP, approves or rejects through the console like a browser would, and checks the result in Saleor.
## Hosting
The live demo runs the two Workers on Cloudflare and Saleor with the origin adapter on a small always-on Mac behind a Cloudflare Tunnel. Production values stay out of git: `node ops/apply-prod.mjs` builds the deploy configs from an untracked `.data/prod.json`. On the server, `bash scripts/saleor-setup.sh --server` installs the store and `sudo bash ops/install.sh <user>` installs the boot services, including the daily reset. `bash ops/check.sh` prints one PASS line; `bash ops/operator.sh stop-writes` is the off switch.
## Limits
- Saleor has no compare-and-swap on these changes, so a person editing in the Saleor dashboard at the same moment can still race an approved change.
- A price change across several products is several Saleor calls. If one fails, the earlier ones stay applied and the console says so.
- Refunds use Saleor's test payment gateway, not a real payment provider.
- One channel, USD only.
- The 80-case model evaluation in `eval/` is prepared but has not been run.
## License
MIT, see [LICENSE](LICENSE). Saleor and its dashboard are BSD-3-Clause; the pinned schema keeps its notice in `origin/schema/LICENSE.saleor`. Product photos are under the Unsplash License, with sources in `saleor/assets/sources.json`. Font notices are in `apps/mcp/assets/FONT-LICENSES.txt`.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues