webcake-storefront-mcp 1.11.1 → 1.12.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/dist/api.js +36 -0
- package/dist/changelog.json +7 -7
- package/dist/tools/catalog-write.js +80 -0
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -334,6 +334,27 @@ export class WebcakeCmsApi {
|
|
|
334
334
|
timeout: 60000,
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
|
+
/** Update a product. Body wraps fields in `product_params` and identifies the product by
|
|
338
|
+
* product_params.product_id. */
|
|
339
|
+
updateProduct(productParams) {
|
|
340
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/update`, {
|
|
341
|
+
body: { site_id: this.siteId, product_params: productParams },
|
|
342
|
+
timeout: 60000,
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
/** Delete products by id. Body: { site_id, ids }. */
|
|
346
|
+
removeProducts(ids) {
|
|
347
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/remove`, {
|
|
348
|
+
body: { site_id: this.siteId, ids },
|
|
349
|
+
timeout: 60000,
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
/** Publish/unpublish products. Body: { site_id, data: [{ product_id, is_published }] }. */
|
|
353
|
+
setProductsPublished(data) {
|
|
354
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/published`, {
|
|
355
|
+
body: { site_id: this.siteId, data },
|
|
356
|
+
});
|
|
357
|
+
}
|
|
337
358
|
/** Create a product category. Command-based: pass a `commands` array whose entries each
|
|
338
359
|
* carry a caller-generated `data.id` (the new category id). Response is generic. */
|
|
339
360
|
createProductCategory(commands) {
|
|
@@ -342,6 +363,21 @@ export class WebcakeCmsApi {
|
|
|
342
363
|
timeout: 60000,
|
|
343
364
|
});
|
|
344
365
|
}
|
|
366
|
+
/** Update a product category — command-based (name_category / image_category /
|
|
367
|
+
* multi_description / set_category_visible), each command's data.id = the category id. */
|
|
368
|
+
updateProductCategory(commands) {
|
|
369
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/categories/update`, {
|
|
370
|
+
body: { site_id: this.siteId, commands },
|
|
371
|
+
timeout: 60000,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
/** Delete product categories — command bulk_delete_category with data.ids. */
|
|
375
|
+
deleteProductCategory(commands) {
|
|
376
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/categories/delete`, {
|
|
377
|
+
body: { site_id: this.siteId, commands },
|
|
378
|
+
timeout: 60000,
|
|
379
|
+
});
|
|
380
|
+
}
|
|
345
381
|
// ── Orders ──
|
|
346
382
|
listOrders(query) {
|
|
347
383
|
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/orders/all`, { query });
|
package/dist/changelog.json
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "1.12.0",
|
|
4
|
+
"d": "24/06/2026",
|
|
5
|
+
"type": "Added",
|
|
6
|
+
"en": "New update_product tool updates an existing product's name, description, images, category_ids, is_published flag, or variations (price/stock/SKU per…",
|
|
7
|
+
"vi": "Tool mới update_product cập nhật name, description, images, category_ids, cờ is_published hoặc variations (giá/tồn kho/SKU theo từng biến thể) của…"
|
|
8
|
+
},
|
|
2
9
|
{
|
|
3
10
|
"v": "1.11.1",
|
|
4
11
|
"d": "24/06/2026",
|
|
@@ -33,12 +40,5 @@
|
|
|
33
40
|
"type": "Added",
|
|
34
41
|
"en": "New list_automations tool returns each automation's id, name, status, and trigger info so agents can find the automation_id required by send_mail or…",
|
|
35
42
|
"vi": "Tool mới list_automations trả về id, name, status và thông tin trigger của từng automation, giúp agent tìm được automation_id cần truyền vào…"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"v": "1.7.0",
|
|
39
|
-
"d": "23/06/2026",
|
|
40
|
-
"type": "Changed",
|
|
41
|
-
"en": "The web guide landing page (served via the serve command) is reframed to lead on full-storefront creation: the hero, meta description, \"What you…",
|
|
42
|
-
"vi": "Trang web guide (phục vụ qua lệnh serve) được viết lại để làm nổi bật việc xây dựng toàn bộ cửa hàng: hero, meta description, thư viện \"Bạn dựng…"
|
|
43
43
|
}
|
|
44
44
|
]
|
|
@@ -126,4 +126,84 @@ Returns the new category id — pass it to create_product's category_ids. Image
|
|
|
126
126
|
await api.createBlogCategory(commands);
|
|
127
127
|
return { success: true, category_id: id, name };
|
|
128
128
|
}));
|
|
129
|
+
// ── Edits: products & product categories ─────────────────────────────────────
|
|
130
|
+
server.tool("update_product", `Update an existing product. Pass product_id + only the fields to change. To change
|
|
131
|
+
price/stock, pass variations (get_product first to see the existing variation shape).
|
|
132
|
+
Images must be hosted CDN urls (search_images cdn_url / upload_images).`, {
|
|
133
|
+
product_id: z.string().describe("Product id to update"),
|
|
134
|
+
name: z.string().optional().describe("New name"),
|
|
135
|
+
description: z.string().optional().describe("New description (HTML allowed)"),
|
|
136
|
+
images: z.array(z.string()).optional().describe("New hosted image URLs; first becomes the thumbnail"),
|
|
137
|
+
category_ids: z.array(z.string()).optional().describe("Replace the product's categories"),
|
|
138
|
+
is_published: z.boolean().optional().describe("Publish/unpublish the product"),
|
|
139
|
+
variations: z.array(variationSpec).optional().describe("Replace variations (price/stock/SKU per variant). Reuse existing custom_ids from get_product to edit in place."),
|
|
140
|
+
}, ({ product_id, name, description, images, category_ids, is_published, variations }) => handle(async () => {
|
|
141
|
+
const productParams = { product_id };
|
|
142
|
+
if (name != null)
|
|
143
|
+
productParams.name = name;
|
|
144
|
+
if (description != null)
|
|
145
|
+
productParams.description = description;
|
|
146
|
+
if (images)
|
|
147
|
+
productParams.image = images[0];
|
|
148
|
+
if (category_ids) {
|
|
149
|
+
productParams.categories = category_ids;
|
|
150
|
+
productParams.ribbons = [];
|
|
151
|
+
}
|
|
152
|
+
if (is_published != null)
|
|
153
|
+
productParams.is_published = is_published;
|
|
154
|
+
if (variations) {
|
|
155
|
+
productParams.variations = variations.map((v) => ({
|
|
156
|
+
custom_id: v.custom_id || `SKU-${randomUUID().slice(0, 8)}`,
|
|
157
|
+
retail_price: v.retail_price,
|
|
158
|
+
original_price: v.original_price ?? v.retail_price,
|
|
159
|
+
remain_quantity: v.remain_quantity ?? 100,
|
|
160
|
+
images: v.images || (images ? images : []),
|
|
161
|
+
weight: v.weight ?? 0,
|
|
162
|
+
fields: v.fields || [],
|
|
163
|
+
is_hidden: false,
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
await api.updateProduct(productParams);
|
|
167
|
+
return { success: true, product_id, updated: Object.keys(productParams).filter((k) => k !== "product_id") };
|
|
168
|
+
}));
|
|
169
|
+
server.tool("set_product_published", "Publish or unpublish one or more products quickly (without a full update).", {
|
|
170
|
+
product_ids: z.array(z.string()).describe("Product ids"),
|
|
171
|
+
is_published: z.boolean().describe("true = publish (visible), false = hide"),
|
|
172
|
+
}, ({ product_ids, is_published }) => handle(async () => {
|
|
173
|
+
await api.setProductsPublished(product_ids.map((product_id) => ({ product_id, is_published })));
|
|
174
|
+
return { success: true, product_ids, is_published };
|
|
175
|
+
}));
|
|
176
|
+
server.tool("delete_product", "Delete one or more products by id.", {
|
|
177
|
+
product_ids: z.array(z.string()).describe("Product ids to delete"),
|
|
178
|
+
}, ({ product_ids }) => handle(async () => {
|
|
179
|
+
await api.removeProducts(product_ids);
|
|
180
|
+
return { success: true, deleted: product_ids };
|
|
181
|
+
}));
|
|
182
|
+
server.tool("update_product_category", "Update a product category (name, image, description, or visibility). Pass id + fields to change.", {
|
|
183
|
+
id: z.string().describe("Category id"),
|
|
184
|
+
name: z.string().optional().describe("New name"),
|
|
185
|
+
image: z.string().optional().describe("New hosted image URL"),
|
|
186
|
+
description: z.string().optional().describe("New description"),
|
|
187
|
+
hidden: z.boolean().optional().describe("Hide (true) or show (false) the category"),
|
|
188
|
+
}, ({ id, name, image, description, hidden }) => handle(async () => {
|
|
189
|
+
const commands = [];
|
|
190
|
+
if (name != null)
|
|
191
|
+
commands.push({ name: "name_category", data: { id, name } });
|
|
192
|
+
if (image != null)
|
|
193
|
+
commands.push({ name: "image_category", data: { id, image } });
|
|
194
|
+
if (description != null)
|
|
195
|
+
commands.push({ name: "multi_description", data: { id, multi_description: [{ id: randomUUID(), title: name || "", description }] } });
|
|
196
|
+
if (hidden != null)
|
|
197
|
+
commands.push({ name: "set_category_visible", data: { id, is_hidden: hidden } });
|
|
198
|
+
if (!commands.length)
|
|
199
|
+
throw new Error("Nothing to update — pass at least one of name/image/description/hidden.");
|
|
200
|
+
await api.updateProductCategory(commands);
|
|
201
|
+
return { success: true, category_id: id, updated: commands.map((c) => c.name) };
|
|
202
|
+
}));
|
|
203
|
+
server.tool("delete_product_category", "Delete one or more product categories by id.", {
|
|
204
|
+
ids: z.array(z.string()).describe("Category ids to delete"),
|
|
205
|
+
}, ({ ids }) => handle(async () => {
|
|
206
|
+
await api.deleteProductCategory([{ name: "bulk_delete_category", data: { ids } }]);
|
|
207
|
+
return { success: true, deleted: ids };
|
|
208
|
+
}));
|
|
129
209
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webcake-storefront-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "MCP server for the WebCake/StoreCake storefront builder — page CRUD, page authoring, products, orders, and more",
|
|
5
5
|
"mcpName": "io.github.vuluu2k/webcake-storefront-mcp",
|
|
6
6
|
"license": "MIT",
|