@cloudcart/storefront-mcp 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +116 -2
- package/data/storefront.json +1 -0
- package/dist/app-resources.d.ts +40 -0
- package/dist/app-resources.d.ts.map +1 -0
- package/dist/app-resources.js +109 -0
- package/dist/app-resources.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/storefront.d.ts +14 -0
- package/dist/prompts/storefront.d.ts.map +1 -0
- package/dist/prompts/storefront.js +322 -0
- package/dist/prompts/storefront.js.map +1 -0
- package/dist/schema/loader.d.ts +47 -0
- package/dist/schema/loader.d.ts.map +1 -0
- package/dist/schema/loader.js +34 -0
- package/dist/schema/loader.js.map +1 -0
- package/dist/tools/introspect-schema.d.ts +17 -0
- package/dist/tools/introspect-schema.d.ts.map +1 -0
- package/dist/tools/introspect-schema.js +245 -0
- package/dist/tools/introspect-schema.js.map +1 -0
- package/dist/tools/learn-storefront-api.d.ts +11 -0
- package/dist/tools/learn-storefront-api.d.ts.map +1 -0
- package/dist/tools/learn-storefront-api.js +13 -0
- package/dist/tools/learn-storefront-api.js.map +1 -0
- package/dist/tools/validate-graphql.d.ts +18 -0
- package/dist/tools/validate-graphql.d.ts.map +1 -0
- package/dist/tools/validate-graphql.js +222 -0
- package/dist/tools/validate-graphql.js.map +1 -0
- package/package.json +52 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present CloudCart AD
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
Portions of this software are adapted from code under the following licence:
|
|
14
|
+
|
|
15
|
+
Copyright 2023-present, Shopify Inc.
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,117 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cloudcart/storefront-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An MCP server for the **CloudCart Storefront GraphQL API** — the headless API
|
|
4
|
+
Nitrogen storefronts, the mobile app and other clients are built on.
|
|
5
|
+
|
|
6
|
+
It is a developer's assistant, not a shop's. It runs on your machine, reads the
|
|
7
|
+
schema, and never talks to a store: no access token, no network, nothing that
|
|
8
|
+
could touch live data.
|
|
9
|
+
|
|
10
|
+
Its companion is [`@cloudcart/dev-mcp`](https://www.npmjs.com/package/@cloudcart/dev-mcp), which covers the **Admin**
|
|
11
|
+
API. The two APIs differ in more than scope — the Admin API uses plain numeric
|
|
12
|
+
ids, the Storefront API uses `gid://cloudcart/…` — so keep them apart.
|
|
13
|
+
|
|
14
|
+
## Tools
|
|
15
|
+
|
|
16
|
+
| Tool | What it is for |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `learn_cloudcart_storefront` | **Call first.** The whole API — catalog, collections, search, content, cart, checkout, customers, orders, returns, analytics — and what the schema cannot tell you: how a signed-in buyer is sent (never an `Authorization` header), that a Nitrogen storefront's checkout is the store's own (`cart.checkoutUrl`), that the server owns every price and money is shown as `formatted`, that facets come back with the products, that a cart is addressed by an unguessable key. |
|
|
19
|
+
| `introspect_graphql_schema` | Look up a type, query or mutation by name. Flags fields that stay empty unless the merchant runs the app behind them. |
|
|
20
|
+
| `validate_graphql_codeblocks` | Check GraphQL before it ships — both against the schema and against the mistakes that validate cleanly and still fail. |
|
|
21
|
+
|
|
22
|
+
There is deliberately no semantic search. The surface is small enough to look
|
|
23
|
+
up by name — `data/storefront.json` holds every type, query and mutation — and
|
|
24
|
+
`learn_cloudcart_storefront` names the operation for each step; an embedding
|
|
25
|
+
index would add size and a cold start to solve a problem this API does not have.
|
|
26
|
+
|
|
27
|
+
## What the validator notes beyond schema errors
|
|
28
|
+
|
|
29
|
+
Things that pass validation and still go wrong:
|
|
30
|
+
|
|
31
|
+
- a **numeric cart id** — carts are addressed by their key, and a row number
|
|
32
|
+
resolves to nothing
|
|
33
|
+
- reading **delivery before there is an address** — couriers price against a
|
|
34
|
+
destination, so the list is empty
|
|
35
|
+
- reading `paymentMethods` **before delivery is chosen** — the courier decides
|
|
36
|
+
part of what is allowed
|
|
37
|
+
- selecting `amount` **without `formatted`** — fine for logic, but a buyer is
|
|
38
|
+
shown the amount as the store writes money
|
|
39
|
+
- a paged product list or search **without its facets** (`filters`,
|
|
40
|
+
`productFilters`) or **without `totalCount`** — the API already computed them
|
|
41
|
+
|
|
42
|
+
It also answers names borrowed from other storefront APIs — `productByHandle`,
|
|
43
|
+
`checkoutCreate`, `cartDeliveryAddressesAdd`, `cartGiftCardCodesUpdate`,
|
|
44
|
+
`customerAccessTokenCreate`, `metaobjects`, `Product.metafields` — each coming
|
|
45
|
+
back with the CloudCart equivalent and the reason it differs. Most of the
|
|
46
|
+
vocabulary is deliberately familiar; these are the places it is not.
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install
|
|
52
|
+
npm run build
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`data/storefront.json` is part of the package: building needs no schema.
|
|
56
|
+
|
|
57
|
+
## Regenerate the schema
|
|
58
|
+
|
|
59
|
+
`generate-schema` reads the SDL from the folder in `SF_SCHEMA_DIR`. Give it the
|
|
60
|
+
`sf/schema` files of the commit production runs, never a working copy: a
|
|
61
|
+
developer's queries go to production, and a type that exists only on a branch
|
|
62
|
+
would validate here and fail there. Export them from cc-builder:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
mkdir -p /tmp/sf-deployed
|
|
66
|
+
git -C /path/to/cc-builder archive <deployed commit> sf/schema | tar -x -C /tmp/sf-deployed
|
|
67
|
+
SF_SCHEMA_DIR=/tmp/sf-deployed/sf/schema npm run generate-schema
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The schema is assembled from those files rather than fetched from a running
|
|
71
|
+
store. They are what the server itself builds from — no store, no token, no
|
|
72
|
+
network.
|
|
73
|
+
|
|
74
|
+
## Use it
|
|
75
|
+
|
|
76
|
+
The CloudCart AI Toolkit plugin registers it. To add it to an MCP host yourself:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"mcpServers": {
|
|
81
|
+
"cloudcart-storefront-mcp": {
|
|
82
|
+
"command": "npx",
|
|
83
|
+
"args": ["-y", "@cloudcart/storefront-mcp@latest"]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
From a local build, the command is `node` with `/absolute/path/to/storefront-mcp/dist/index.js`.
|
|
90
|
+
|
|
91
|
+
## After a schema change is deployed
|
|
92
|
+
|
|
93
|
+
Export the deployed commit's `sf/schema` as above, then:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
SF_SCHEMA_DIR=/tmp/sf-deployed/sf/schema npm run generate-schema && npm run build
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The shipped schema comes from that step, so run it after every deploy that
|
|
100
|
+
changes `sf/schema`.
|
|
101
|
+
|
|
102
|
+
## Release
|
|
103
|
+
|
|
104
|
+
1. Regenerate the schema from the deployed commit (above), `npm run build`, and check the three tools.
|
|
105
|
+
2. Bump `version` in `package.json` (the server reads it from there), commit, push `main`; CI builds and checks the tools on Node 20, 22 and 24.
|
|
106
|
+
3. `gh release create vX.Y.Z` — the `Publish to npm` workflow checks the tag equals the version and publishes. It needs the repository secret `NPM_TOKEN`.
|
|
107
|
+
|
|
108
|
+
## Layout
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
scripts/generate-schema.ts SDL in the repo → data/storefront.json
|
|
112
|
+
src/prompts/storefront.ts what an assistant must know before writing anything
|
|
113
|
+
src/app-resources.ts which fields depend on a merchant's installed apps
|
|
114
|
+
src/tools/ the three tools
|
|
115
|
+
src/schema/loader.ts reads and caches the introspection JSON
|
|
116
|
+
.github/workflows/ CI on every push; the npm release on a GitHub release
|
|
117
|
+
```
|