webcake-storefront-mcp 1.17.0 → 1.17.1

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": "1.17.1",
4
+ "d": "25/06/2026",
5
+ "type": "Changed",
6
+ "en": "get_http_function and get_site_custom_code now include a \"File / media uploads\" section in the embedded HTTP function guide, documenting three ways…",
7
+ "vi": "get_http_function và get_site_custom_code nay bổ sung mục \"File / media uploads\" vào hướng dẫn HTTP function nhúng sẵn, tài liệu hóa ba cách tải…"
8
+ },
2
9
  {
3
10
  "v": "1.17.0",
4
11
  "d": "24/06/2026",
@@ -33,12 +40,5 @@
33
40
  "type": "Added",
34
41
  "en": "New list_events tool returns the authoritative interaction-events catalog: 9 triggers (click, hover, submit, success, ...) and 38 actions…",
35
42
  "vi": "Tool mới list_events trả về danh mục sự kiện tương tác đầy đủ: 9 trigger (click, hover, submit, success, ...) và 38 action (open_page, scroll_to,…"
36
- },
37
- {
38
- "v": "1.13.0",
39
- "d": "24/06/2026",
40
- "type": "Added",
41
- "en": "New restore_file_version tool rolls a CMS file back to a saved version in one step: it reads the chosen version's content (via get_file_versions)…",
42
- "vi": "Tool mới restore_file_version khôi phục CMS file về một phiên bản đã lưu chỉ trong một bước: đọc nội dung phiên bản được chọn (qua…"
43
43
  }
44
44
  ]
package/dist/guides.js CHANGED
@@ -95,6 +95,32 @@ they pick up site_id. Below is EXACTLY what each call sends to the backend + wha
95
95
  automation set up on the site — find it with the MCP tool list_automations.
96
96
  data is the payload passed into that automation/email template.
97
97
 
98
+ ## File / media uploads → CDN url
99
+ Three ways, all returning a permanent CDN url:
100
+
101
+ 1) A client POSTs a real file (multipart/form-data) to your function — it is auto-stored on
102
+ the CDN and request.params.<field> / request.data.<field> is simply its CDN url (string).
103
+ Use it directly, no upload call needed. (A function never sees raw file bytes.)
104
+
105
+ 2) Upload from inside the function with '@webcake/media':
106
+ import { upload } from '@webcake/media';
107
+ const url = await upload(request, { url: someRemoteUrl }); // rehost a link
108
+ const url = await upload(request, { base64, content_type }); // bytes you hold
109
+ - { url } — rehost a remote file (image/video/any); the SERVER fetches it (no base64).
110
+ Use for an AI-generated image url, an external API's file, etc.
111
+ - { base64, content_type } — content the function built/holds (data URI or raw base64;
112
+ content_type e.g. "image/png", "application/pdf"). Throws on failure.
113
+
114
+ 3) Direct call (admin/server, with the site's cms admin token):
115
+ POST /api/v1/cms_function/{site_id}/media/upload (Authorization: Bearer <token>)
116
+ multipart field "file" OR JSON { url } OR JSON { base64, content_type }
117
+ → { success: true, data: "<cdn url>" }
118
+
119
+ All three save the file into the site's media library under a dedicated, non-deletable
120
+ folder ("API Uploads") and count toward the site's storage quota (BASIC < 3GB, STANDARD
121
+ < 8GB, PRO unlimited). Over quota: upload() / the direct call return an error; a multipart
122
+ file POSTed to a function comes through as null for that field.
123
+
98
124
  ## Sandbox globals (no import)
99
125
  - fetch(url, options) — HTTP requests; response.ok/status/text()/json().
100
126
  - URLSearchParams — build/parse query strings.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-storefront-mcp",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
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",