webcake-storefront-mcp 1.0.1 β 1.0.2
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/README.md +126 -1091
- package/README.vi.md +200 -0
- package/dist/install.js +4 -3
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,1166 +1,201 @@
|
|
|
1
|
-
|
|
1
|
+
# πͺ WebCake Storefront MCP
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** Β· [TiαΊΏng Viα»t](./README.vi.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/webcake-storefront-mcp)
|
|
6
|
+
[](https://www.npmjs.com/package/webcake-storefront-mcp)
|
|
7
|
+
[](https://github.com/vuluu2k/webcake-storefront-mcp/stargazers)
|
|
8
|
+
[](https://modelcontextprotocol.io)
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
> **Describe a store page in plain words β your AI builds it, validates it, and publishes it to your WebCake storefront.**
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
> β **If this saves you an afternoon of dragging blocks around, [give it a star](https://github.com/vuluu2k/webcake-storefront-mcp) β every star keeps a solo project alive.**
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
> *"Build a page for my coffee shop β a hero with a Shop Now button, a product grid, and an order form. Save it and publish."*
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
npx -y webcake-storefront-mcp install
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Interactive: pick your IDE(s) and paste your credentials. Or non-interactive:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npx -y webcake-storefront-mcp install \
|
|
21
|
-
--ide all \
|
|
22
|
-
--token YOUR_TOKEN \
|
|
23
|
-
--session YOUR_SESSION_ID \
|
|
24
|
-
--site YOUR_SITE_ID
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Supported IDEs: `claude-desktop`, `claude-code`, `cursor`, `windsurf`, `vscode`, or `all`.
|
|
28
|
-
Uninstall with `npx -y webcake-storefront-mcp uninstall`.
|
|
29
|
-
|
|
30
|
-
### Or connect via the browser (no token copy/paste)
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npx -y webcake-storefront-mcp login
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
This opens the builder's connect page; approve it and your token + session are saved to a local config db and picked up automatically.
|
|
37
|
-
|
|
38
|
-
### Manual config (`.mcp.json`)
|
|
39
|
-
|
|
40
|
-
```json
|
|
41
|
-
{
|
|
42
|
-
"mcpServers": {
|
|
43
|
-
"webcake-storefront": {
|
|
44
|
-
"command": "npx",
|
|
45
|
-
"args": ["-y", "webcake-storefront-mcp"],
|
|
46
|
-
"env": {
|
|
47
|
-
"WEBCAKE_TOKEN": "<your-token>",
|
|
48
|
-
"WEBCAKE_SESSION_ID": "<your-session-id>",
|
|
49
|
-
"WEBCAKE_SITE_ID": "<your-site-id>"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Remote server (Streamable-HTTP)
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npx -y webcake-storefront-mcp serve --port 8787
|
|
60
|
-
# MCP endpoint: http://localhost:8787/mcp?jwt=<token>&site_id=<id>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Environment Variables
|
|
64
|
-
|
|
65
|
-
Required: `WEBCAKE_TOKEN` (Bearer JWT), `WEBCAKE_SESSION_ID` (sent as `x-session-id`), `WEBCAKE_SITE_ID`.
|
|
66
|
-
|
|
67
|
-
Endpoints come from a named environment, so you don't set base URLs by hand:
|
|
68
|
-
|
|
69
|
-
| `WEBCAKE_ENV` / `--env` | api | app (login) | preview |
|
|
70
|
-
|---|---|---|---|
|
|
71
|
-
| `local` | `http://localhost:24679` | `http://localhost:5173` | `demo.localhost:24679/<siteId>` |
|
|
72
|
-
| `staging` | `https://api.staging.storecake.io` | `https://staging.webcake.io` | `staging2.webcake.me/<siteId>` |
|
|
73
|
-
| `prod` (default) | `https://api.storefront.webcake.io` | `https://webcake.io` | `<site_slug>.webcake.me` |
|
|
74
|
-
|
|
75
|
-
Override a preset with `WEBCAKE_API_URL` / `WEBCAKE_APP_URL`. Optional, configured server-side (e.g. on the VPS running `serve`): `PEXELS_API_KEY` (search_images), `MONGO_URI` / `MONGO_DB` / `MONGO_COLLECTION` (image-alt cache).
|
|
76
|
-
|
|
77
|
-
Token / session / site can also be set later from chat via the `update_auth` and `switch_site` tools β values are saved to a local SQLite db at `~/.webcake-storefront-mcp/` and restored next session. The CMS admin token + CMS API key (needed for HTTP-function tools) are fetched automatically.
|
|
78
|
-
|
|
79
|
-
### How to get `WEBCAKE_TOKEN` and `WEBCAKE_SESSION_ID`
|
|
80
|
-
|
|
81
|
-
1. Open the WebCake builder and log in.
|
|
82
|
-
2. Open DevTools (`F12`), go to the **Network** tab, and click any API request.
|
|
83
|
-
3. In **Request Headers**: `Authorization: Bearer ...` β `WEBCAKE_TOKEN`; `x-session-id: ...` β `WEBCAKE_SESSION_ID`.
|
|
84
|
-
4. `WEBCAKE_SITE_ID` is in the builder URL, or use the `list_my_sites` tool to list your sites.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## Usage Examples
|
|
89
|
-
|
|
90
|
-
### Example 1: Write backend HTTP function + frontend integration
|
|
91
|
-
|
|
92
|
-
**Prompt:**
|
|
93
|
-
```
|
|
94
|
-
Create a newsletter subscription feature. Backend saves email to "subscribers" collection,
|
|
95
|
-
frontend calls the backend function.
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**AI agent will automatically:**
|
|
99
|
-
|
|
100
|
-
**Step 1** β Call `get_http_function` to read current code
|
|
101
|
-
|
|
102
|
-
**Step 2** β Call `update_http_function` to add new functions:
|
|
103
|
-
|
|
104
|
-
```javascript
|
|
105
|
-
import { DBConnection } from 'webcake-data';
|
|
106
|
-
const db = new DBConnection();
|
|
107
|
-
const Subscriber = db.model('subscribers');
|
|
108
|
-
|
|
109
|
-
export const post_Subscribe = async (request) => {
|
|
110
|
-
const { email } = request.params;
|
|
111
|
-
if (!email) return { error: 'Email is required' };
|
|
112
|
-
|
|
113
|
-
const exists = await Subscriber.exists({ email });
|
|
114
|
-
if (exists) return { error: 'Already subscribed' };
|
|
115
|
-
|
|
116
|
-
await Subscriber.create({ email, subscribed_at: new Date() });
|
|
117
|
-
return { success: true, message: 'Subscribed successfully!' };
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export const get_Subscribers = async (request) => {
|
|
121
|
-
const { page = 1, limit = 20 } = request.params;
|
|
122
|
-
const data = await Subscriber.find()
|
|
123
|
-
.sort({ subscribed_at: -1 })
|
|
124
|
-
.limit(limit)
|
|
125
|
-
.skip((page - 1) * limit)
|
|
126
|
-
.exec();
|
|
127
|
-
const total = await Subscriber.countDocuments();
|
|
128
|
-
return { data, total, page };
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
**Step 3** β Call `update_site_custom_code` to add frontend code:
|
|
133
|
-
|
|
134
|
-
`code_before_head`:
|
|
135
|
-
```html
|
|
136
|
-
<script src="https://cdn.jsdelivr.net/npm/webcake-fn/dist/webcake-fn.umd.min.js"></script>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
`code_custom_javascript`:
|
|
140
|
-
```javascript
|
|
141
|
-
document.getElementById('newsletter-form')?.addEventListener('submit', async (e) => {
|
|
142
|
-
e.preventDefault();
|
|
143
|
-
const email = document.getElementById('newsletter-email').value;
|
|
144
|
-
try {
|
|
145
|
-
const result = await api.post_Subscribe({ email });
|
|
146
|
-
if (result.success) {
|
|
147
|
-
window.useNotification('success', { title: result.message });
|
|
148
|
-
} else {
|
|
149
|
-
window.useNotification('error', { title: result.error });
|
|
150
|
-
}
|
|
151
|
-
} catch (err) {
|
|
152
|
-
window.useNotification('error', { title: 'Error', message: err.message });
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
### Example 2: Batch create blog articles
|
|
160
|
-
|
|
161
|
-
**Prompt:**
|
|
162
|
-
```
|
|
163
|
-
Write 3 blog posts about summer skincare, each 300 words, with SEO-friendly slugs.
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
**AI agent calls `create_article` 3 times:**
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
create_article({
|
|
170
|
-
name: "5 Steps for Summer Skincare",
|
|
171
|
-
slug: "5-steps-summer-skincare",
|
|
172
|
-
content: "<h2>...</h2><p>...</p>",
|
|
173
|
-
tags: ["skincare", "summer"]
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
create_article({
|
|
177
|
-
name: "Sun Protection Done Right",
|
|
178
|
-
slug: "sun-protection-done-right",
|
|
179
|
-
content: "<h2>...</h2><p>...</p>",
|
|
180
|
-
tags: ["skincare", "sunscreen"]
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
create_article({
|
|
184
|
-
name: "Moisturizing Oily Skin",
|
|
185
|
-
slug: "moisturizing-oily-skin",
|
|
186
|
-
content: "<h2>...</h2><p>...</p>",
|
|
187
|
-
tags: ["skincare", "moisturizer"]
|
|
188
|
-
})
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
### Example 3: Debug and test a function
|
|
194
|
-
|
|
195
|
-
**Prompt:**
|
|
196
|
-
```
|
|
197
|
-
Test the get_Subscribers function to see if it works
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
**AI agent calls:**
|
|
201
|
-
```
|
|
202
|
-
run_function({
|
|
203
|
-
function_name: "Subscribers",
|
|
204
|
-
method: "GET",
|
|
205
|
-
params: { page: 1, limit: 5 }
|
|
206
|
-
})
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
Returns the result or error, AI agent reads and explains to the developer.
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
### Example 4: Add custom CSS
|
|
214
|
-
|
|
215
|
-
**Prompt:**
|
|
216
|
-
```
|
|
217
|
-
Add hover effect to all product cards: slight lift with drop shadow.
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
**AI agent calls `update_site_custom_code`:**
|
|
221
|
-
|
|
222
|
-
`code_custom_css`:
|
|
223
|
-
```css
|
|
224
|
-
.product-card {
|
|
225
|
-
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.product-card:hover {
|
|
229
|
-
transform: translateY(-4px);
|
|
230
|
-
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
|
|
231
|
-
}
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
---
|
|
235
|
-
|
|
236
|
-
### Example 5: Find customer and send email
|
|
237
|
-
|
|
238
|
-
**Prompt:**
|
|
239
|
-
```
|
|
240
|
-
Find the customer with email john@example.com and send a thank-you email.
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
**AI agent calls 2 tools:**
|
|
244
|
-
|
|
245
|
-
```
|
|
246
|
-
find_customer({ by: "email", value: "john@example.com" })
|
|
247
|
-
β Found: { name: "John Doe", email: "john@example.com" }
|
|
248
|
-
|
|
249
|
-
send_mail({
|
|
250
|
-
to: "john@example.com",
|
|
251
|
-
subject: "Thank you for your purchase!",
|
|
252
|
-
body: "<h2>Hi John Doe,</h2><p>Thank you for shopping with us...</p>"
|
|
253
|
-
})
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
### Example 6: Find and update page elements
|
|
259
|
-
|
|
260
|
-
**Prompt:**
|
|
261
|
-
```
|
|
262
|
-
Change the hero title color to red and update the CTA button text to "Buy Now"
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
**AI agent calls 3 tools:**
|
|
266
|
-
|
|
267
|
-
```
|
|
268
|
-
# Step 1: Find the hero title
|
|
269
|
-
search_page_elements({ page_id: "page_1", custom_class: "hero-title" })
|
|
270
|
-
β { matched: 1, elements: [{ id: "TEXT-3", type: "text", ... }] }
|
|
271
|
-
|
|
272
|
-
# Step 2: Find the CTA button
|
|
273
|
-
search_page_elements({ page_id: "page_1", custom_class: "cta" })
|
|
274
|
-
β { matched: 1, elements: [{ id: "BUTTON-1", type: "button", ... }] }
|
|
275
|
-
|
|
276
|
-
# Step 3: Update both elements at once
|
|
277
|
-
update_page_elements({
|
|
278
|
-
page_id: "page_1",
|
|
279
|
-
updates: [
|
|
280
|
-
{ element_id: "TEXT-3", style: { "color": "#ff0000" } },
|
|
281
|
-
{ element_id: "BUTTON-1", specials: { "text": "Buy Now" } }
|
|
282
|
-
]
|
|
283
|
-
})
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## Detailed Tool Usage Guide
|
|
289
|
-
|
|
290
|
-
All tools are designed with **token optimization** in mind β list tools return lightweight metadata, detail tools return full data, and guides are loaded on-demand. This section explains the optimal workflow for each tool group.
|
|
291
|
-
|
|
292
|
-
### CMS Files & HTTP Functions
|
|
293
|
-
|
|
294
|
-
#### Step 1: Get overview β `get_http_function` (default: overview mode)
|
|
295
|
-
|
|
296
|
-
By default, returns **only function names and line ranges** β no code body. Very token-efficient for large files.
|
|
297
|
-
|
|
298
|
-
```
|
|
299
|
-
# First time β overview + guide + schemas
|
|
300
|
-
get_http_function({ include_guide: true })
|
|
301
|
-
β {
|
|
302
|
-
file_id: "file_123",
|
|
303
|
-
total_lines: 250,
|
|
304
|
-
imports: "import { DBConnection } from 'webcake-data';",
|
|
305
|
-
functions: [
|
|
306
|
-
{ name: "get_Products", method: "get", function_name: "Products", start_line: 5, end_line: 35, lines: 31 },
|
|
307
|
-
{ name: "post_CreateOrder", method: "post", function_name: "CreateOrder", start_line: 37, end_line: 120, lines: 84 },
|
|
308
|
-
...
|
|
309
|
-
],
|
|
310
|
-
collections: [...],
|
|
311
|
-
guide: "..."
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
# Subsequent calls β overview only
|
|
315
|
-
get_http_function({})
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
To get the full file (when really needed): `get_http_function({ overview: false })`
|
|
319
|
-
|
|
320
|
-
#### Step 2: Read specific functions β `get_http_function_snippet`
|
|
321
|
-
|
|
322
|
-
Read only the function(s) you need β saves 80-95% tokens vs reading the full file.
|
|
323
|
-
|
|
324
|
-
```
|
|
325
|
-
get_http_function_snippet({ function_names: ["get_Products"] })
|
|
326
|
-
β {
|
|
327
|
-
functions: [{
|
|
328
|
-
name: "get_Products", method: "get", function_name: "Products",
|
|
329
|
-
start_line: 5, end_line: 35,
|
|
330
|
-
code: "export const get_Products = (request) => {\n ..."
|
|
331
|
-
}]
|
|
332
|
-
}
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
#### Step 3: Edit by function name β `edit_http_function`
|
|
336
|
-
|
|
337
|
-
Edit functions by **name** β server finds function boundaries automatically. No fragile string matching.
|
|
338
|
-
|
|
339
|
-
```
|
|
340
|
-
# Replace entire function by name (server finds where it starts/ends)
|
|
341
|
-
edit_http_function({
|
|
342
|
-
action: "replace_function",
|
|
343
|
-
function_name: "get_Products",
|
|
344
|
-
code: "export const get_Products = (request) => {\n const db = new DBConnection();\n return db.model('products').find().limit(20).exec();\n}"
|
|
345
|
-
})
|
|
346
|
-
|
|
347
|
-
# Add a new function at end of file
|
|
348
|
-
edit_http_function({
|
|
349
|
-
action: "add",
|
|
350
|
-
code: "export const get_Stats = (request) => {\n return { count: 42 };\n}"
|
|
351
|
-
})
|
|
352
|
-
|
|
353
|
-
# Remove a function by name
|
|
354
|
-
edit_http_function({ action: "remove", function_name: "get_OldFunction" })
|
|
355
|
-
|
|
356
|
-
# Update import block
|
|
357
|
-
edit_http_function({
|
|
358
|
-
action: "update_imports",
|
|
359
|
-
code: "import { DBConnection } from 'webcake-data';\nimport { findArticle } from '@webcake/article';"
|
|
360
|
-
})
|
|
361
|
-
β { success: true, total_lines: 245, functions: [...] }
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
#### Full rewrite (when needed) β `update_http_function`
|
|
365
|
-
|
|
366
|
-
Send full file content. Use `edit_http_function` for targeted changes instead.
|
|
367
|
-
|
|
368
|
-
```
|
|
369
|
-
update_http_function({ content: "import { DBConnection } from 'webcake-data';\n..." })
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
#### Testing β `debug_function` vs `run_function`
|
|
373
|
-
|
|
374
|
-
| Tool | When to use |
|
|
375
|
-
|------|-------------|
|
|
376
|
-
| `debug_function` | Test code **before deploying** β send code directly, get result + logs |
|
|
377
|
-
| `run_function` | Call an **already deployed** function β like calling a REST API |
|
|
378
|
-
|
|
379
|
-
```
|
|
380
|
-
# Debug: test code without saving
|
|
381
|
-
debug_function({
|
|
382
|
-
content: "export const get_Test = (request) => { return { hello: 'world' }; }",
|
|
383
|
-
function_name: "Test",
|
|
384
|
-
params: {}
|
|
385
|
-
})
|
|
386
|
-
|
|
387
|
-
# Run: call deployed function (note: function_name excludes method prefix)
|
|
388
|
-
run_function({ function_name: "Products", method: "GET", params: { page: 1 } })
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
#### Version management β `save_file_version` / `get_file_versions`
|
|
392
|
-
|
|
393
|
-
Save a snapshot before major changes for rollback capability:
|
|
394
|
-
|
|
395
|
-
```
|
|
396
|
-
save_file_version({ cms_file_id: "file_123", content: "...", is_public: false })
|
|
397
|
-
get_file_versions({ cms_file_id: "file_123" })
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
---
|
|
401
|
-
|
|
402
|
-
### Pages & Custom Code
|
|
403
|
-
|
|
404
|
-
#### Step 1: List pages β `list_pages`
|
|
405
|
-
|
|
406
|
-
Returns **metadata only** (no source data) β id, name, slug, type, is_homepage, updated_at.
|
|
407
|
-
|
|
408
|
-
```
|
|
409
|
-
list_pages({})
|
|
410
|
-
β [{ id: "page_1", name: "Home", slug: "/", type: "page", is_homepage: true, ... }, ...]
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
#### Step 2: Get page overview β `get_page_source`
|
|
414
|
-
|
|
415
|
-
Returns a **lightweight overview** of the page structure β section count, element type counts, and all custom CSS classes used. Does NOT return full source data.
|
|
416
|
-
|
|
417
|
-
```
|
|
418
|
-
get_page_source({ page_id: "page_1" })
|
|
419
|
-
β {
|
|
420
|
-
page: { id, name, slug, type },
|
|
421
|
-
custom_code: { ... },
|
|
422
|
-
overview: {
|
|
423
|
-
sections_count: 5,
|
|
424
|
-
total_elements: 47,
|
|
425
|
-
element_types: { section: 5, container: 12, text: 15, image: 8, button: 7 },
|
|
426
|
-
custom_classes: ["hero-title", "product-card", "cta-button", ...]
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
#### Step 3: Search specific elements β `search_page_elements`
|
|
432
|
-
|
|
433
|
-
Query elements by various filters. Returns **full detail** for each matched element (style, config, specials, events, bindings, responsive breakpoints).
|
|
434
|
-
|
|
435
|
-
```
|
|
436
|
-
# Find all buttons
|
|
437
|
-
search_page_elements({ page_id: "page_1", type: "button" })
|
|
438
|
-
|
|
439
|
-
# Find elements with a specific CSS class
|
|
440
|
-
search_page_elements({ page_id: "page_1", custom_class: "hero" })
|
|
441
|
-
|
|
442
|
-
# Find text containing "subscribe"
|
|
443
|
-
search_page_elements({ page_id: "page_1", text: "subscribe" })
|
|
444
|
-
|
|
445
|
-
# Find all data-bound elements (product, category, blog bindings)
|
|
446
|
-
search_page_elements({ page_id: "page_1", has_bind: true })
|
|
447
|
-
|
|
448
|
-
# Find all elements with click/submit events
|
|
449
|
-
search_page_elements({ page_id: "page_1", has_events: true })
|
|
450
|
-
|
|
451
|
-
# Find all elements that have custom CSS classes
|
|
452
|
-
search_page_elements({ page_id: "page_1", has_custom_class: true })
|
|
453
|
-
|
|
454
|
-
# Combine filters
|
|
455
|
-
search_page_elements({ page_id: "page_1", type: "text", custom_class: "hero", limit: 10 })
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
Each matched element returns:
|
|
459
|
-
|
|
460
|
-
```json
|
|
461
|
-
{
|
|
462
|
-
"id": "TEXT-3",
|
|
463
|
-
"type": "text",
|
|
464
|
-
"style": { "color": "#333", "font-size": "18px", ... },
|
|
465
|
-
"config": { ... },
|
|
466
|
-
"specials": { "text": "Subscribe now", "custom_class": "cta-text", "custom_css": "..." },
|
|
467
|
-
"events": [{ "eventName": "click", "action": "open_page", ... }],
|
|
468
|
-
"bindings": [{ "name": "product", "target": "title", ... }],
|
|
469
|
-
"responsive": {
|
|
470
|
-
"bp_320_768": { "style": { "font-size": "14px" } },
|
|
471
|
-
"bp_768_1024": { "style": { "font-size": "16px" } }
|
|
472
|
-
},
|
|
473
|
-
"children_count": 3
|
|
474
|
-
}
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
**CSS targeting**: Sections render as `<section id="SECTION-1" class="x-section {custom_class}">`, elements as `<div id="TEXT-3" class="x-element {custom_class}">`. Target via `#TEXT-3` (by ID) or `.cta-text` (by custom class).
|
|
478
|
-
|
|
479
|
-
#### Custom code β `get_site_custom_code` / `append_site_custom_code`
|
|
480
|
-
|
|
481
|
-
**Read specific fields only** to save tokens when code is large:
|
|
482
|
-
|
|
483
|
-
```
|
|
484
|
-
# Read only CSS (skip large JS)
|
|
485
|
-
get_site_custom_code({ fields: ["code_custom_css"] })
|
|
486
|
-
β { code_custom_css: ".hero { color: #333; ... }" }
|
|
487
|
-
|
|
488
|
-
# Read all β _sizes shows character count per field
|
|
489
|
-
get_site_custom_code({ include_guide: true })
|
|
490
|
-
β { ..., _sizes: { code_custom_css: 3500, code_custom_javascript: 8200, ... }, guide: "..." }
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
**Add new code** β append/prepend without reading existing content:
|
|
494
|
-
|
|
495
|
-
```
|
|
496
|
-
# Append new CSS rules
|
|
497
|
-
append_site_custom_code({ field: "code_custom_css", code: ".new-section { padding: 20px; }" })
|
|
498
|
-
|
|
499
|
-
# Prepend a script tag to head
|
|
500
|
-
append_site_custom_code({ field: "code_before_head", position: "prepend",
|
|
501
|
-
code: "<script src='https://cdn.example.com/lib.js'></script>" })
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
**Full update** β read first, then rewrite entire field:
|
|
505
|
-
```
|
|
506
|
-
get_site_custom_code({ fields: ["code_custom_css"] }) # read only CSS
|
|
507
|
-
update_site_custom_code({ code_custom_css: ".hero { ... }\n.new-style { ... }" })
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
| Field | Where it's injected | Use for |
|
|
511
|
-
|-------|-------------------|---------|
|
|
512
|
-
| `code_before_head` | Before `</head>` | External scripts, meta tags |
|
|
513
|
-
| `code_before_body` | Before `</body>` | Tracking scripts, chat widgets |
|
|
514
|
-
| `code_custom_css` | Auto-wrapped in `<style>` | Custom CSS styles |
|
|
515
|
-
| `code_custom_javascript` | As inline `<script>` | Custom JavaScript |
|
|
516
|
-
|
|
517
|
-
#### Step 4: Update elements β `update_page_element` / `update_page_elements`
|
|
518
|
-
|
|
519
|
-
After finding elements via search, update their properties directly in the page source.
|
|
520
|
-
|
|
521
|
-
**Single element update:**
|
|
522
|
-
```
|
|
523
|
-
# Change text and style of a specific element
|
|
524
|
-
update_page_element({
|
|
525
|
-
page_id: "page_1",
|
|
526
|
-
element_id: "TEXT-3",
|
|
527
|
-
style: { "color": "#ff0000", "font-size": "24px" },
|
|
528
|
-
specials: { "text": "New heading text", "custom_class": "hero-title,bold" }
|
|
529
|
-
})
|
|
530
|
-
|
|
531
|
-
# Add events to a button
|
|
532
|
-
update_page_element({
|
|
533
|
-
page_id: "page_1",
|
|
534
|
-
element_id: "BUTTON-1",
|
|
535
|
-
events: [{ "eventName": "click", "action": "open_page", "open_page_id": "page_2" }]
|
|
536
|
-
})
|
|
537
|
-
|
|
538
|
-
# Update responsive styles
|
|
539
|
-
update_page_element({
|
|
540
|
-
page_id: "page_1",
|
|
541
|
-
element_id: "TEXT-3",
|
|
542
|
-
responsive: {
|
|
543
|
-
"bp_320_768": { "style": { "font-size": "14px" } },
|
|
544
|
-
"bp_768_1024": { "style": { "font-size": "18px" } }
|
|
545
|
-
}
|
|
546
|
-
})
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
**Batch update multiple elements at once:**
|
|
550
|
-
```
|
|
551
|
-
update_page_elements({
|
|
552
|
-
page_id: "page_1",
|
|
553
|
-
updates: [
|
|
554
|
-
{ element_id: "TEXT-1", specials: { "text": "Welcome" } },
|
|
555
|
-
{ element_id: "TEXT-2", style: { "color": "#333" } },
|
|
556
|
-
{ element_id: "BUTTON-1", specials: { "custom_class": "cta-primary" } }
|
|
557
|
-
]
|
|
558
|
-
})
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
**Merge rules:**
|
|
562
|
-
| Property | Behavior | Example |
|
|
563
|
-
|----------|----------|---------|
|
|
564
|
-
| `style` | Shallow merge | Only changed CSS properties are updated, others kept |
|
|
565
|
-
| `config` | Shallow merge | Same as style |
|
|
566
|
-
| `specials` | Shallow merge | Update `text`, `custom_class`, `custom_css` individually |
|
|
567
|
-
| `events` | Replace | Entire events array is replaced (get current first) |
|
|
568
|
-
| `bindings` | Replace | Entire bindings array is replaced |
|
|
569
|
-
| `responsive` | Merge by breakpoint | Each `bp_*` key is set/replaced individually |
|
|
570
|
-
|
|
571
|
-
#### Get single element detail β `get_page_element`
|
|
572
|
-
|
|
573
|
-
Get full detail of one element by its ID, including children IDs for tree navigation.
|
|
574
|
-
|
|
575
|
-
```
|
|
576
|
-
get_page_element({ page_id: "page_1", element_id: "SECTION-1" })
|
|
577
|
-
β { id: "SECTION-1", type: "section", style: {...}, specials: {...},
|
|
578
|
-
children: [{ id: "CONTAINER-1", type: "container" }, { id: "TEXT-1", type: "text" }] }
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
#### Custom code β `get_site_custom_code` / `update_site_custom_code`
|
|
582
|
-
|
|
583
|
-
**Always read before writing** to avoid overwriting existing code.
|
|
584
|
-
|
|
585
|
-
On the **first call**, set `include_guide=true` to get the coding guide (~400 tokens). Omit on subsequent calls.
|
|
586
|
-
|
|
587
|
-
```
|
|
588
|
-
# First time β read current code + guide
|
|
589
|
-
get_site_custom_code({ include_guide: true })
|
|
590
|
-
β {
|
|
591
|
-
code_before_head: "<script src='...'>",
|
|
592
|
-
code_before_body: "",
|
|
593
|
-
code_custom_css: ".hero { ... }",
|
|
594
|
-
code_custom_javascript: "document.addEventListener(...)",
|
|
595
|
-
guide: "..."
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
# Update β only send the fields you want to change
|
|
599
|
-
update_site_custom_code({ code_custom_css: ".hero { ... }\n.new-style { ... }" })
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
| Field | Where it's injected | Use for |
|
|
603
|
-
|-------|-------------------|---------|
|
|
604
|
-
| `code_before_head` | Before `</head>` | External scripts, meta tags |
|
|
605
|
-
| `code_before_body` | Before `</body>` | Tracking scripts, chat widgets |
|
|
606
|
-
| `code_custom_css` | Auto-wrapped in `<style>` | Custom CSS styles |
|
|
607
|
-
| `code_custom_javascript` | As inline `<script>` | Custom JavaScript |
|
|
608
|
-
|
|
609
|
-
#### Recommended workflows
|
|
610
|
-
|
|
611
|
-
**CSS/JS tasks:**
|
|
612
|
-
```
|
|
613
|
-
1. list_pages() β find the target page
|
|
614
|
-
2. get_page_source({ page_id }) β understand page structure
|
|
615
|
-
3. search_page_elements({ page_id, ... }) β find specific elements to style
|
|
616
|
-
4. get_site_custom_code({ include_guide: true }) β read existing code
|
|
617
|
-
5. update_site_custom_code({ ... }) β write new code (merged with existing)
|
|
618
|
-
```
|
|
619
|
-
|
|
620
|
-
**Direct element modification:**
|
|
621
|
-
```
|
|
622
|
-
1. list_pages() β find the target page
|
|
623
|
-
2. get_page_source({ page_id }) β overview of elements
|
|
624
|
-
3. search_page_elements({ page_id, ... }) β find elements to modify
|
|
625
|
-
4. update_page_element({ page_id, element_id, ... }) β update properties
|
|
626
|
-
or update_page_elements({ page_id, updates: [...] }) β batch update
|
|
627
|
-
```
|
|
16
|
+
β¦and a real, **editable** page appears on your WebCake/StoreCake site. No dragging blocks, no learning the schema, no hand-writing JSON.
|
|
628
17
|
|
|
629
18
|
---
|
|
630
19
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
#### List collections β `list_collections`
|
|
20
|
+
## π§© How it works
|
|
634
21
|
|
|
635
|
-
|
|
22
|
+
This server is the **bridge** between your AI assistant and your storefront. The AI never *guesses* what a
|
|
23
|
+
page looks like β it asks this MCP, which knows the entire BuilderX component model, validates the result, and saves it.
|
|
636
24
|
|
|
637
|
-
```
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
total: 8
|
|
646
|
-
}
|
|
25
|
+
```text
|
|
26
|
+
You AI assistant webcake-storefront MCP WebCake / StoreCake
|
|
27
|
+
ββββββββ prompt ββββββββββββββ tools βββββββββββββββββββββββββ API ββββββββββββ
|
|
28
|
+
β idea β ββββββββΊ β Claude / β ββββββΊ β β’ knows the BuilderX β ββββΊ β a real β
|
|
29
|
+
β β β Cursor / β β component model β β editable β
|
|
30
|
+
β β ββββββββ β Windsurf β ββββββ β β’ builds + validates β ββββ β page on β
|
|
31
|
+
ββββββββ live URL ββββββββββββββ result β β’ saves + publishes β β your siteβ
|
|
32
|
+
βββββββββββββββββββββββββ ββββββββββββ
|
|
647
33
|
```
|
|
648
34
|
|
|
649
|
-
|
|
35
|
+
1. **You ask** in plain language β goal, brand, sections, products, form fields.
|
|
36
|
+
2. **The AI learns the model** from the MCP: the element catalog, the CSS-grid layout, the breakpoints β so it builds a *real* storefront page, not a guess.
|
|
37
|
+
3. **It assembles + validates** the `{ sections: [...] }` page source. `validate_page` catches duplicate ids, broken grids, and form fields without a name **before** anything is saved.
|
|
38
|
+
4. **It saves** to your site β dry-run preview first, then for real β and `publish_site` makes it live.
|
|
39
|
+
5. **You get the preview URL** β open it, tweak in the editor, done.
|
|
650
40
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
```
|
|
654
|
-
get_collection({ id: "col_1" })
|
|
655
|
-
β { name: "Subscribers", table_name: "subscribers", schema: [
|
|
656
|
-
{ name: "email", type: "string", is_required: true },
|
|
657
|
-
{ name: "subscribed_at", type: "datetime", is_required: false },
|
|
658
|
-
...
|
|
659
|
-
]}
|
|
660
|
-
```
|
|
41
|
+
### Why it's reliable
|
|
661
42
|
|
|
662
|
-
|
|
43
|
+
| | |
|
|
44
|
+
|---|---|
|
|
45
|
+
| π **Knows the real model** | Serves 130+ BuilderX component types (text, image, button, form, product grid, cart, countdown, galleryβ¦) ported **straight from the builder's own factory** β the exact same shapes the editor produces. |
|
|
46
|
+
| β
**Validates before saving** | Structural checks (unique ids, valid grid, form fields with names, working event targets) so the page isn't broken when it lands. |
|
|
47
|
+
| π‘οΈ **Safe by default** | Every write is **dry-run first** β preview the change, nothing touches your site until you confirm. |
|
|
48
|
+
| βοΈ **Edits surgically** | Ask for one change ("make the CTA green") and it edits *only* that element β every other id, style, and block stays exactly as it was. |
|
|
663
49
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
```
|
|
667
|
-
query_collection_records({ table_name: "subscribers", page: 1, limit: 10 })
|
|
668
|
-
```
|
|
50
|
+
> π‘ Selling **COD or online**? It speaks the full commerce model too β products, variations, cart, orders, promotions, combos.
|
|
669
51
|
|
|
670
52
|
---
|
|
671
53
|
|
|
672
|
-
|
|
54
|
+
## β¨ What you can build
|
|
673
55
|
|
|
674
|
-
|
|
56
|
+
One sentence to your AI β a finished, **editable** storefront page:
|
|
675
57
|
|
|
676
|
-
|
|
58
|
+
| | Just say⦠|
|
|
59
|
+
|---|---|
|
|
60
|
+
| π **Product page** | *"A one-product page for my skincare serum β gallery, price, an order form with cart."* |
|
|
61
|
+
| π¬ **Storefront home** | *"A homepage β hero banner, featured product grid, a newsletter form."* |
|
|
62
|
+
| β‘ **Flash sale** | *"A flash-sale page β big countdown, discounted product grid, a sticky Buy button."* |
|
|
63
|
+
| ποΈ **Event / webinar** | *"A registration page β countdown, agenda, a sign-up form."* |
|
|
64
|
+
| π **Invitation** | *"A wedding invite β names, date, a map, an RSVP form."* |
|
|
65
|
+
| π° **Blog / content** | *"A blog index with featured posts and a subscribe box."* |
|
|
66
|
+
| π **Link-in-bio** | *"A link-in-bio β avatar, short bio, 5 link buttons, socials."* |
|
|
677
67
|
|
|
678
|
-
|
|
679
|
-
list_articles({ page: 1, limit: 20 })
|
|
680
|
-
β {
|
|
681
|
-
data: [
|
|
682
|
-
{ id: "art_1", name: "Getting Started", slug: "getting-started", summary: "...",
|
|
683
|
-
tags: ["tutorial"], category_id: "cat_1", created_at: "...", updated_at: "..." },
|
|
684
|
-
...
|
|
685
|
-
],
|
|
686
|
-
total: 45
|
|
687
|
-
}
|
|
688
|
-
```
|
|
68
|
+
β¦then **"make the CTA green"** or **"add a 4th feature"** and it edits *only* that block.
|
|
689
69
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
Use this when you need the full HTML content of a specific article.
|
|
693
|
-
|
|
694
|
-
```
|
|
695
|
-
get_article({ id: "art_1" })
|
|
696
|
-
β { id: "art_1", name: "...", content: "<h2>...</h2><p>Full HTML content...</p>", ... }
|
|
697
|
-
```
|
|
70
|
+
> π€ Works in **Claude Desktop, Claude Code, Cursor, Windsurf, VS Code**, or any MCP-capable client β and the **build guide + element catalog tools need zero backend calls**, so you can explore the model before pasting a token.
|
|
698
71
|
|
|
699
72
|
---
|
|
700
73
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
#### List products β `list_products`
|
|
704
|
-
|
|
705
|
-
Returns **metadata only** β id, name, slug, price, image, status. No full description or variations.
|
|
706
|
-
|
|
707
|
-
```
|
|
708
|
-
list_products({ page: 1, limit: 20, term: "shirt" })
|
|
709
|
-
β {
|
|
710
|
-
data: [
|
|
711
|
-
{ id: "prod_1", name: "Blue Shirt", slug: "blue-shirt", price: 29.99,
|
|
712
|
-
image: "https://...", is_published: true, total_sold: 150, ... },
|
|
713
|
-
...
|
|
714
|
-
],
|
|
715
|
-
total: 42
|
|
716
|
-
}
|
|
717
|
-
```
|
|
718
|
-
|
|
719
|
-
#### Get full product β `get_product`
|
|
720
|
-
|
|
721
|
-
Returns complete product data: description, variations (sizes/colors/prices), attributes, images, SEO meta.
|
|
722
|
-
|
|
723
|
-
```
|
|
724
|
-
get_product({ id: "prod_1" })
|
|
725
|
-
β { id: "prod_1", name: "Blue Shirt", description: "<p>...</p>",
|
|
726
|
-
variations: [...], product_attributes: [...], meta_tags: [...], ... }
|
|
727
|
-
```
|
|
728
|
-
|
|
729
|
-
#### Search products β `search_products`
|
|
730
|
-
|
|
731
|
-
Quick keyword search across product names.
|
|
732
|
-
|
|
733
|
-
```
|
|
734
|
-
search_products({ term: "summer dress", limit: 10 })
|
|
735
|
-
```
|
|
736
|
-
|
|
737
|
-
#### Product categories β `list_categories`
|
|
738
|
-
|
|
739
|
-
List all product categories of the site.
|
|
740
|
-
|
|
741
|
-
```
|
|
742
|
-
list_categories({})
|
|
743
|
-
β [{ id: "cat_1", name: "Shirts", slug: "shirts", ... }, ...]
|
|
744
|
-
```
|
|
745
|
-
|
|
746
|
-
---
|
|
747
|
-
|
|
748
|
-
### Orders
|
|
749
|
-
|
|
750
|
-
#### List orders β `list_orders`
|
|
751
|
-
|
|
752
|
-
Returns order **metadata only** β customer name, status, total value. No item details.
|
|
753
|
-
|
|
754
|
-
```
|
|
755
|
-
list_orders({ page: 1, limit: 20, status: 50 })
|
|
756
|
-
β {
|
|
757
|
-
data: [
|
|
758
|
-
{ id: "ord_1", bill_full_name: "John Doe", status: 50,
|
|
759
|
-
invoice_value: 99.99, items_count: 3, created_at: "..." },
|
|
760
|
-
...
|
|
761
|
-
],
|
|
762
|
-
total: 128
|
|
763
|
-
}
|
|
764
|
-
```
|
|
765
|
-
|
|
766
|
-
**Status codes:** 0=pending, 50=confirmed, 100=shipping, 150=delivered, -1=cancelled
|
|
74
|
+
## Under the hood
|
|
767
75
|
|
|
768
|
-
|
|
76
|
+
An MCP (Model Context Protocol) server that teaches AI agents the **WebCake/StoreCake storefront builder
|
|
77
|
+
(BuilderX) component model** and connects them to the backend. The AI produces the full `{ sections: [...] }`
|
|
78
|
+
page source; `build_page` creates the page and saves it, and `publish_site` makes the whole site live.
|
|
769
79
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
```
|
|
773
|
-
get_order({ id: "ord_1" })
|
|
774
|
-
β { id: "ord_1", bill_full_name: "John Doe", items: [...], shipping_address: {...}, ... }
|
|
775
|
-
```
|
|
80
|
+
Beyond page authoring, it exposes your real store: pages & custom code, products, orders, collections,
|
|
81
|
+
blog articles, promotions, combos, themes, customers, and automation β **~101 tools** in total.
|
|
776
82
|
|
|
777
|
-
|
|
83
|
+
| Method | Best for | Auth |
|
|
84
|
+
|--------|----------|------|
|
|
85
|
+
| **npx (local)** β runs on your machine | Personal daily use, full control | browser `login`, or a token + session |
|
|
86
|
+
| **Remote (`serve`)** β self-host Streamable-HTTP | Teams, the claude.ai dialog, always-on | `?jwt=` link / `x-webcake-jwt` header |
|
|
778
87
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
```
|
|
782
|
-
count_orders_by_status({})
|
|
783
|
-
β { pending: 5, confirmed: 12, shipping: 3, delivered: 108, cancelled: 2 }
|
|
784
|
-
```
|
|
88
|
+
The **build + catalog tools** (`get_build_guide`, `list_elements`, `get_element`, `new_section`,
|
|
89
|
+
`validate_page`) work with **zero config**; everything that reads or writes your site needs a token + session.
|
|
785
90
|
|
|
786
91
|
---
|
|
787
92
|
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
#### List promotions β `list_promotions`
|
|
791
|
-
|
|
792
|
-
Returns promotion **metadata only** β name, type, status, schedule. Use `include_guide=true` for promotion type reference.
|
|
793
|
-
|
|
794
|
-
```
|
|
795
|
-
list_promotions({ page: 1, limit: 20, include_guide: true })
|
|
796
|
-
β {
|
|
797
|
-
data: [
|
|
798
|
-
{ id: "promo_1", name: "Summer Sale 30%", type: "normal",
|
|
799
|
-
is_activated: true, start_time: "2025-06-01", end_time: "2025-06-30",
|
|
800
|
-
priority_level: 1, used_count: 45 },
|
|
801
|
-
{ id: "promo_2", name: "WELCOME10", type: "coupon",
|
|
802
|
-
is_activated: true, coupon_info: { code: "WELCOME10", max_uses: 100 } },
|
|
803
|
-
...
|
|
804
|
-
],
|
|
805
|
-
total: 8,
|
|
806
|
-
guide: "## Promotion Types..."
|
|
807
|
-
}
|
|
808
|
-
```
|
|
809
|
-
|
|
810
|
-
#### Get full promotion β `get_promotion`
|
|
811
|
-
|
|
812
|
-
Returns complete promotion: discount rules, coupon settings, items, bonus products, customer levels.
|
|
813
|
-
|
|
814
|
-
```
|
|
815
|
-
get_promotion({ id: "promo_1" })
|
|
816
|
-
β { id: "promo_1", name: "Summer Sale 30%", type: "normal", items: [...],
|
|
817
|
-
bonus_items: [...], customer_levels: [...], ... }
|
|
818
|
-
```
|
|
819
|
-
|
|
820
|
-
#### Get promotion items β `get_promotion_items`
|
|
821
|
-
|
|
822
|
-
Returns products/variations/categories attached to a promotion with detailed discount info.
|
|
93
|
+
## π Get connected
|
|
823
94
|
|
|
824
|
-
|
|
825
|
-
get_promotion_items({ id: "promo_1", page: 1, limit: 20 })
|
|
826
|
-
β { items: [{ id: "item_1", product: { name: "..." }, fixed_prices: 299000,
|
|
827
|
-
level_info: [...] }], total_items: 15 }
|
|
828
|
-
```
|
|
829
|
-
|
|
830
|
-
#### Active promotions β `get_active_promotions`
|
|
95
|
+
Pick **one**. Both hand your AI tool the full storefront toolkit. No coding.
|
|
831
96
|
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
```
|
|
835
|
-
get_active_promotions({})
|
|
836
|
-
β { data: [{ id: "promo_1", name: "Summer Sale", type: "normal", is_activated: true, ... }], total: 3 }
|
|
837
|
-
```
|
|
838
|
-
|
|
839
|
-
#### Search/filter promotions β `search_promotions`
|
|
840
|
-
|
|
841
|
-
Filter by type, time status, keyword, active state.
|
|
842
|
-
|
|
843
|
-
```
|
|
844
|
-
search_promotions({ type: "coupon", status: 2, is_activated: true })
|
|
845
|
-
β { promotions: [...], total: 5 }
|
|
846
|
-
```
|
|
97
|
+
### β `npx` β runs on your machine (recommended)
|
|
847
98
|
|
|
848
|
-
|
|
99
|
+
Zero install, always the latest version, needs Node.js 18+. **One line** configures your IDE:
|
|
849
100
|
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
#### List combos β `list_combos`
|
|
101
|
+
```bash
|
|
102
|
+
# Interactive β pick your IDE(s) and paste your credentials
|
|
103
|
+
npx -y webcake-storefront-mcp install
|
|
855
104
|
|
|
856
|
-
|
|
105
|
+
# Non-interactive β configure every supported IDE at once
|
|
106
|
+
npx -y webcake-storefront-mcp install --ide all --token <token> --session <session-id>
|
|
857
107
|
|
|
108
|
+
# Remove the server from every IDE config
|
|
109
|
+
npx -y webcake-storefront-mcp uninstall
|
|
858
110
|
```
|
|
859
|
-
list_combos({ page: 1, limit: 20, include_guide: true })
|
|
860
|
-
β {
|
|
861
|
-
data: [
|
|
862
|
-
{ id: "combo_1", name: "Summer Bundle", is_activated: true,
|
|
863
|
-
is_variation: false, discount_amount: 50000,
|
|
864
|
-
start_time: "2025-06-01", end_time: "2025-06-30" },
|
|
865
|
-
{ id: "combo_2", name: "Buy 3 Get 1 Free", is_activated: true,
|
|
866
|
-
is_categories: true, is_use_percent: true, discount_by_percent: 25 },
|
|
867
|
-
],
|
|
868
|
-
total: 4,
|
|
869
|
-
guide: "## Combo Product Types..."
|
|
870
|
-
}
|
|
871
|
-
```
|
|
872
|
-
|
|
873
|
-
**Combo types:**
|
|
874
|
-
- `is_variation=true` β Variation-based: requires specific product variations
|
|
875
|
-
- `is_variation=false` β Product-based: requires specific products (any variation)
|
|
876
|
-
- `is_categories=true` β Category-based: requires items from categories with quantities
|
|
877
|
-
|
|
878
|
-
**Discount types:**
|
|
879
|
-
- `discount_amount` β Fixed amount off
|
|
880
|
-
- `is_use_percent=true` + `discount_by_percent` β Percentage off (capped by `max_discount_by_percent`)
|
|
881
|
-
- `is_value_combo=true` + `value_combo` β Fixed total price for combo
|
|
882
|
-
- `is_free_shipping=true` β Free shipping included
|
|
883
111
|
|
|
884
|
-
|
|
112
|
+
Targets: `claude-desktop`, `claude-code`, `cursor`, `windsurf`, `vscode`, or `all`.
|
|
113
|
+
Just want to run the server (configure by hand)? `npx -y webcake-storefront-mcp`.
|
|
885
114
|
|
|
886
|
-
|
|
115
|
+
### β‘ Browser login β no token copy/paste
|
|
887
116
|
|
|
117
|
+
```bash
|
|
118
|
+
npx -y webcake-storefront-mcp login
|
|
888
119
|
```
|
|
889
|
-
get_combo_items({ combo_product_id: "combo_1" })
|
|
890
|
-
β {
|
|
891
|
-
combo_items: [
|
|
892
|
-
{ id: "item_1", product: { name: "T-Shirt" }, count: 2 },
|
|
893
|
-
{ id: "item_2", product: { name: "Shorts" }, count: 1 },
|
|
894
|
-
],
|
|
895
|
-
bonus_items: [
|
|
896
|
-
{ id: "bonus_1", product: { name: "Free Socks" }, quantity: 1 }
|
|
897
|
-
]
|
|
898
|
-
}
|
|
899
|
-
```
|
|
900
|
-
|
|
901
|
-
---
|
|
902
120
|
|
|
903
|
-
|
|
121
|
+
Opens the builder's **connect page**; click *Connect* and your token + session are saved locally and picked up automatically.
|
|
904
122
|
|
|
905
|
-
|
|
123
|
+
### Remote URL β self-hosted, nothing per-client to install
|
|
906
124
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
```
|
|
910
|
-
get_site_info({})
|
|
911
|
-
β { id: "site_1", name: "My Store", domain: "mystore.storecake.io",
|
|
912
|
-
settings: { primary_colors: [...], typography: {...}, layout_mode: "...", ... } }
|
|
125
|
+
```bash
|
|
126
|
+
npx -y webcake-storefront-mcp serve --port 8787
|
|
913
127
|
```
|
|
914
128
|
|
|
915
|
-
|
|
129
|
+
Then point any client at `http://<host>:8787/mcp?jwt=<TOKEN>` (clients that support headers can send
|
|
130
|
+
`x-webcake-jwt` instead; pick the site in chat with `switch_site`). Server-side secrets like `PEXELS_API_KEY`
|
|
131
|
+
live on the host β handy on a VPS.
|
|
916
132
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
```
|
|
920
|
-
list_themes({})
|
|
921
|
-
β [{ id: "theme_1", name: "Modern", colors: {...}, typographies: {...}, is_selected: true }, ...]
|
|
922
|
-
```
|
|
133
|
+
> β οΈ A `?jwt=` link contains your personal token β treat it like a password and use **HTTPS** in production.
|
|
923
134
|
|
|
924
135
|
---
|
|
925
136
|
|
|
926
|
-
|
|
137
|
+
## βοΈ Configuration
|
|
927
138
|
|
|
928
|
-
|
|
139
|
+
Two values are required: **`WEBCAKE_TOKEN`** (Bearer JWT) and **`WEBCAKE_SESSION_ID`** (sent as
|
|
140
|
+
`x-session-id`). You pick the **site at runtime** β just ask in chat and the AI calls `list_my_sites` /
|
|
141
|
+
`switch_site` (your choice is saved and reused next session), so no `WEBCAKE_SITE_ID` is needed.
|
|
929
142
|
|
|
930
|
-
|
|
143
|
+
Base URLs come from a **named environment** β set `WEBCAKE_ENV` (or `--env`) and you never type a URL:
|
|
931
144
|
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
145
|
+
| `WEBCAKE_ENV` | api | app (login) | preview |
|
|
146
|
+
|---|---|---|---|
|
|
147
|
+
| `local` | `http://localhost:24679` | `http://localhost:5173` | `demo.localhost:24679/<siteId>` |
|
|
148
|
+
| `staging` | `https://api.staging.storecake.io` | `https://staging.webcake.io` | `staging2.webcake.me/<siteId>` |
|
|
149
|
+
| **`prod`** (default) | `https://api.storefront.webcake.io` | `https://webcake.io` | `<site_slug>.webcake.me` |
|
|
936
150
|
|
|
937
|
-
|
|
151
|
+
Override a preset with `WEBCAKE_API_URL` / `WEBCAKE_APP_URL`. Optional, configured server-side:
|
|
152
|
+
`PEXELS_API_KEY` (search_images), `MONGO_URI` (image-alt cache). Token / session / site can also be set
|
|
153
|
+
in chat via `update_auth` and `switch_site` β saved to a local SQLite db at `~/.webcake-storefront-mcp/`.
|
|
938
154
|
|
|
939
|
-
|
|
155
|
+
<details>
|
|
156
|
+
<summary><b>How to get your token + session</b></summary>
|
|
940
157
|
|
|
941
|
-
|
|
158
|
+
1. Open the WebCake builder and log in.
|
|
159
|
+
2. Open DevTools (`F12`) β **Network** tab β click any API request.
|
|
160
|
+
3. In **Request Headers**: `Authorization: Bearer β¦` β `WEBCAKE_TOKEN`; `x-session-id: β¦` β `WEBCAKE_SESSION_ID`.
|
|
161
|
+
4. No site id needed up front β in chat, run `list_my_sites` then `switch_site` to choose the site (remembered next time).
|
|
942
162
|
|
|
943
|
-
|
|
944
|
-
get_app({ type: "1" })
|
|
945
|
-
β { id: "app_1", type: 1, is_active: true, settings: {...} }
|
|
946
|
-
```
|
|
163
|
+
</details>
|
|
947
164
|
|
|
948
165
|
---
|
|
949
166
|
|
|
950
|
-
|
|
167
|
+
## π§° The tools at a glance
|
|
951
168
|
|
|
952
|
-
|
|
169
|
+
~101 tools. The headline group **builds pages**; the rest read and edit your live store.
|
|
953
170
|
|
|
954
|
-
|
|
171
|
+
| Group | Tools | Needs |
|
|
172
|
+
|-------|-------|-------|
|
|
173
|
+
| **Build a page** | `get_build_guide` Β· `list_elements` Β· `get_element` Β· `new_element` Β· `new_section` Β· `new_page_skeleton` Β· `validate_page` Β· `build_page` Β· `add_section` | catalog tools: nothing |
|
|
174
|
+
| **Media & ingest** | `search_images` (Pexels) Β· `upload_image` (CDN) Β· `ingest_html` Β· `ingest_url` (recreate a reference page) | β |
|
|
175
|
+
| **Pages & code** | `list_pages` Β· `get_page_source` Β· `search_page_elements` Β· `get_page_element` Β· `update_page_element(s)` Β· `create_page` Β· `update_page` Β· `update_page_source` Β· custom CSS/JS Β· page contents Β· global sections Β· `publish_site` | token + session |
|
|
176
|
+
| **Commerce** | products Β· orders Β· collections Β· promotions Β· combos | token + session |
|
|
177
|
+
| **Content & store** | blog articles Β· themes / site style Β· apps Β· customers Β· `send_mail` | token + session |
|
|
178
|
+
| **Backend code** | HTTP-function CRUD (`get_http_function`, `edit_http_function`, `run_function`, `debug_function`β¦) | token + session |
|
|
179
|
+
| **Context** | `get_current_context` Β· `list_my_sites` Β· `switch_site` Β· `update_auth` Β· `toggle_confirm_mode` | token |
|
|
955
180
|
|
|
956
|
-
|
|
181
|
+
Every write **defaults to `dry_run=true`** β it previews the exact change and only touches your site when you re-run with `dry_run=false`.
|
|
957
182
|
|
|
958
|
-
|
|
183
|
+
## π¬ Suggested prompt
|
|
959
184
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
coding-standards.md
|
|
964
|
-
api-docs.md
|
|
965
|
-
```
|
|
185
|
+
> Build me a WebCake storefront page for <brand/offer>. Use the webcake-storefront MCP:
|
|
186
|
+
> call `get_build_guide`, `list_elements`, build the sections with `new_section`,
|
|
187
|
+
> `validate_page` until zero errors, then `build_page` (dry-run first) and `publish_site`.
|
|
966
188
|
|
|
967
|
-
Or set a custom directory:
|
|
968
|
-
```json
|
|
969
|
-
{ "env": { "WEBCAKE_KNOWLEDGE_DIR": "/path/to/my/knowledge" } }
|
|
970
|
-
```
|
|
971
|
-
|
|
972
|
-
#### Source 2: GitHub repo
|
|
973
|
-
|
|
974
|
-
Point to a GitHub repo containing knowledge files. The AI agent will fetch and read them automatically.
|
|
975
|
-
|
|
976
|
-
```json
|
|
977
|
-
{
|
|
978
|
-
"env": {
|
|
979
|
-
"WEBCAKE_KNOWLEDGE_REPO": "your-org/my-knowledge"
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
```
|
|
983
|
-
|
|
984
|
-
**Supported formats:**
|
|
985
|
-
|
|
986
|
-
| Format | Example |
|
|
987
|
-
|--------|---------|
|
|
988
|
-
| `owner/repo` | `acme/knowledge-base` |
|
|
989
|
-
| `owner/repo/subdir` | `acme/docs/ai-guides` |
|
|
990
|
-
| Full URL | `https://github.com/acme/knowledge-base` |
|
|
991
|
-
| URL with branch + path | `https://github.com/acme/docs/tree/main/ai-guides` |
|
|
992
|
-
|
|
993
|
-
**Private repos** β add a GitHub personal access token:
|
|
994
|
-
```json
|
|
995
|
-
{
|
|
996
|
-
"env": {
|
|
997
|
-
"WEBCAKE_KNOWLEDGE_REPO": "your-org/private-knowledge",
|
|
998
|
-
"WEBCAKE_KNOWLEDGE_TOKEN": "ghp_xxxxxxxxxxxx"
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
```
|
|
1002
|
-
|
|
1003
|
-
Files are cached for 5 minutes to avoid GitHub API rate limits.
|
|
1004
|
-
|
|
1005
|
-
#### File format
|
|
1006
|
-
|
|
1007
|
-
Files support optional frontmatter for name and description:
|
|
1008
|
-
|
|
1009
|
-
```markdown
|
|
1010
189
|
---
|
|
1011
|
-
name: Business Rules
|
|
1012
|
-
description: E-commerce shipping and return policies
|
|
1013
|
-
tags: business, policy
|
|
1014
|
-
---
|
|
1015
|
-
|
|
1016
|
-
## Shipping Policy
|
|
1017
|
-
- Free shipping for orders over $50
|
|
1018
|
-
- Express shipping: 2-3 business days
|
|
1019
|
-
...
|
|
1020
|
-
```
|
|
1021
|
-
|
|
1022
|
-
#### Usage
|
|
1023
|
-
|
|
1024
|
-
```
|
|
1025
|
-
# List available knowledge files
|
|
1026
|
-
list_knowledge({})
|
|
1027
|
-
β { files: [
|
|
1028
|
-
{ file: "business-rules", name: "Business Rules", description: "E-commerce shipping..." },
|
|
1029
|
-
{ file: "coding-standards", name: "Coding Standards", description: "..." }
|
|
1030
|
-
]}
|
|
1031
|
-
|
|
1032
|
-
# Read a specific file
|
|
1033
|
-
get_knowledge({ file: "business-rules" })
|
|
1034
|
-
β { file: "business-rules.md", name: "Business Rules", content: "## Shipping Policy\n..." }
|
|
1035
|
-
```
|
|
1036
190
|
|
|
1037
|
-
|
|
191
|
+
## β Like the idea? Drop a star
|
|
1038
192
|
|
|
1039
|
-
|
|
193
|
+
This is a solo, open-source project β every β genuinely keeps it moving and helps other builders find it.
|
|
1040
194
|
|
|
1041
|
-
|
|
195
|
+
- β **[Star the repo](https://github.com/vuluu2k/webcake-storefront-mcp)** β 2 seconds, huge motivation.
|
|
196
|
+
- π **[Open an issue](https://github.com/vuluu2k/webcake-storefront-mcp/issues)** β a bug, a missing component, or just an idea.
|
|
197
|
+
- π **Share it** with anyone still building store pages block by block.
|
|
1042
198
|
|
|
1043
|
-
|
|
1044
|
-
|---------|-------------|-----|
|
|
1045
|
-
| Lazy guides (`include_guide`) | ~600-1000 per call | Only load guide on first call |
|
|
1046
|
-
| List = metadata only | 50-90% per list call | HTML content, source JSON, full schemas stripped from list responses |
|
|
1047
|
-
| Overview + Search (pages) | ~85-90% | Overview gives structure, search gives only matched elements |
|
|
1048
|
-
| HTTP function overview + snippet | ~80-95% per read | Overview shows function list only, snippet reads just the needed function |
|
|
1049
|
-
| `edit_http_function` | ~70-90% per edit | Replace/add/remove by function name, not full file |
|
|
1050
|
-
| Custom code field filter | ~50-80% per read | Read only CSS or JS instead of all 4 fields |
|
|
1051
|
-
| `append_site_custom_code` | ~100% on add | Append/prepend without reading existing content |
|
|
1052
|
-
| Compact JSON | ~30% per response | No pretty-printing in responses |
|
|
1053
|
-
|
|
1054
|
-
---
|
|
199
|
+
[](https://star-history.com/#vuluu2k/webcake-storefront-mcp&Date)
|
|
1055
200
|
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
### CMS Files (12 tools)
|
|
1059
|
-
| Tool | Description |
|
|
1060
|
-
|------|-------------|
|
|
1061
|
-
| `list_cms_files` | List all CMS files |
|
|
1062
|
-
| `create_cms_file` | Create HTTP function / cron job / default file |
|
|
1063
|
-
| `update_cms_file` | Update file content |
|
|
1064
|
-
| `get_http_function` | **Default**: full code + schemas. **overview=true**: function list only (for browsing). `include_guide=true` for coding guide |
|
|
1065
|
-
| `get_http_function_snippet` | Read specific function(s) by name β much more token-efficient than full file |
|
|
1066
|
-
| `edit_http_function` | Edit by function name: replace_function/add/remove/update_imports β no string matching needed |
|
|
1067
|
-
| `update_http_function` | Full file write β best for new features, major refactors. `edit_http_function` for small fixes |
|
|
1068
|
-
| `run_function` | Execute a deployed function |
|
|
1069
|
-
| `debug_function` | Run code in debug mode (without deploying) |
|
|
1070
|
-
| `save_file_version` | Save version snapshot for rollback |
|
|
1071
|
-
| `get_file_versions` | Get version history |
|
|
1072
|
-
| `toggle_debug_render` | Toggle debug render mode |
|
|
1073
|
-
|
|
1074
|
-
### Pages (16 tools)
|
|
1075
|
-
| Tool | Description |
|
|
1076
|
-
|------|-------------|
|
|
1077
|
-
| `list_pages` | List all pages (metadata only, no source) |
|
|
1078
|
-
| `get_page_source` | Get page overview: section count, element types, custom classes |
|
|
1079
|
-
| `search_page_elements` | Search elements by type, id, class, text, bind, events (returns full detail) |
|
|
1080
|
-
| `get_page_element` | Get full detail of a single element by ID (includes children IDs) |
|
|
1081
|
-
| `update_page_element` | Update element properties: style, config, specials, events, bindings, responsive |
|
|
1082
|
-
| `update_page_elements` | Batch update multiple elements in one call |
|
|
1083
|
-
| `create_page` | Create a new page |
|
|
1084
|
-
| `update_page` | Update page properties |
|
|
1085
|
-
| `get_site_custom_code` | Read CSS/JS. Use `fields` to read only specific fields. `include_guide=true` for guide |
|
|
1086
|
-
| `update_site_custom_code` | Write full CSS/JS custom code (only specified fields are updated) |
|
|
1087
|
-
| `append_site_custom_code` | Append/prepend CSS/JS code without reading first β for adding new rules |
|
|
1088
|
-
| `delete_page` | Delete a page |
|
|
1089
|
-
| `get_page_versions` | Page version history |
|
|
1090
|
-
| `list_page_contents` | Multi-language contents |
|
|
1091
|
-
| `update_page_content` | Update content for a language |
|
|
1092
|
-
| `list_global_sections` | List reusable global sections |
|
|
1093
|
-
|
|
1094
|
-
### Collections β Database (3 tools)
|
|
1095
|
-
| Tool | Description |
|
|
1096
|
-
|------|-------------|
|
|
1097
|
-
| `list_collections` | List collections (name, table_name, field count only) |
|
|
1098
|
-
| `get_collection` | Get full schema: field names, types, constraints, references |
|
|
1099
|
-
| `query_collection_records` | Query records by table_name |
|
|
1100
|
-
|
|
1101
|
-
### Blog Articles (5 tools)
|
|
1102
|
-
| Tool | Description |
|
|
1103
|
-
|------|-------------|
|
|
1104
|
-
| `list_articles` | List articles (metadata only, no HTML content) |
|
|
1105
|
-
| `get_article` | Get full article with HTML content |
|
|
1106
|
-
| `create_article` | Create article |
|
|
1107
|
-
| `update_article` | Update article |
|
|
1108
|
-
| `delete_article` | Delete article |
|
|
1109
|
-
|
|
1110
|
-
### Products (4 tools)
|
|
1111
|
-
| Tool | Description |
|
|
1112
|
-
|------|-------------|
|
|
1113
|
-
| `list_products` | List products (metadata: name, slug, price, image, status) |
|
|
1114
|
-
| `get_product` | Get full product: description, variations, attributes, images, SEO |
|
|
1115
|
-
| `search_products` | Search products by keyword |
|
|
1116
|
-
| `list_categories` | List all product categories |
|
|
1117
|
-
|
|
1118
|
-
### Orders (3 tools)
|
|
1119
|
-
| Tool | Description |
|
|
1120
|
-
|------|-------------|
|
|
1121
|
-
| `list_orders` | List orders (metadata: customer, status, total, items count) |
|
|
1122
|
-
| `get_order` | Get full order: items, payment, shipping, discounts |
|
|
1123
|
-
| `count_orders_by_status` | Order count grouped by status |
|
|
1124
|
-
|
|
1125
|
-
### Promotions & Discounts (5 tools)
|
|
1126
|
-
| Tool | Description |
|
|
1127
|
-
|------|-------------|
|
|
1128
|
-
| `list_promotions` | List all promotions (metadata: name, type, status, schedule). `include_guide=true` for type reference |
|
|
1129
|
-
| `get_promotion` | Get full promotion details: discount rules, coupon settings, items, bonus products |
|
|
1130
|
-
| `get_promotion_items` | Get products/variations/categories attached to a promotion with discount details |
|
|
1131
|
-
| `get_active_promotions` | Get all currently active promotions |
|
|
1132
|
-
| `search_promotions` | Search/filter by type, status (coming_soon/in_progress/finished), keyword |
|
|
1133
|
-
|
|
1134
|
-
### Combo Products (2 tools)
|
|
1135
|
-
| Tool | Description |
|
|
1136
|
-
|------|-------------|
|
|
1137
|
-
| `list_combos` | List all combo/bundle products (name, discount, schedule, type). `include_guide=true` for type reference |
|
|
1138
|
-
| `get_combo_items` | Get combo composition: required items (with quantities) and bonus/gift products |
|
|
1139
|
-
|
|
1140
|
-
### Site Style & Theme (2 tools)
|
|
1141
|
-
| Tool | Description |
|
|
1142
|
-
|------|-------------|
|
|
1143
|
-
| `get_site_info` | Get site name, domain, logo, and all design settings |
|
|
1144
|
-
| `list_themes` | List custom themes: colors, typography, transitions |
|
|
1145
|
-
|
|
1146
|
-
### Applications (2 tools)
|
|
1147
|
-
| Tool | Description |
|
|
1148
|
-
|------|-------------|
|
|
1149
|
-
| `list_apps` | List installed apps with settings and status |
|
|
1150
|
-
| `get_app` | Get specific app by type ID |
|
|
1151
|
-
|
|
1152
|
-
### Custom Knowledge (2 tools)
|
|
1153
|
-
| Tool | Description |
|
|
1154
|
-
|------|-------------|
|
|
1155
|
-
| `list_knowledge` | List all custom knowledge/guide files |
|
|
1156
|
-
| `get_knowledge` | Read a specific knowledge file |
|
|
1157
|
-
|
|
1158
|
-
### Customers (1 tool)
|
|
1159
|
-
| Tool | Description |
|
|
1160
|
-
|------|-------------|
|
|
1161
|
-
| `find_customer` | Find by ID, phone, or email |
|
|
1162
|
-
|
|
1163
|
-
### Automation (1 tool)
|
|
1164
|
-
| Tool | Description |
|
|
1165
|
-
|------|-------------|
|
|
1166
|
-
| `send_mail` | Send email via CMS automation |
|
|
201
|
+
> Built with β€οΈ for the WebCake community. Thanks for being here.
|