@wix/mcp 1.0.87 → 1.0.89
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/build/bin-standalone.js +42 -0
- package/build/cjs/index.cjs +54 -2
- package/build/cjs/toolkit.cjs +54 -2
- package/build/dts/code-mode/index.js +13 -2
- package/build/dts/config/default-config.js +42 -0
- package/build/esm/index.js +54 -2
- package/build/esm/toolkit.js +54 -2
- package/package.json +2 -2
package/build/bin-standalone.js
CHANGED
|
@@ -71735,8 +71735,50 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
71735
71735
|
}
|
|
71736
71736
|
declare const wix: {
|
|
71737
71737
|
request<T = unknown>(options: WixRequestOptions): Promise<WixResponse<T>>;
|
|
71738
|
+
// Build a multipart/form-data body from files (defaults to the \`files\`
|
|
71739
|
+
// global). Each file becomes a part named fieldName (default "files") with
|
|
71740
|
+
// its path as the filename; \`body\` is bytes so binary parts stay intact.
|
|
71741
|
+
// Pass a base64 entry for binary (an image/font): { path, base64 }, or a
|
|
71742
|
+
// \`files\`-param entry tagged \`base64\`.
|
|
71743
|
+
multipart(
|
|
71744
|
+
files?: Array<{ path: string; content?: string; base64?: string; bytes?: Uint8Array; contentType?: string }>,
|
|
71745
|
+
options?: { fieldName?: string }
|
|
71746
|
+
): { body: Uint8Array; contentType: string };
|
|
71747
|
+
// Unzip a downloaded site archive (base64 string or bytes) into entries with
|
|
71748
|
+
// RAW bytes (binary-safe); entry.text() decodes a text file. Entries can be
|
|
71749
|
+
// passed straight back to wix.multipart() for a re-upload.
|
|
71750
|
+
unzip(input: string | Uint8Array): Promise<Array<{ path: string; bytes: Uint8Array; text(): string }>>;
|
|
71738
71751
|
};
|
|
71739
71752
|
declare const siteId: string | undefined;
|
|
71753
|
+
// Files from the ExecuteWixAPI \`files\` param. Text entries have \`content\`;
|
|
71754
|
+
// an entry tagged \`=== FILE: <path> base64 ===\` has encoding:'base64' and
|
|
71755
|
+
// base64 \`content\` (a binary file — image, font).
|
|
71756
|
+
declare const files: Array<{ path: string; content: string; encoding?: "base64" }>;
|
|
71757
|
+
\`\`\`
|
|
71758
|
+
|
|
71759
|
+
FILE UPLOADS: put every file in the \`files\` param (never inline in \`code\`). Text goes raw; a small binary (icon, logo, font) rides as a \`base64\`-tagged entry — large images/video are referenced by URL (\`<img src="https://...">\`), not bundled. \`wix.multipart()\` turns the whole set into one upload body (bytes, so binary is safe):
|
|
71760
|
+
\`\`\`javascript
|
|
71761
|
+
// files param:
|
|
71762
|
+
// === FILE: index.html ===
|
|
71763
|
+
// <!doctype html><img src="logo.png">...
|
|
71764
|
+
// === FILE: logo.png base64 ===
|
|
71765
|
+
// iVBORw0KGgoAAA...
|
|
71766
|
+
async () => {
|
|
71767
|
+
const mp = wix.multipart(); // all entries from the files param; base64 ones decoded to raw bytes
|
|
71768
|
+
const res = await wix.request({ scope: "account", method: "POST",
|
|
71769
|
+
url: "https://www.wixapis.com/.../drop",
|
|
71770
|
+
headers: { "Content-Type": mp.contentType }, body: mp.body });
|
|
71771
|
+
return res.data;
|
|
71772
|
+
}
|
|
71773
|
+
\`\`\`
|
|
71774
|
+
DOWNLOAD + EDIT + RE-UPLOAD: fetch the zip as base64, \`wix.unzip()\` it, edit text via \`entry.text()\`, keep binary as bytes, and hand the entries back to \`wix.multipart()\`:
|
|
71775
|
+
\`\`\`javascript
|
|
71776
|
+
const r = await wix.request({ scope: "account", method: "GET", responseType: "base64", url: zipUrl });
|
|
71777
|
+
const entries = await wix.unzip(r.data); // [{ path, bytes, text() }]
|
|
71778
|
+
const edited = entries.map(e => e.path === "index.html"
|
|
71779
|
+
? { path: e.path, content: e.text().replace("Old title", "New title") }
|
|
71780
|
+
: e); // images etc. pass through untouched as bytes
|
|
71781
|
+
const mp = wix.multipart(edited);
|
|
71740
71782
|
\`\`\`
|
|
71741
71783
|
`;
|
|
71742
71784
|
var EXECUTE_WIX_API_WQL = dedent_default`
|
package/build/cjs/index.cjs
CHANGED
|
@@ -37351,8 +37351,50 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
37351
37351
|
}
|
|
37352
37352
|
declare const wix: {
|
|
37353
37353
|
request<T = unknown>(options: WixRequestOptions): Promise<WixResponse<T>>;
|
|
37354
|
+
// Build a multipart/form-data body from files (defaults to the \`files\`
|
|
37355
|
+
// global). Each file becomes a part named fieldName (default "files") with
|
|
37356
|
+
// its path as the filename; \`body\` is bytes so binary parts stay intact.
|
|
37357
|
+
// Pass a base64 entry for binary (an image/font): { path, base64 }, or a
|
|
37358
|
+
// \`files\`-param entry tagged \`base64\`.
|
|
37359
|
+
multipart(
|
|
37360
|
+
files?: Array<{ path: string; content?: string; base64?: string; bytes?: Uint8Array; contentType?: string }>,
|
|
37361
|
+
options?: { fieldName?: string }
|
|
37362
|
+
): { body: Uint8Array; contentType: string };
|
|
37363
|
+
// Unzip a downloaded site archive (base64 string or bytes) into entries with
|
|
37364
|
+
// RAW bytes (binary-safe); entry.text() decodes a text file. Entries can be
|
|
37365
|
+
// passed straight back to wix.multipart() for a re-upload.
|
|
37366
|
+
unzip(input: string | Uint8Array): Promise<Array<{ path: string; bytes: Uint8Array; text(): string }>>;
|
|
37354
37367
|
};
|
|
37355
37368
|
declare const siteId: string | undefined;
|
|
37369
|
+
// Files from the ExecuteWixAPI \`files\` param. Text entries have \`content\`;
|
|
37370
|
+
// an entry tagged \`=== FILE: <path> base64 ===\` has encoding:'base64' and
|
|
37371
|
+
// base64 \`content\` (a binary file — image, font).
|
|
37372
|
+
declare const files: Array<{ path: string; content: string; encoding?: "base64" }>;
|
|
37373
|
+
\`\`\`
|
|
37374
|
+
|
|
37375
|
+
FILE UPLOADS: put every file in the \`files\` param (never inline in \`code\`). Text goes raw; a small binary (icon, logo, font) rides as a \`base64\`-tagged entry — large images/video are referenced by URL (\`<img src="https://...">\`), not bundled. \`wix.multipart()\` turns the whole set into one upload body (bytes, so binary is safe):
|
|
37376
|
+
\`\`\`javascript
|
|
37377
|
+
// files param:
|
|
37378
|
+
// === FILE: index.html ===
|
|
37379
|
+
// <!doctype html><img src="logo.png">...
|
|
37380
|
+
// === FILE: logo.png base64 ===
|
|
37381
|
+
// iVBORw0KGgoAAA...
|
|
37382
|
+
async () => {
|
|
37383
|
+
const mp = wix.multipart(); // all entries from the files param; base64 ones decoded to raw bytes
|
|
37384
|
+
const res = await wix.request({ scope: "account", method: "POST",
|
|
37385
|
+
url: "https://www.wixapis.com/.../drop",
|
|
37386
|
+
headers: { "Content-Type": mp.contentType }, body: mp.body });
|
|
37387
|
+
return res.data;
|
|
37388
|
+
}
|
|
37389
|
+
\`\`\`
|
|
37390
|
+
DOWNLOAD + EDIT + RE-UPLOAD: fetch the zip as base64, \`wix.unzip()\` it, edit text via \`entry.text()\`, keep binary as bytes, and hand the entries back to \`wix.multipart()\`:
|
|
37391
|
+
\`\`\`javascript
|
|
37392
|
+
const r = await wix.request({ scope: "account", method: "GET", responseType: "base64", url: zipUrl });
|
|
37393
|
+
const entries = await wix.unzip(r.data); // [{ path, bytes, text() }]
|
|
37394
|
+
const edited = entries.map(e => e.path === "index.html"
|
|
37395
|
+
? { path: e.path, content: e.text().replace("Old title", "New title") }
|
|
37396
|
+
: e); // images etc. pass through untouched as bytes
|
|
37397
|
+
const mp = wix.multipart(edited);
|
|
37356
37398
|
\`\`\`
|
|
37357
37399
|
`;
|
|
37358
37400
|
var EXECUTE_WIX_API_WQL = dedent_default`
|
|
@@ -53156,6 +53198,15 @@ function addExecuteTool(server, options) {
|
|
|
53156
53198
|
visitor ? "Whether this code creates, updates, deletes, publishes, imports, uploads, or otherwise mutates site data on the visitor\u2019s behalf. Set this to true for create/update/delete/bulk create/import/upload calls even if the reason is inspection, verification, or response-shape discovery. Read-only GET/query/list/search calls can use false." : "Whether this code creates, updates, deletes, publishes, installs, imports, uploads, or otherwise mutates Wix data or site/account state. Set this to true for create/update/delete/bulk create/import/upload calls even if the reason is inspection, verification, or response-shape discovery. Read-only GET/query/list/search calls can use false."
|
|
53157
53199
|
),
|
|
53158
53200
|
sourceDocUrls: external_exports.array(external_exports.string()).describe(d2.sourceDocUrls),
|
|
53201
|
+
files: external_exports.string().optional().describe(
|
|
53202
|
+
[
|
|
53203
|
+
"Optional bundle of raw file contents for uploads, so file bytes never go through the `code` JavaScript (no escaping, no string-literal/`${}`/backtick pitfalls). Never inline file contents in `code`.",
|
|
53204
|
+
"Format: sections delimited by a line `=== FILE: <path> ===` (text, raw) or `=== FILE: <path> base64 ===` (binary, base64); `<path>` is relative to the site root. Example:",
|
|
53205
|
+
'`=== FILE: index.html ===\\n<!doctype html><img src="logo.png">\\n=== FILE: assets/app.js ===\\nconsole.log(1)\\n=== FILE: logo.png base64 ===\\niVBORw0KGgo...`',
|
|
53206
|
+
'In `code` they are the `files` global (`{ path, content, encoding?: "base64" }[]`); `wix.multipart()` turns them into one binary-safe `multipart/form-data` body: `const mp = wix.multipart(); await wix.request({ scope: "account", method: "POST", url, headers: { "Content-Type": mp.contentType }, body: mp.body });`.',
|
|
53207
|
+
'Use base64 entries for small assets (icons, logos, fonts) and for files you downloaded and are re-uploading; large images/video go in by URL (`<img src="https://...">`), not in the bundle. A file containing a line exactly like the delimiter is not supported.'
|
|
53208
|
+
].join(" ")
|
|
53209
|
+
),
|
|
53159
53210
|
// Visitor mode takes an agent-supplied token and pins the site; account/site
|
|
53160
53211
|
// mode lets the agent pick the site.
|
|
53161
53212
|
...visitor ? {
|
|
@@ -53170,7 +53221,7 @@ function addExecuteTool(server, options) {
|
|
|
53170
53221
|
},
|
|
53171
53222
|
{ readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
53172
53223
|
async (rawArgs, extra) => {
|
|
53173
|
-
const { code, reason, hasMutations, sourceDocUrls, visitorToken } = rawArgs;
|
|
53224
|
+
const { code, reason, hasMutations, sourceDocUrls, visitorToken, files } = rawArgs;
|
|
53174
53225
|
const siteId = visitor ? visitor.siteId : rawArgs.siteId;
|
|
53175
53226
|
logger2.log(
|
|
53176
53227
|
`[ExecuteWixAPI]${visitor ? " (visitor)" : ""} Executing code (${code.length} chars), siteId=${siteId ?? "none"}, hasMutations=${hasMutations}, sourceDocUrls=${JSON.stringify(sourceDocUrls)}, reason="${reason}"`
|
|
@@ -53215,7 +53266,8 @@ function addExecuteTool(server, options) {
|
|
|
53215
53266
|
siteToken: visitor ? visitorToken : siteHeaders?.Authorization,
|
|
53216
53267
|
accountToken: visitor ? visitorToken : accountHeaders?.Authorization,
|
|
53217
53268
|
accountId: accountHeaders?.["wix-account-id"],
|
|
53218
|
-
siteAuthContext
|
|
53269
|
+
siteAuthContext,
|
|
53270
|
+
...files ? { files } : {}
|
|
53219
53271
|
},
|
|
53220
53272
|
visitor ? visitorToken : accountHeaders?.Authorization ?? siteHeaders?.Authorization,
|
|
53221
53273
|
codeModeFetch
|
package/build/cjs/toolkit.cjs
CHANGED
|
@@ -17838,8 +17838,50 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
17838
17838
|
}
|
|
17839
17839
|
declare const wix: {
|
|
17840
17840
|
request<T = unknown>(options: WixRequestOptions): Promise<WixResponse<T>>;
|
|
17841
|
+
// Build a multipart/form-data body from files (defaults to the \`files\`
|
|
17842
|
+
// global). Each file becomes a part named fieldName (default "files") with
|
|
17843
|
+
// its path as the filename; \`body\` is bytes so binary parts stay intact.
|
|
17844
|
+
// Pass a base64 entry for binary (an image/font): { path, base64 }, or a
|
|
17845
|
+
// \`files\`-param entry tagged \`base64\`.
|
|
17846
|
+
multipart(
|
|
17847
|
+
files?: Array<{ path: string; content?: string; base64?: string; bytes?: Uint8Array; contentType?: string }>,
|
|
17848
|
+
options?: { fieldName?: string }
|
|
17849
|
+
): { body: Uint8Array; contentType: string };
|
|
17850
|
+
// Unzip a downloaded site archive (base64 string or bytes) into entries with
|
|
17851
|
+
// RAW bytes (binary-safe); entry.text() decodes a text file. Entries can be
|
|
17852
|
+
// passed straight back to wix.multipart() for a re-upload.
|
|
17853
|
+
unzip(input: string | Uint8Array): Promise<Array<{ path: string; bytes: Uint8Array; text(): string }>>;
|
|
17841
17854
|
};
|
|
17842
17855
|
declare const siteId: string | undefined;
|
|
17856
|
+
// Files from the ExecuteWixAPI \`files\` param. Text entries have \`content\`;
|
|
17857
|
+
// an entry tagged \`=== FILE: <path> base64 ===\` has encoding:'base64' and
|
|
17858
|
+
// base64 \`content\` (a binary file — image, font).
|
|
17859
|
+
declare const files: Array<{ path: string; content: string; encoding?: "base64" }>;
|
|
17860
|
+
\`\`\`
|
|
17861
|
+
|
|
17862
|
+
FILE UPLOADS: put every file in the \`files\` param (never inline in \`code\`). Text goes raw; a small binary (icon, logo, font) rides as a \`base64\`-tagged entry — large images/video are referenced by URL (\`<img src="https://...">\`), not bundled. \`wix.multipart()\` turns the whole set into one upload body (bytes, so binary is safe):
|
|
17863
|
+
\`\`\`javascript
|
|
17864
|
+
// files param:
|
|
17865
|
+
// === FILE: index.html ===
|
|
17866
|
+
// <!doctype html><img src="logo.png">...
|
|
17867
|
+
// === FILE: logo.png base64 ===
|
|
17868
|
+
// iVBORw0KGgoAAA...
|
|
17869
|
+
async () => {
|
|
17870
|
+
const mp = wix.multipart(); // all entries from the files param; base64 ones decoded to raw bytes
|
|
17871
|
+
const res = await wix.request({ scope: "account", method: "POST",
|
|
17872
|
+
url: "https://www.wixapis.com/.../drop",
|
|
17873
|
+
headers: { "Content-Type": mp.contentType }, body: mp.body });
|
|
17874
|
+
return res.data;
|
|
17875
|
+
}
|
|
17876
|
+
\`\`\`
|
|
17877
|
+
DOWNLOAD + EDIT + RE-UPLOAD: fetch the zip as base64, \`wix.unzip()\` it, edit text via \`entry.text()\`, keep binary as bytes, and hand the entries back to \`wix.multipart()\`:
|
|
17878
|
+
\`\`\`javascript
|
|
17879
|
+
const r = await wix.request({ scope: "account", method: "GET", responseType: "base64", url: zipUrl });
|
|
17880
|
+
const entries = await wix.unzip(r.data); // [{ path, bytes, text() }]
|
|
17881
|
+
const edited = entries.map(e => e.path === "index.html"
|
|
17882
|
+
? { path: e.path, content: e.text().replace("Old title", "New title") }
|
|
17883
|
+
: e); // images etc. pass through untouched as bytes
|
|
17884
|
+
const mp = wix.multipart(edited);
|
|
17843
17885
|
\`\`\`
|
|
17844
17886
|
`;
|
|
17845
17887
|
var EXECUTE_WIX_API_WQL = dedent_default`
|
|
@@ -22299,6 +22341,15 @@ function addExecuteTool(server, options) {
|
|
|
22299
22341
|
visitor ? "Whether this code creates, updates, deletes, publishes, imports, uploads, or otherwise mutates site data on the visitor\u2019s behalf. Set this to true for create/update/delete/bulk create/import/upload calls even if the reason is inspection, verification, or response-shape discovery. Read-only GET/query/list/search calls can use false." : "Whether this code creates, updates, deletes, publishes, installs, imports, uploads, or otherwise mutates Wix data or site/account state. Set this to true for create/update/delete/bulk create/import/upload calls even if the reason is inspection, verification, or response-shape discovery. Read-only GET/query/list/search calls can use false."
|
|
22300
22342
|
),
|
|
22301
22343
|
sourceDocUrls: external_exports.array(external_exports.string()).describe(d.sourceDocUrls),
|
|
22344
|
+
files: external_exports.string().optional().describe(
|
|
22345
|
+
[
|
|
22346
|
+
"Optional bundle of raw file contents for uploads, so file bytes never go through the `code` JavaScript (no escaping, no string-literal/`${}`/backtick pitfalls). Never inline file contents in `code`.",
|
|
22347
|
+
"Format: sections delimited by a line `=== FILE: <path> ===` (text, raw) or `=== FILE: <path> base64 ===` (binary, base64); `<path>` is relative to the site root. Example:",
|
|
22348
|
+
'`=== FILE: index.html ===\\n<!doctype html><img src="logo.png">\\n=== FILE: assets/app.js ===\\nconsole.log(1)\\n=== FILE: logo.png base64 ===\\niVBORw0KGgo...`',
|
|
22349
|
+
'In `code` they are the `files` global (`{ path, content, encoding?: "base64" }[]`); `wix.multipart()` turns them into one binary-safe `multipart/form-data` body: `const mp = wix.multipart(); await wix.request({ scope: "account", method: "POST", url, headers: { "Content-Type": mp.contentType }, body: mp.body });`.',
|
|
22350
|
+
'Use base64 entries for small assets (icons, logos, fonts) and for files you downloaded and are re-uploading; large images/video go in by URL (`<img src="https://...">`), not in the bundle. A file containing a line exactly like the delimiter is not supported.'
|
|
22351
|
+
].join(" ")
|
|
22352
|
+
),
|
|
22302
22353
|
// Visitor mode takes an agent-supplied token and pins the site; account/site
|
|
22303
22354
|
// mode lets the agent pick the site.
|
|
22304
22355
|
...visitor ? {
|
|
@@ -22313,7 +22364,7 @@ function addExecuteTool(server, options) {
|
|
|
22313
22364
|
},
|
|
22314
22365
|
{ readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
22315
22366
|
async (rawArgs, extra) => {
|
|
22316
|
-
const { code, reason, hasMutations, sourceDocUrls, visitorToken } = rawArgs;
|
|
22367
|
+
const { code, reason, hasMutations, sourceDocUrls, visitorToken, files } = rawArgs;
|
|
22317
22368
|
const siteId = visitor ? visitor.siteId : rawArgs.siteId;
|
|
22318
22369
|
logger.log(
|
|
22319
22370
|
`[ExecuteWixAPI]${visitor ? " (visitor)" : ""} Executing code (${code.length} chars), siteId=${siteId ?? "none"}, hasMutations=${hasMutations}, sourceDocUrls=${JSON.stringify(sourceDocUrls)}, reason="${reason}"`
|
|
@@ -22358,7 +22409,8 @@ function addExecuteTool(server, options) {
|
|
|
22358
22409
|
siteToken: visitor ? visitorToken : siteHeaders?.Authorization,
|
|
22359
22410
|
accountToken: visitor ? visitorToken : accountHeaders?.Authorization,
|
|
22360
22411
|
accountId: accountHeaders?.["wix-account-id"],
|
|
22361
|
-
siteAuthContext
|
|
22412
|
+
siteAuthContext,
|
|
22413
|
+
...files ? { files } : {}
|
|
22362
22414
|
},
|
|
22363
22415
|
visitor ? visitorToken : accountHeaders?.Authorization ?? siteHeaders?.Authorization,
|
|
22364
22416
|
codeModeFetch
|
|
@@ -236,6 +236,16 @@ function addExecuteTool(server, options) {
|
|
|
236
236
|
? 'Whether this code creates, updates, deletes, publishes, imports, uploads, or otherwise mutates site data on the visitor’s behalf. Set this to true for create/update/delete/bulk create/import/upload calls even if the reason is inspection, verification, or response-shape discovery. Read-only GET/query/list/search calls can use false.'
|
|
237
237
|
: 'Whether this code creates, updates, deletes, publishes, installs, imports, uploads, or otherwise mutates Wix data or site/account state. Set this to true for create/update/delete/bulk create/import/upload calls even if the reason is inspection, verification, or response-shape discovery. Read-only GET/query/list/search calls can use false.'),
|
|
238
238
|
sourceDocUrls: z.array(z.string()).describe(d.sourceDocUrls),
|
|
239
|
+
files: z
|
|
240
|
+
.string()
|
|
241
|
+
.optional()
|
|
242
|
+
.describe([
|
|
243
|
+
'Optional bundle of raw file contents for uploads, so file bytes never go through the `code` JavaScript (no escaping, no string-literal/`${}`/backtick pitfalls). Never inline file contents in `code`.',
|
|
244
|
+
'Format: sections delimited by a line `=== FILE: <path> ===` (text, raw) or `=== FILE: <path> base64 ===` (binary, base64); `<path>` is relative to the site root. Example:',
|
|
245
|
+
'`=== FILE: index.html ===\\n<!doctype html><img src="logo.png">\\n=== FILE: assets/app.js ===\\nconsole.log(1)\\n=== FILE: logo.png base64 ===\\niVBORw0KGgo...`',
|
|
246
|
+
'In `code` they are the `files` global (`{ path, content, encoding?: "base64" }[]`); `wix.multipart()` turns them into one binary-safe `multipart/form-data` body: `const mp = wix.multipart(); await wix.request({ scope: "account", method: "POST", url, headers: { "Content-Type": mp.contentType }, body: mp.body });`.',
|
|
247
|
+
'Use base64 entries for small assets (icons, logos, fonts) and for files you downloaded and are re-uploading; large images/video go in by URL (`<img src="https://...">`), not in the bundle. A file containing a line exactly like the delimiter is not supported.'
|
|
248
|
+
].join(' ')),
|
|
239
249
|
// Visitor mode takes an agent-supplied token and pins the site; account/site
|
|
240
250
|
// mode lets the agent pick the site.
|
|
241
251
|
...(visitor
|
|
@@ -254,7 +264,7 @@ function addExecuteTool(server, options) {
|
|
|
254
264
|
// Partial: duck-typed servers (the toolkit's capturing server, test
|
|
255
265
|
// doubles) build their own extra and may not supply every field.
|
|
256
266
|
extra) => {
|
|
257
|
-
const { code, reason, hasMutations, sourceDocUrls, visitorToken } = rawArgs;
|
|
267
|
+
const { code, reason, hasMutations, sourceDocUrls, visitorToken, files } = rawArgs;
|
|
258
268
|
// In visitor mode the site is pinned; otherwise it comes from the param.
|
|
259
269
|
const siteId = visitor ? visitor.siteId : rawArgs.siteId;
|
|
260
270
|
logger.log(`[ExecuteWixAPI]${visitor ? ' (visitor)' : ''} Executing code (${code.length} chars), siteId=${siteId ?? 'none'}, hasMutations=${hasMutations}, sourceDocUrls=${JSON.stringify(sourceDocUrls)}, reason="${reason}"`);
|
|
@@ -318,7 +328,8 @@ function addExecuteTool(server, options) {
|
|
|
318
328
|
? visitorToken
|
|
319
329
|
: accountHeaders?.Authorization,
|
|
320
330
|
accountId: accountHeaders?.['wix-account-id'],
|
|
321
|
-
siteAuthContext
|
|
331
|
+
siteAuthContext,
|
|
332
|
+
...(files ? { files } : {})
|
|
322
333
|
}, visitor
|
|
323
334
|
? visitorToken
|
|
324
335
|
: (accountHeaders?.Authorization ?? siteHeaders?.Authorization), codeModeFetch);
|
|
@@ -165,8 +165,50 @@ const ACCOUNT_SITE_EXECUTE_SCOPE = dedent `
|
|
|
165
165
|
}
|
|
166
166
|
declare const wix: {
|
|
167
167
|
request<T = unknown>(options: WixRequestOptions): Promise<WixResponse<T>>;
|
|
168
|
+
// Build a multipart/form-data body from files (defaults to the \`files\`
|
|
169
|
+
// global). Each file becomes a part named fieldName (default "files") with
|
|
170
|
+
// its path as the filename; \`body\` is bytes so binary parts stay intact.
|
|
171
|
+
// Pass a base64 entry for binary (an image/font): { path, base64 }, or a
|
|
172
|
+
// \`files\`-param entry tagged \`base64\`.
|
|
173
|
+
multipart(
|
|
174
|
+
files?: Array<{ path: string; content?: string; base64?: string; bytes?: Uint8Array; contentType?: string }>,
|
|
175
|
+
options?: { fieldName?: string }
|
|
176
|
+
): { body: Uint8Array; contentType: string };
|
|
177
|
+
// Unzip a downloaded site archive (base64 string or bytes) into entries with
|
|
178
|
+
// RAW bytes (binary-safe); entry.text() decodes a text file. Entries can be
|
|
179
|
+
// passed straight back to wix.multipart() for a re-upload.
|
|
180
|
+
unzip(input: string | Uint8Array): Promise<Array<{ path: string; bytes: Uint8Array; text(): string }>>;
|
|
168
181
|
};
|
|
169
182
|
declare const siteId: string | undefined;
|
|
183
|
+
// Files from the ExecuteWixAPI \`files\` param. Text entries have \`content\`;
|
|
184
|
+
// an entry tagged \`=== FILE: <path> base64 ===\` has encoding:'base64' and
|
|
185
|
+
// base64 \`content\` (a binary file — image, font).
|
|
186
|
+
declare const files: Array<{ path: string; content: string; encoding?: "base64" }>;
|
|
187
|
+
\`\`\`
|
|
188
|
+
|
|
189
|
+
FILE UPLOADS: put every file in the \`files\` param (never inline in \`code\`). Text goes raw; a small binary (icon, logo, font) rides as a \`base64\`-tagged entry — large images/video are referenced by URL (\`<img src="https://...">\`), not bundled. \`wix.multipart()\` turns the whole set into one upload body (bytes, so binary is safe):
|
|
190
|
+
\`\`\`javascript
|
|
191
|
+
// files param:
|
|
192
|
+
// === FILE: index.html ===
|
|
193
|
+
// <!doctype html><img src="logo.png">...
|
|
194
|
+
// === FILE: logo.png base64 ===
|
|
195
|
+
// iVBORw0KGgoAAA...
|
|
196
|
+
async () => {
|
|
197
|
+
const mp = wix.multipart(); // all entries from the files param; base64 ones decoded to raw bytes
|
|
198
|
+
const res = await wix.request({ scope: "account", method: "POST",
|
|
199
|
+
url: "https://www.wixapis.com/.../drop",
|
|
200
|
+
headers: { "Content-Type": mp.contentType }, body: mp.body });
|
|
201
|
+
return res.data;
|
|
202
|
+
}
|
|
203
|
+
\`\`\`
|
|
204
|
+
DOWNLOAD + EDIT + RE-UPLOAD: fetch the zip as base64, \`wix.unzip()\` it, edit text via \`entry.text()\`, keep binary as bytes, and hand the entries back to \`wix.multipart()\`:
|
|
205
|
+
\`\`\`javascript
|
|
206
|
+
const r = await wix.request({ scope: "account", method: "GET", responseType: "base64", url: zipUrl });
|
|
207
|
+
const entries = await wix.unzip(r.data); // [{ path, bytes, text() }]
|
|
208
|
+
const edited = entries.map(e => e.path === "index.html"
|
|
209
|
+
? { path: e.path, content: e.text().replace("Old title", "New title") }
|
|
210
|
+
: e); // images etc. pass through untouched as bytes
|
|
211
|
+
const mp = wix.multipart(edited);
|
|
170
212
|
\`\`\`
|
|
171
213
|
`;
|
|
172
214
|
const EXECUTE_WIX_API_WQL = dedent `
|
package/build/esm/index.js
CHANGED
|
@@ -31064,8 +31064,50 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
31064
31064
|
}
|
|
31065
31065
|
declare const wix: {
|
|
31066
31066
|
request<T = unknown>(options: WixRequestOptions): Promise<WixResponse<T>>;
|
|
31067
|
+
// Build a multipart/form-data body from files (defaults to the \`files\`
|
|
31068
|
+
// global). Each file becomes a part named fieldName (default "files") with
|
|
31069
|
+
// its path as the filename; \`body\` is bytes so binary parts stay intact.
|
|
31070
|
+
// Pass a base64 entry for binary (an image/font): { path, base64 }, or a
|
|
31071
|
+
// \`files\`-param entry tagged \`base64\`.
|
|
31072
|
+
multipart(
|
|
31073
|
+
files?: Array<{ path: string; content?: string; base64?: string; bytes?: Uint8Array; contentType?: string }>,
|
|
31074
|
+
options?: { fieldName?: string }
|
|
31075
|
+
): { body: Uint8Array; contentType: string };
|
|
31076
|
+
// Unzip a downloaded site archive (base64 string or bytes) into entries with
|
|
31077
|
+
// RAW bytes (binary-safe); entry.text() decodes a text file. Entries can be
|
|
31078
|
+
// passed straight back to wix.multipart() for a re-upload.
|
|
31079
|
+
unzip(input: string | Uint8Array): Promise<Array<{ path: string; bytes: Uint8Array; text(): string }>>;
|
|
31067
31080
|
};
|
|
31068
31081
|
declare const siteId: string | undefined;
|
|
31082
|
+
// Files from the ExecuteWixAPI \`files\` param. Text entries have \`content\`;
|
|
31083
|
+
// an entry tagged \`=== FILE: <path> base64 ===\` has encoding:'base64' and
|
|
31084
|
+
// base64 \`content\` (a binary file — image, font).
|
|
31085
|
+
declare const files: Array<{ path: string; content: string; encoding?: "base64" }>;
|
|
31086
|
+
\`\`\`
|
|
31087
|
+
|
|
31088
|
+
FILE UPLOADS: put every file in the \`files\` param (never inline in \`code\`). Text goes raw; a small binary (icon, logo, font) rides as a \`base64\`-tagged entry — large images/video are referenced by URL (\`<img src="https://...">\`), not bundled. \`wix.multipart()\` turns the whole set into one upload body (bytes, so binary is safe):
|
|
31089
|
+
\`\`\`javascript
|
|
31090
|
+
// files param:
|
|
31091
|
+
// === FILE: index.html ===
|
|
31092
|
+
// <!doctype html><img src="logo.png">...
|
|
31093
|
+
// === FILE: logo.png base64 ===
|
|
31094
|
+
// iVBORw0KGgoAAA...
|
|
31095
|
+
async () => {
|
|
31096
|
+
const mp = wix.multipart(); // all entries from the files param; base64 ones decoded to raw bytes
|
|
31097
|
+
const res = await wix.request({ scope: "account", method: "POST",
|
|
31098
|
+
url: "https://www.wixapis.com/.../drop",
|
|
31099
|
+
headers: { "Content-Type": mp.contentType }, body: mp.body });
|
|
31100
|
+
return res.data;
|
|
31101
|
+
}
|
|
31102
|
+
\`\`\`
|
|
31103
|
+
DOWNLOAD + EDIT + RE-UPLOAD: fetch the zip as base64, \`wix.unzip()\` it, edit text via \`entry.text()\`, keep binary as bytes, and hand the entries back to \`wix.multipart()\`:
|
|
31104
|
+
\`\`\`javascript
|
|
31105
|
+
const r = await wix.request({ scope: "account", method: "GET", responseType: "base64", url: zipUrl });
|
|
31106
|
+
const entries = await wix.unzip(r.data); // [{ path, bytes, text() }]
|
|
31107
|
+
const edited = entries.map(e => e.path === "index.html"
|
|
31108
|
+
? { path: e.path, content: e.text().replace("Old title", "New title") }
|
|
31109
|
+
: e); // images etc. pass through untouched as bytes
|
|
31110
|
+
const mp = wix.multipart(edited);
|
|
31069
31111
|
\`\`\`
|
|
31070
31112
|
`;
|
|
31071
31113
|
var EXECUTE_WIX_API_WQL = dedent_default`
|
|
@@ -46920,6 +46962,15 @@ function addExecuteTool(server, options) {
|
|
|
46920
46962
|
visitor ? "Whether this code creates, updates, deletes, publishes, imports, uploads, or otherwise mutates site data on the visitor\u2019s behalf. Set this to true for create/update/delete/bulk create/import/upload calls even if the reason is inspection, verification, or response-shape discovery. Read-only GET/query/list/search calls can use false." : "Whether this code creates, updates, deletes, publishes, installs, imports, uploads, or otherwise mutates Wix data or site/account state. Set this to true for create/update/delete/bulk create/import/upload calls even if the reason is inspection, verification, or response-shape discovery. Read-only GET/query/list/search calls can use false."
|
|
46921
46963
|
),
|
|
46922
46964
|
sourceDocUrls: external_exports.array(external_exports.string()).describe(d2.sourceDocUrls),
|
|
46965
|
+
files: external_exports.string().optional().describe(
|
|
46966
|
+
[
|
|
46967
|
+
"Optional bundle of raw file contents for uploads, so file bytes never go through the `code` JavaScript (no escaping, no string-literal/`${}`/backtick pitfalls). Never inline file contents in `code`.",
|
|
46968
|
+
"Format: sections delimited by a line `=== FILE: <path> ===` (text, raw) or `=== FILE: <path> base64 ===` (binary, base64); `<path>` is relative to the site root. Example:",
|
|
46969
|
+
'`=== FILE: index.html ===\\n<!doctype html><img src="logo.png">\\n=== FILE: assets/app.js ===\\nconsole.log(1)\\n=== FILE: logo.png base64 ===\\niVBORw0KGgo...`',
|
|
46970
|
+
'In `code` they are the `files` global (`{ path, content, encoding?: "base64" }[]`); `wix.multipart()` turns them into one binary-safe `multipart/form-data` body: `const mp = wix.multipart(); await wix.request({ scope: "account", method: "POST", url, headers: { "Content-Type": mp.contentType }, body: mp.body });`.',
|
|
46971
|
+
'Use base64 entries for small assets (icons, logos, fonts) and for files you downloaded and are re-uploading; large images/video go in by URL (`<img src="https://...">`), not in the bundle. A file containing a line exactly like the delimiter is not supported.'
|
|
46972
|
+
].join(" ")
|
|
46973
|
+
),
|
|
46923
46974
|
// Visitor mode takes an agent-supplied token and pins the site; account/site
|
|
46924
46975
|
// mode lets the agent pick the site.
|
|
46925
46976
|
...visitor ? {
|
|
@@ -46934,7 +46985,7 @@ function addExecuteTool(server, options) {
|
|
|
46934
46985
|
},
|
|
46935
46986
|
{ readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
46936
46987
|
async (rawArgs, extra) => {
|
|
46937
|
-
const { code, reason, hasMutations, sourceDocUrls, visitorToken } = rawArgs;
|
|
46988
|
+
const { code, reason, hasMutations, sourceDocUrls, visitorToken, files } = rawArgs;
|
|
46938
46989
|
const siteId = visitor ? visitor.siteId : rawArgs.siteId;
|
|
46939
46990
|
logger2.log(
|
|
46940
46991
|
`[ExecuteWixAPI]${visitor ? " (visitor)" : ""} Executing code (${code.length} chars), siteId=${siteId ?? "none"}, hasMutations=${hasMutations}, sourceDocUrls=${JSON.stringify(sourceDocUrls)}, reason="${reason}"`
|
|
@@ -46979,7 +47030,8 @@ function addExecuteTool(server, options) {
|
|
|
46979
47030
|
siteToken: visitor ? visitorToken : siteHeaders?.Authorization,
|
|
46980
47031
|
accountToken: visitor ? visitorToken : accountHeaders?.Authorization,
|
|
46981
47032
|
accountId: accountHeaders?.["wix-account-id"],
|
|
46982
|
-
siteAuthContext
|
|
47033
|
+
siteAuthContext,
|
|
47034
|
+
...files ? { files } : {}
|
|
46983
47035
|
},
|
|
46984
47036
|
visitor ? visitorToken : accountHeaders?.Authorization ?? siteHeaders?.Authorization,
|
|
46985
47037
|
codeModeFetch
|
package/build/esm/toolkit.js
CHANGED
|
@@ -12260,8 +12260,50 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
12260
12260
|
}
|
|
12261
12261
|
declare const wix: {
|
|
12262
12262
|
request<T = unknown>(options: WixRequestOptions): Promise<WixResponse<T>>;
|
|
12263
|
+
// Build a multipart/form-data body from files (defaults to the \`files\`
|
|
12264
|
+
// global). Each file becomes a part named fieldName (default "files") with
|
|
12265
|
+
// its path as the filename; \`body\` is bytes so binary parts stay intact.
|
|
12266
|
+
// Pass a base64 entry for binary (an image/font): { path, base64 }, or a
|
|
12267
|
+
// \`files\`-param entry tagged \`base64\`.
|
|
12268
|
+
multipart(
|
|
12269
|
+
files?: Array<{ path: string; content?: string; base64?: string; bytes?: Uint8Array; contentType?: string }>,
|
|
12270
|
+
options?: { fieldName?: string }
|
|
12271
|
+
): { body: Uint8Array; contentType: string };
|
|
12272
|
+
// Unzip a downloaded site archive (base64 string or bytes) into entries with
|
|
12273
|
+
// RAW bytes (binary-safe); entry.text() decodes a text file. Entries can be
|
|
12274
|
+
// passed straight back to wix.multipart() for a re-upload.
|
|
12275
|
+
unzip(input: string | Uint8Array): Promise<Array<{ path: string; bytes: Uint8Array; text(): string }>>;
|
|
12263
12276
|
};
|
|
12264
12277
|
declare const siteId: string | undefined;
|
|
12278
|
+
// Files from the ExecuteWixAPI \`files\` param. Text entries have \`content\`;
|
|
12279
|
+
// an entry tagged \`=== FILE: <path> base64 ===\` has encoding:'base64' and
|
|
12280
|
+
// base64 \`content\` (a binary file — image, font).
|
|
12281
|
+
declare const files: Array<{ path: string; content: string; encoding?: "base64" }>;
|
|
12282
|
+
\`\`\`
|
|
12283
|
+
|
|
12284
|
+
FILE UPLOADS: put every file in the \`files\` param (never inline in \`code\`). Text goes raw; a small binary (icon, logo, font) rides as a \`base64\`-tagged entry — large images/video are referenced by URL (\`<img src="https://...">\`), not bundled. \`wix.multipart()\` turns the whole set into one upload body (bytes, so binary is safe):
|
|
12285
|
+
\`\`\`javascript
|
|
12286
|
+
// files param:
|
|
12287
|
+
// === FILE: index.html ===
|
|
12288
|
+
// <!doctype html><img src="logo.png">...
|
|
12289
|
+
// === FILE: logo.png base64 ===
|
|
12290
|
+
// iVBORw0KGgoAAA...
|
|
12291
|
+
async () => {
|
|
12292
|
+
const mp = wix.multipart(); // all entries from the files param; base64 ones decoded to raw bytes
|
|
12293
|
+
const res = await wix.request({ scope: "account", method: "POST",
|
|
12294
|
+
url: "https://www.wixapis.com/.../drop",
|
|
12295
|
+
headers: { "Content-Type": mp.contentType }, body: mp.body });
|
|
12296
|
+
return res.data;
|
|
12297
|
+
}
|
|
12298
|
+
\`\`\`
|
|
12299
|
+
DOWNLOAD + EDIT + RE-UPLOAD: fetch the zip as base64, \`wix.unzip()\` it, edit text via \`entry.text()\`, keep binary as bytes, and hand the entries back to \`wix.multipart()\`:
|
|
12300
|
+
\`\`\`javascript
|
|
12301
|
+
const r = await wix.request({ scope: "account", method: "GET", responseType: "base64", url: zipUrl });
|
|
12302
|
+
const entries = await wix.unzip(r.data); // [{ path, bytes, text() }]
|
|
12303
|
+
const edited = entries.map(e => e.path === "index.html"
|
|
12304
|
+
? { path: e.path, content: e.text().replace("Old title", "New title") }
|
|
12305
|
+
: e); // images etc. pass through untouched as bytes
|
|
12306
|
+
const mp = wix.multipart(edited);
|
|
12265
12307
|
\`\`\`
|
|
12266
12308
|
`;
|
|
12267
12309
|
var EXECUTE_WIX_API_WQL = dedent_default`
|
|
@@ -16718,6 +16760,15 @@ function addExecuteTool(server, options) {
|
|
|
16718
16760
|
visitor ? "Whether this code creates, updates, deletes, publishes, imports, uploads, or otherwise mutates site data on the visitor\u2019s behalf. Set this to true for create/update/delete/bulk create/import/upload calls even if the reason is inspection, verification, or response-shape discovery. Read-only GET/query/list/search calls can use false." : "Whether this code creates, updates, deletes, publishes, installs, imports, uploads, or otherwise mutates Wix data or site/account state. Set this to true for create/update/delete/bulk create/import/upload calls even if the reason is inspection, verification, or response-shape discovery. Read-only GET/query/list/search calls can use false."
|
|
16719
16761
|
),
|
|
16720
16762
|
sourceDocUrls: external_exports.array(external_exports.string()).describe(d.sourceDocUrls),
|
|
16763
|
+
files: external_exports.string().optional().describe(
|
|
16764
|
+
[
|
|
16765
|
+
"Optional bundle of raw file contents for uploads, so file bytes never go through the `code` JavaScript (no escaping, no string-literal/`${}`/backtick pitfalls). Never inline file contents in `code`.",
|
|
16766
|
+
"Format: sections delimited by a line `=== FILE: <path> ===` (text, raw) or `=== FILE: <path> base64 ===` (binary, base64); `<path>` is relative to the site root. Example:",
|
|
16767
|
+
'`=== FILE: index.html ===\\n<!doctype html><img src="logo.png">\\n=== FILE: assets/app.js ===\\nconsole.log(1)\\n=== FILE: logo.png base64 ===\\niVBORw0KGgo...`',
|
|
16768
|
+
'In `code` they are the `files` global (`{ path, content, encoding?: "base64" }[]`); `wix.multipart()` turns them into one binary-safe `multipart/form-data` body: `const mp = wix.multipart(); await wix.request({ scope: "account", method: "POST", url, headers: { "Content-Type": mp.contentType }, body: mp.body });`.',
|
|
16769
|
+
'Use base64 entries for small assets (icons, logos, fonts) and for files you downloaded and are re-uploading; large images/video go in by URL (`<img src="https://...">`), not in the bundle. A file containing a line exactly like the delimiter is not supported.'
|
|
16770
|
+
].join(" ")
|
|
16771
|
+
),
|
|
16721
16772
|
// Visitor mode takes an agent-supplied token and pins the site; account/site
|
|
16722
16773
|
// mode lets the agent pick the site.
|
|
16723
16774
|
...visitor ? {
|
|
@@ -16732,7 +16783,7 @@ function addExecuteTool(server, options) {
|
|
|
16732
16783
|
},
|
|
16733
16784
|
{ readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
16734
16785
|
async (rawArgs, extra) => {
|
|
16735
|
-
const { code, reason, hasMutations, sourceDocUrls, visitorToken } = rawArgs;
|
|
16786
|
+
const { code, reason, hasMutations, sourceDocUrls, visitorToken, files } = rawArgs;
|
|
16736
16787
|
const siteId = visitor ? visitor.siteId : rawArgs.siteId;
|
|
16737
16788
|
logger.log(
|
|
16738
16789
|
`[ExecuteWixAPI]${visitor ? " (visitor)" : ""} Executing code (${code.length} chars), siteId=${siteId ?? "none"}, hasMutations=${hasMutations}, sourceDocUrls=${JSON.stringify(sourceDocUrls)}, reason="${reason}"`
|
|
@@ -16777,7 +16828,8 @@ function addExecuteTool(server, options) {
|
|
|
16777
16828
|
siteToken: visitor ? visitorToken : siteHeaders?.Authorization,
|
|
16778
16829
|
accountToken: visitor ? visitorToken : accountHeaders?.Authorization,
|
|
16779
16830
|
accountId: accountHeaders?.["wix-account-id"],
|
|
16780
|
-
siteAuthContext
|
|
16831
|
+
siteAuthContext,
|
|
16832
|
+
...files ? { files } : {}
|
|
16781
16833
|
},
|
|
16782
16834
|
visitor ? visitorToken : accountHeaders?.Authorization ?? siteHeaders?.Authorization,
|
|
16783
16835
|
codeModeFetch
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.89",
|
|
4
4
|
"description": "A Model Context Protocol server for Wix AI tools",
|
|
5
5
|
"bin": "./build/bin-standalone.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
]
|
|
134
134
|
}
|
|
135
135
|
},
|
|
136
|
-
"falconPackageHash": "
|
|
136
|
+
"falconPackageHash": "56dddfd3c4abc5ee20298c4a7f54f409dc405abaf86f58fcc82d48ab"
|
|
137
137
|
}
|