webcake-storefront-mcp 2.1.0 → 2.2.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.
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "v": "2.2.0",
4
+ "d": "19/11/2026",
5
+ "type": "Added",
6
+ "en": "get_element now returns a keys field with one line per specials/config key the published renderer reads — meaning, type, allowed/seen values, and…",
7
+ "vi": "get_element nay trả về thêm trường keys — một dòng cho mỗi key specials/config mà renderer của trang đã publish đọc tới, gồm ý nghĩa, kiểu dữ liệu,…"
8
+ },
2
9
  {
3
10
  "v": "2.1.0",
4
11
  "d": "19/11/2026",
@@ -33,12 +40,5 @@
33
40
  "type": "Added",
34
41
  "en": "The stdio server now reopens the browser Connect page automatically when the session token expires or the backend rejects it with a 401, then…",
35
42
  "vi": "Server stdio nay tự mở lại trang Connect trên trình duyệt khi token phiên hết hạn hoặc bị backend từ chối với lỗi 401, rồi tự chạy lại lệnh gọi tool…"
36
- },
37
- {
38
- "v": "1.39.0",
39
- "d": "13/11/2026",
40
- "type": "Added",
41
- "en": "New preview_page tool screenshots the saved (unpublished) draft at desktop and mobile widths through the editor's own preview host, so a page can be…",
42
- "vi": "Tool mới preview_page chụp ảnh bản nháp đã lưu (chưa publish) ở cả độ rộng máy tính và điện thoại qua host xem trước của chính editor, nhờ đó có thể…"
43
43
  }
44
44
  ]
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
2
2
  import { checkSiteCode, codeGuard } from "../builder/native-first.js";
3
3
  import { PAGE_CODE_ARG, writePageCode } from "./page-code.js";
4
4
  import { PAGE_CODE_BUDGET, codeTargets, lintPageCode, mergePageCode } from "../builder/page-code.js";
5
- import { elementSchema, suggestType, valueRules } from "../builder/element-schema.js";
5
+ import { elementSchema, suggestType, keyReference } from "../builder/element-schema.js";
6
6
  import { z } from "zod";
7
7
  import { BUILD_GUIDE } from "../builder/guide.js";
8
8
  import { PAGE_SCHEMA } from "../builder/page-schema.js";
@@ -177,7 +177,7 @@ export function registerBuilderTools(server, api, handle) {
177
177
  server.tool("get_build_guide", "Get the BuilderX page authoring guide: page shape, the grid layout model, styling, breakpoints, forms/data, and the build workflow. Read this before building or heavily editing a page.", {}, () => handle(async () => ({ guide: BUILD_GUIDE })));
178
178
  server.tool("get_page_schema", "Get the authoritative JSON Schema (Draft 2020-12) for a page source `{ sections: [...] }` — the structural contract for every node (id/type/specials/runtime{style,config}/children/events/bindings) in the CSS-grid model. Use it as the shape to emit; validate_page enforces the semantic rules.", {}, () => handle(async () => PAGE_SCHEMA));
179
179
  server.tool("list_elements", "List all BuilderX element/component types you can place on a page, grouped by category with a one-line summary and whether each is a container.", {}, () => handle(async () => listElements()));
180
- server.tool("get_element", "Get the full detail of an element type: category, container flag, summary, an ATTRIBUTES reference (the meaningful specials/config keys + their purpose, events, and dataset binding targets), VALUE_RULES (per key: allowed values `one of …` that validate_page enforces, values `seen` on real pages, and non-string value types), PARENTS when it must sit inside a given container, and a live skeleton node (the authoritative default shape) you can copy and edit. Read this before authoring/editing an element so you set the right keys.", {
180
+ server.tool("get_element", "Get the full detail of an element type: category, container flag, summary, KEYS — one line per specials/config key the published renderer reads (`key: meaning · type · one of a|b (enforced) / e.g. a|b · default x`; style config of one part folded as `part{Color,FontSize=14,…}`), no_effect = keys no render code reads (don't set them), ATTRIBUTES (events, dataset binding targets, notes), PARENTS when it must sit inside a given container, and a live skeleton node (the authoritative default shape) you can copy and edit. Read this before authoring/editing an element so you set the right keys.", {
181
181
  type: z.string().describe("Element type, e.g. 'text', 'button', 'grid-product'"),
182
182
  }, ({ type }) => handle(async () => {
183
183
  const el = getElement(type);
@@ -186,7 +186,9 @@ export function registerBuilderTools(server, api, handle) {
186
186
  return guess ? { ...el, did_you_mean: guess } : el;
187
187
  }
188
188
  const parents = elementSchema(type)?.parents;
189
- return { ...el, ...(parents ? { parents } : {}), value_rules: valueRules(type) };
189
+ // attributes.specials/config/more_* are folded into `keys` (one line per key).
190
+ const { specials: _s, more_specials: _ms, config: _c, more_config: _mc, ...attributes } = el.attributes || {};
191
+ return { ...el, attributes, ...(parents ? { parents } : {}), keys: keyReference(type) };
190
192
  }));
191
193
  server.tool("list_events", "List every interaction EVENT you can attach to a node: the triggers (eventName: click/hover/success/submit/…) and the actions (open_page, scroll_to, toggle, open_popup, add_to_cart, buy_now, phone_call, open_link, …) with the exact extra fields each action needs. Attach via new_element/new_section opts.events (ids are auto-minted, e.g. opts.events=[{ action:'add_to_cart', open_page:'cart' }]).", {}, () => handle(async () => describeEventsCatalog()));
192
194
  server.tool("list_bindings", "List every dynamic-data BINDING target: the datasets (product, cart_item, order, order_item, post, category, customer, customer_address, …) and their exact field names ('product::product_price', …), which page type each needs (store/member/blog), and how repeater children (grid-product, cart-items, post-list) bind per-item. Attach via new_element opts.bindings (ids auto-minted, e.g. opts.bindings=[{ target:'product::product_price' }]).", {}, () => handle(async () => describeBindingsCatalog()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-storefront-mcp",
3
- "version": "2.1.0",
3
+ "version": "2.2.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",
@@ -34,7 +34,9 @@
34
34
  "gen-api": "node scripts/gen-api-catalog.mjs",
35
35
  "prepare": "npm run build",
36
36
  "prepublishOnly": "npm run build && npm run smoke",
37
- "test": "node --test \"test/*.test.mjs\""
37
+ "test": "node --test \"test/*.test.mjs\"",
38
+ "mine-renderer": "node scripts/mine-renderer.mjs",
39
+ "mine-editor": "node scripts/mine-editor.mjs"
38
40
  },
39
41
  "dependencies": {
40
42
  "@modelcontextprotocol/sdk": "^1.12.1",