webcake-storefront-mcp 1.29.0 → 1.30.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 CHANGED
@@ -505,6 +505,11 @@ export class WebcakeCmsApi {
505
505
  return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/combo_product/items`, { query: { combo_product_id: comboProductId, ...query } });
506
506
  }
507
507
  // ── Customers ──
508
+ /** List/search customers. Real shape: { customers: { data:[…], total_entries } }. Accepts
509
+ * page/limit and a `term` keyword (name/phone/email). Endpoint is /customer/all (singular). */
510
+ listCustomers(query) {
511
+ return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/customer/all`, { query });
512
+ }
508
513
  findCustomerById(id) {
509
514
  return this.request("GET", `/api/v1/cms_function/${this.siteId}/customer/identity/${id}`);
510
515
  }
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "v": "1.30.0",
4
+ "d": "26/06/2026",
5
+ "type": "Added",
6
+ "en": "New list_customers tool browses or searches the site's customer list; accepts page, limit, and term (name/phone/email keyword) and returns a compact…",
7
+ "vi": "Tool mới list_customers duyệt hoặc tìm kiếm danh sách khách hàng của site; nhận các tham số page, limit và term (từ khóa tên/điện thoại/email) và…"
8
+ },
2
9
  {
3
10
  "v": "1.29.0",
4
11
  "d": "26/06/2026",
@@ -33,12 +40,5 @@
33
40
  "type": "Fixed",
34
41
  "en": "create_product now accepts a short_description parameter and sends it to the backend as [{description}] — the array shape the real product schema…",
35
42
  "vi": "create_product nay nhận thêm tham số short_description và gửi lên backend dưới dạng [{description}] — đúng kiểu mảng mà schema sản phẩm thực tế yêu…"
36
- },
37
- {
38
- "v": "1.25.0",
39
- "d": "26/06/2026",
40
- "type": "Changed",
41
- "en": "list_elements now documents 16 previously-uncovered element types, completing curated attribute coverage across all 132 factory types: popup…",
42
- "vi": "list_elements nay tài liệu hóa 16 kiểu phần tử trước đây chưa được ghi lại, hoàn thiện độ phủ thuộc tính curated cho toàn bộ 132 kiểu factory: popup…"
43
43
  }
44
44
  ]
@@ -1,5 +1,35 @@
1
1
  import { z } from "zod";
2
2
  export function registerCustomerTools(server, api, handle) {
3
+ server.tool("list_customers", "List/search the site's customers (browse or segment). Pass `term` to search by name/phone/email. Returns name, phone, email, order_count, purchased_amount, reward_point, tags, last_order_at. Use find_customer for an exact id/phone/email lookup.", {
4
+ page: z.number().optional().describe("Page number (default 1)"),
5
+ limit: z.number().optional().describe("Items per page (default 50)"),
6
+ term: z.string().optional().describe("Keyword — searches name / phone / email"),
7
+ }, ({ page, limit, term }) => handle(async () => {
8
+ const query = { page: page ?? 1, limit: limit ?? 50 };
9
+ if (term && term.trim())
10
+ query.term = term.trim();
11
+ const res = await api.listCustomers(query);
12
+ // Real shape: { customers: { data:[…], total_entries } }.
13
+ const box = (res && res.customers) || res || {};
14
+ const list = (Array.isArray(box) ? box : box.data) || [];
15
+ if (!Array.isArray(list))
16
+ return res;
17
+ return {
18
+ data: list.map((c) => ({
19
+ id: c.id,
20
+ name: c.name,
21
+ phone_number: c.phone_number || c.recent_phone_number || undefined,
22
+ email: c.email || undefined,
23
+ order_count: c.order_count ?? undefined,
24
+ succeed_order_count: c.succeed_order_count ?? undefined,
25
+ purchased_amount: c.purchased_amount ?? undefined,
26
+ reward_point: c.reward_point ?? undefined,
27
+ tags: c.tags && c.tags.length ? c.tags : undefined,
28
+ last_order_at: c.last_order_at || undefined,
29
+ })),
30
+ total: (box.total_entries ?? res.total) || list.length,
31
+ };
32
+ }));
3
33
  server.tool("find_customer", "Find a customer by ID, phone number, or email", {
4
34
  by: z.enum(["id", "phone", "email"]).describe("Search field"),
5
35
  value: z.string().describe("Search value"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-storefront-mcp",
3
- "version": "1.29.0",
3
+ "version": "1.30.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",