@wix/mcp 1.0.80 → 1.0.82
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/README.md +1 -1
- package/build/bin-standalone.js +93 -31
- package/build/cjs/index.cjs +151 -380
- package/build/cjs/toolkit.cjs +97 -33
- package/build/dts/api-call/index.js +41 -3
- package/build/dts/code-mode/index.js +8 -2
- package/build/dts/config/api-request-rules.d.ts +11 -0
- package/build/dts/config/api-request-rules.js +11 -0
- package/build/dts/config/default-config.js +13 -3
- package/build/dts/config/param-descriptions.d.ts +1 -1
- package/build/dts/config/param-descriptions.js +5 -3
- package/build/dts/docs/docs.js +6 -6
- package/build/dts/import-claude-design-tool/index.js +2 -2
- package/build/dts/infra/tool-bi.d.ts +1 -1
- package/build/dts/infra/tool-bi.js +3 -2
- package/build/dts/site-widget-tools/constants.d.ts +12 -5
- package/build/dts/site-widget-tools/constants.js +20 -11
- package/build/dts/site-widget-tools/site-builder-tool/index.js +1 -1
- package/build/dts/site-widget-tools/site-creation-tool/index.js +3 -2
- package/build/dts/site-widget-tools/suggested-domain-tool/index.js +23 -5
- package/build/dts/toolkit-entry.d.cts +1 -1
- package/build/dts/toolkit-entry.d.ts +1 -1
- package/build/dts/toolkit.js +4 -1
- package/build/dts/wix-mcp-server.d.ts +4 -0
- package/build/dts/wix-mcp-server.js +9 -1
- package/build/dts/wixel/api.d.ts +0 -60
- package/build/dts/wixel/api.js +1 -50
- package/build/dts/wixel/constants.d.ts +0 -1
- package/build/dts/wixel/constants.js +0 -1
- package/build/dts/wixel/index.d.ts +0 -3
- package/build/dts/wixel/index.js +0 -9
- package/build/esm/index.js +151 -377
- package/build/esm/toolkit.js +97 -33
- package/package.json +3 -3
- package/build/dts/wixel/open-headless-wixel-project-tool.d.ts +0 -6
- package/build/dts/wixel/open-headless-wixel-project-tool.js +0 -84
- package/build/dts/wixel/pull-headless-wixel-job-tool.d.ts +0 -6
- package/build/dts/wixel/pull-headless-wixel-job-tool.js +0 -61
- package/build/dts/wixel/update-headless-wixel-job-tool.d.ts +0 -6
- package/build/dts/wixel/update-headless-wixel-job-tool.js +0 -106
package/build/esm/toolkit.js
CHANGED
|
@@ -12075,6 +12075,9 @@ function rethrowIfUnauthorized(error) {
|
|
|
12075
12075
|
}
|
|
12076
12076
|
}
|
|
12077
12077
|
|
|
12078
|
+
// src/config/api-request-rules.ts
|
|
12079
|
+
var ARRAY_QUERY_PARAMS_RULE = "Repeat array query params once per value: `?fieldsets=URL&fieldsets=RICH_CONTENT`. Do NOT comma-join values (`fieldsets=URL,RICH_CONTENT`), do NOT leave a trailing comma, and do NOT use a value the method schema does not list, even if a sibling method accepts it (draft posts have no `SEO` fieldset).";
|
|
12080
|
+
|
|
12078
12081
|
// src/config/default-config.ts
|
|
12079
12082
|
var AGENT_GOAL = dedent_default`
|
|
12080
12083
|
You are an agent that helps the user manage their Wix site.
|
|
@@ -12174,6 +12177,8 @@ var SITE_CREATION_COPY = {
|
|
|
12174
12177
|
var SITE_GUIDANCE = dedent_default`
|
|
12175
12178
|
A new-site request has two things to settle: what the site is for, and how to build it. The how is AI generation vs. starting from a template, so naming templates, a template id or Wix Studio (Wix Studio is also the template side) already settles it.
|
|
12176
12179
|
|
|
12180
|
+
One case skips all of this: the user ALREADY HAS the finished site as files — hand-written HTML/CSS/JS, a zip, or the export of an AI builder. There is nothing to build, so don't offer AI or templates and don't call any site-creation tool. Send them to https://www.wix.com/headless/drop?utm_campaign=mcp — they drag the files in and get a live Wix-hosted site. Give that URL exactly as written, keeping the utm_campaign=mcp parameter.
|
|
12181
|
+
|
|
12177
12182
|
Settle what the site is for first: its purpose, topic, business type, audience, or main visitor action. Naming a method is not a description of the site, and neither is the business or industry on its own.
|
|
12178
12183
|
If you can't tell yet, ask the preferred question below and nothing else — one question, no creation-method question in the same reply, and no internal tool names.
|
|
12179
12184
|
Once the purpose is clear, unless the user already named a method, ${SITE_CREATION_COPY.unstatedMethod.nonWidget}. A method they named is settled — never re-open it. Never default to AI or to templates, and never ask the user to choose between Harmony and Wix Studio; infer that from their words.
|
|
@@ -12196,11 +12201,13 @@ var EXECUTE_WIX_API_INTRO = dedent_default`
|
|
|
12196
12201
|
CODE CONTRACT:
|
|
12197
12202
|
- Pass an async function expression: \`async function() { ... }\` or \`async () => { ... }\`. Put every declaration, \`await\`, and \`return\` inside it, and do not invoke it yourself.
|
|
12198
12203
|
- Use only \`wix.request({ method, url, body })\` and in-memory JavaScript. Node.js modules, filesystem access, and downloadable-file creation are unavailable.
|
|
12204
|
+
- Do not minify the code. Put each object property on its own line, with spaces after colons and commas, and declare deep literals (request bodies, filters, patch lists) as a named \`const\` before use so each \`wix.request({ ... })\` argument stays short.
|
|
12199
12205
|
|
|
12200
12206
|
CONFIRM API CONTRACTS:
|
|
12201
12207
|
- Do not rely on memory for endpoints, methods, bodies, response paths, filters, enum values, or auth scope. Confirm every method from conversation-provided details, a complete matching docs example, or the schema/docs tools before executing.
|
|
12202
12208
|
- Prefer \`method.publicUrl\` from SearchWixAPISpec; never use \`method.servers[0]\`. Pass all supporting documentation URLs through \`sourceDocUrls\`.
|
|
12203
12209
|
- A response field is not automatically filterable or sortable. Use only capabilities declared for that exact query/search method. If an unsupported filter is unavoidable, fetch a bounded result set and filter it in code.
|
|
12210
|
+
- ${ARRAY_QUERY_PARAMS_RULE}
|
|
12204
12211
|
- Read-only probes may inspect state or resolve IDs. Never use speculative create/update/delete calls to discover request or response shapes, and never repeat a successful mutation merely to obtain more response data.
|
|
12205
12212
|
`;
|
|
12206
12213
|
var EXECUTE_WIX_API_OUTPUT_AND_ERRORS = dedent_default`
|
|
@@ -12216,6 +12223,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
12216
12223
|
SCOPE AND SITE TARGETING:
|
|
12217
12224
|
- Set \`scope: "site"\` for site-level APIs and \`scope: "account"\` for account-level APIs. Account-level acts on the account itself, or on sites as objects within it; anything that reads or writes inside a site is site-level.
|
|
12218
12225
|
- If \`scope\` is omitted it defaults to site when either the ExecuteWixAPI call or \`wix.request\` provides a \`siteId\`; otherwise it defaults to account.
|
|
12226
|
+
- Site-level calls need a site ID; there is no implicit current site. Before any \`scope: "site"\` call, pass the site's ID as the ExecuteWixAPI \`siteId\` parameter or per request. \`scope: "site"\` without a \`siteId\` fails.
|
|
12219
12227
|
- \`scope: "account"\` ignores any \`siteId\` you pass, so a site-level endpoint called that way fails.
|
|
12220
12228
|
- Authentication is injected automatically; never set Authorization, wix-site-id, or wix-account-id headers.
|
|
12221
12229
|
- For one named site, prefer GetSiteContext. If it is unavailable, resolve the exact site and perform the action in the same invocation.
|
|
@@ -12503,7 +12511,8 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
12503
12511
|
After calling, you MUST speak the message provided in the tool result to the user as your reply — do not stay silent and do not replace it with a one-line pointer to the widget. Write out ALL of it, word for word: its opening line (the "Ready to set up your … site?" question INCLUDING "Choose your path in the widget above:"), BOTH of its option bullets, and its "Next up:" line, each on its own line and in that order. Do not summarize, shorten, drop any line, invent your own opener, rename the options, or add an intro or outro.
|
|
12504
12512
|
`,
|
|
12505
12513
|
"import-claude-design-from-url": dedent_default`
|
|
12506
|
-
Import a design into Wix
|
|
12514
|
+
Import a design created in Claude's design tool into Wix. Takes the signed claudeusercontent.com URL Claude Design produces for its self-contained HTML bundle (all images, fonts, and styles inlined); any other host is rejected. Creates a live Wix-hosted site and returns its URL.
|
|
12515
|
+
NOT for site files the user provides themselves (their own HTML/CSS/JS, a zip, another builder's export) — for those, don't call this tool: send the user to https://www.wix.com/headless/drop?utm_campaign=mcp, where they upload the files and get a live hosted site. Give that URL exactly as written, keeping the utm_campaign=mcp parameter.
|
|
12507
12516
|
`,
|
|
12508
12517
|
RunWixCliCommand: dedent_default`
|
|
12509
12518
|
Executes Wix CLI commands for Wix app development and management.
|
|
@@ -12536,8 +12545,10 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
12536
12545
|
SearchBuildAppsDocumentation: dedent_default`
|
|
12537
12546
|
Searches the Wix Build Apps documentation.
|
|
12538
12547
|
`,
|
|
12539
|
-
|
|
12540
|
-
|
|
12548
|
+
SearchDevelopmentDocumentation: dedent_default`
|
|
12549
|
+
Broad Wix development documentation (platform concepts, developer guides, getting started). **Last resort — development tasks only.**
|
|
12550
|
+
Skip it entirely for general, business, support, or Wix-editor questions.
|
|
12551
|
+
Call it only after the specific search for your task returned nothing useful: \`SearchWixRESTDocumentation\` (REST), \`SearchWixSDKDocumentation\` (JS SDK), \`SearchWixCLIDocumentation\` (CLI), \`SearchBuildAppsDocumentation\` (apps), \`SearchWixHeadlessDocumentation\` (Headless), \`SearchWixWDSDocumentation\` (WDS). Never use it as a first search.
|
|
12541
12552
|
`,
|
|
12542
12553
|
SearchWixHeadlessDocumentation: dedent_default`
|
|
12543
12554
|
Searches the Wix Headless documentation.
|
|
@@ -12902,6 +12913,7 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
12902
12913
|
CreateWixBusinessGuide: dedent_default`
|
|
12903
12914
|
Provides comprehensive documentation for creating a new Wix business (site, app, etc.).
|
|
12904
12915
|
Call this ONLY when the user explicitly asks for a headless site, a Wix Classic Editor site, or manual/advanced account/API-based site creation — these don't need the site's purpose first. For normal site-creation ${SITE_CREATION_COPY.normalCreationRoute.nonWidget}; for a specific template id, call \`CreateSiteFromTemplate\`.
|
|
12916
|
+
Exception, even when the user says "headless": if they ALREADY HAVE the finished site as files (their own HTML/CSS/JS, a zip, an AI-builder export) and want those files hosted, don't call this tool — send them to https://www.wix.com/headless/drop?utm_campaign=mcp to upload the files and get a live hosted site (give that URL exactly, keeping the utm_campaign=mcp parameter). This guide's CLI flow is for BUILDING a headless frontend, not for hosting ready-made files.
|
|
12905
12917
|
|
|
12906
12918
|
## What This Tool Contains
|
|
12907
12919
|
|
|
@@ -13189,14 +13201,20 @@ function renderApps(apps, knownApps) {
|
|
|
13189
13201
|
}
|
|
13190
13202
|
function renderProperties(props) {
|
|
13191
13203
|
const sections = [];
|
|
13192
|
-
const
|
|
13193
|
-
if (props.language)
|
|
13194
|
-
if (props.locale?.country)
|
|
13195
|
-
|
|
13196
|
-
if (props.
|
|
13197
|
-
if (
|
|
13198
|
-
|
|
13199
|
-
|
|
13204
|
+
const regionalFormat = [];
|
|
13205
|
+
if (props.language) regionalFormat.push(`- Language: **${props.language}**`);
|
|
13206
|
+
if (props.locale?.country)
|
|
13207
|
+
regionalFormat.push(`- Locale region: **${props.locale.country}**`);
|
|
13208
|
+
if (props.timeZone) regionalFormat.push(`- Timezone: **${props.timeZone}**`);
|
|
13209
|
+
if (props.paymentCurrency)
|
|
13210
|
+
regionalFormat.push(`- Currency: **${props.paymentCurrency}**`);
|
|
13211
|
+
if (regionalFormat.length) {
|
|
13212
|
+
sections.push(`**Regional Format**
|
|
13213
|
+
${regionalFormat.join("\n")}`);
|
|
13214
|
+
}
|
|
13215
|
+
if (props.address?.country) {
|
|
13216
|
+
sections.push(`**Location**
|
|
13217
|
+
- Country: **${props.address.country}**`);
|
|
13200
13218
|
}
|
|
13201
13219
|
const contact = [];
|
|
13202
13220
|
if (props.email) contact.push(`- Email: **${props.email}**`);
|
|
@@ -13343,6 +13361,7 @@ var known_apps_default = {
|
|
|
13343
13361
|
"225dd912-7dea-4738-8688-4b8c6955ffc2": "Wix Forms",
|
|
13344
13362
|
"d80111c5-a0f4-47a8-b63a-65b54d774a27": "Wix Gift Cards",
|
|
13345
13363
|
"148c2287-c669-d849-d153-463c7486a694": "Wix Groups",
|
|
13364
|
+
"14bca956-e09f-f4d6-14d7-466cb3f09103": "Wix Hotels",
|
|
13346
13365
|
"13ee94c1-b635-8505-3391-97919052c16f": "Wix Invoices",
|
|
13347
13366
|
"14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9": "Wix Members Area",
|
|
13348
13367
|
"14d84998-ae09-1abf-c6fc-3f3cace5bf19": "Wix Multilingual",
|
|
@@ -13360,7 +13379,16 @@ var known_apps_default = {
|
|
|
13360
13379
|
"1480c568-5cbd-9392-5604-1148f5faffa0": "Promote SEO",
|
|
13361
13380
|
"ff5d6eb1-65e4-4f9a-8b14-64d34c12cc2e": "Wix Rentals"
|
|
13362
13381
|
};
|
|
13363
|
-
var
|
|
13382
|
+
var DYNAMIC_CONTEXT_PATH = "/_api/dynamic-context/v1/dynamic-context";
|
|
13383
|
+
var DYNAMIC_CONTEXT_URL = `https://dev.wix.com${DYNAMIC_CONTEXT_PATH}`;
|
|
13384
|
+
var isWixHost = (hostname) => hostname === "wix.com" || hostname.endsWith(".wix.com");
|
|
13385
|
+
var dynamicContextUrl = () => {
|
|
13386
|
+
if (typeof window === "undefined") {
|
|
13387
|
+
return DYNAMIC_CONTEXT_URL;
|
|
13388
|
+
}
|
|
13389
|
+
const hostname = window.location?.hostname;
|
|
13390
|
+
return typeof hostname === "string" && isWixHost(hostname) ? DYNAMIC_CONTEXT_PATH : DYNAMIC_CONTEXT_URL;
|
|
13391
|
+
};
|
|
13364
13392
|
var COUNT_SITES_URL = "https://www.wixapis.com/site-list/v2/sites/count";
|
|
13365
13393
|
var MAX_SITES_FOR_DYNAMIC_CONTEXT = 10;
|
|
13366
13394
|
var DYNAMIC_CONTEXT_PETRI_OVERRIDE = "shouldReturnDynamicContextInMCP#B";
|
|
@@ -13377,8 +13405,8 @@ async function getDynamicContext(auth, httpClient, filter, options) {
|
|
|
13377
13405
|
partnerContextEnabled: options,
|
|
13378
13406
|
includeAccountContext: options
|
|
13379
13407
|
} : options;
|
|
13380
|
-
const includePartnerContext = contextOptions?.partnerContextEnabled ??
|
|
13381
|
-
const includeAccountContext = contextOptions?.includeAccountContext ??
|
|
13408
|
+
const includePartnerContext = contextOptions?.partnerContextEnabled ?? true;
|
|
13409
|
+
const includeAccountContext = contextOptions?.includeAccountContext ?? true;
|
|
13382
13410
|
try {
|
|
13383
13411
|
const accountHeaders = await auth.getAccountAuthHeaders();
|
|
13384
13412
|
const noFilter = !filter?.siteId && !filter?.siteName;
|
|
@@ -13412,7 +13440,7 @@ async function getDynamicContext(auth, httpClient, filter, options) {
|
|
|
13412
13440
|
if (filter?.siteId) body.site_id = filter.siteId;
|
|
13413
13441
|
else if (filter?.siteName) body.site_name = filter.siteName;
|
|
13414
13442
|
const dynamicContextPromise = httpClient.request({
|
|
13415
|
-
url:
|
|
13443
|
+
url: dynamicContextUrl(),
|
|
13416
13444
|
method: "POST",
|
|
13417
13445
|
headers: {
|
|
13418
13446
|
...accountHeaders,
|
|
@@ -13492,7 +13520,8 @@ var paramDescriptions = {
|
|
|
13492
13520
|
"The url of the api to call - ALWAYS get the API url from the Wix REST docs or from the conversation context, the URL MUST BE ABSOLUTE URL",
|
|
13493
13521
|
'NEVER guess the API url, ALWAYS get it from the conversation context, i.e from the user prompt or from the "WixREADME" tool or from the "SearchWixRESTDocumentation" tool or from the "BrowseWixRESTDocsMenu" tool or from the "ReadFullDocsArticle" tool',
|
|
13494
13522
|
`Allowed API urls are: ${ALLOWED_HOSTNAMES.join(", ")}`,
|
|
13495
|
-
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool
|
|
13523
|
+
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`,
|
|
13524
|
+
ARRAY_QUERY_PARAMS_RULE
|
|
13496
13525
|
].join("\n"),
|
|
13497
13526
|
method: "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)",
|
|
13498
13527
|
body: 'The request body as a JSON object or array with all the required fields and values, including nested objects. Pass the actual value (object or array), NOT a JSON string. YOU MUST NEVER MAKE UP A BODY - the body should be based on the conversation context, i.e from the user prompt OR got into the conversation context by the "ReadFullDocsArticle" tool OR by the "SearchWixAPISpec" tool OR by the "ReadFullDocsMethodSchema" tool - i.e based on the API docs, a relevant recipe you read (preferably), a code example you found in the docs, a schema you read etc.. YOU MUST NEVER ASSUME YOU KNOW WHAT THE BODY SCHEMA IS WITHOUT CONCRETE EXAMPLES OR SCHEMA DEFINITIONS FROM THE CONVERSATION CONTEXT. Prefer reading relevant recipes if you have them in context for understand the body schema for API calls.',
|
|
@@ -13565,8 +13594,8 @@ var paramDescriptions = {
|
|
|
13565
13594
|
searchTerm: "The search term to search for in the Build Apps Documentation",
|
|
13566
13595
|
maxResults: "The maximum number of results to return, default is 10, max is 15"
|
|
13567
13596
|
},
|
|
13568
|
-
|
|
13569
|
-
searchTerm: "The search term
|
|
13597
|
+
SearchDevelopmentDocumentation: {
|
|
13598
|
+
searchTerm: "The development-related search term. Use only after a more specific docs search (REST/SDK/CLI/Build Apps/Headless/WDS) came back empty.",
|
|
13570
13599
|
maxResults: "The maximum number of results to return, default is 10, max is 15"
|
|
13571
13600
|
},
|
|
13572
13601
|
SearchWixHeadlessDocumentation: {
|
|
@@ -14362,15 +14391,15 @@ var addDocsTools = (server, allowedTools = [
|
|
|
14362
14391
|
}
|
|
14363
14392
|
);
|
|
14364
14393
|
}
|
|
14365
|
-
if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("
|
|
14394
|
+
if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchDevelopmentDocumentation")) {
|
|
14366
14395
|
server.tool(
|
|
14367
|
-
"
|
|
14396
|
+
"SearchDevelopmentDocumentation",
|
|
14368
14397
|
getDescription(
|
|
14369
|
-
"
|
|
14370
|
-
defaultToolDescriptions.
|
|
14398
|
+
"SearchDevelopmentDocumentation",
|
|
14399
|
+
defaultToolDescriptions.SearchDevelopmentDocumentation ?? ""
|
|
14371
14400
|
),
|
|
14372
14401
|
(() => {
|
|
14373
|
-
const d = desc("
|
|
14402
|
+
const d = desc("SearchDevelopmentDocumentation");
|
|
14374
14403
|
return {
|
|
14375
14404
|
searchTerm: external_exports.string().describe(d.searchTerm),
|
|
14376
14405
|
maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
|
|
@@ -14400,8 +14429,8 @@ var addDocsTools = (server, allowedTools = [
|
|
|
14400
14429
|
panorama.errorMonitor().reportError(error);
|
|
14401
14430
|
captureException(error, {
|
|
14402
14431
|
tags: {
|
|
14403
|
-
componentId: "
|
|
14404
|
-
toolName: "
|
|
14432
|
+
componentId: "SearchDevelopmentDocumentation",
|
|
14433
|
+
toolName: "SearchDevelopmentDocumentation"
|
|
14405
14434
|
}
|
|
14406
14435
|
});
|
|
14407
14436
|
logger.error(
|
|
@@ -15262,6 +15291,19 @@ var MAX_ALLOWED_RESPONSE_CHARS = 2e6;
|
|
|
15262
15291
|
|
|
15263
15292
|
// src/api-call/index.ts
|
|
15264
15293
|
var DEFAULT_MAX_RESPONSE_SIZE = 5e4;
|
|
15294
|
+
function extractReturnedRows(responseData) {
|
|
15295
|
+
if (responseData === null || typeof responseData !== "object") {
|
|
15296
|
+
return void 0;
|
|
15297
|
+
}
|
|
15298
|
+
const data = responseData;
|
|
15299
|
+
const block = data.pagingMetadata ?? data.cursorPagingMetadata ?? data.pagingOffsetMetadata ?? data.metaData ?? data.metadata;
|
|
15300
|
+
const raw = block?.count;
|
|
15301
|
+
if (typeof raw !== "number" && (typeof raw !== "string" || raw.trim() === "")) {
|
|
15302
|
+
return void 0;
|
|
15303
|
+
}
|
|
15304
|
+
const count = Number(raw);
|
|
15305
|
+
return Number.isFinite(count) ? count : void 0;
|
|
15306
|
+
}
|
|
15265
15307
|
function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_SIZE) {
|
|
15266
15308
|
if (typeof responseData === "string" && responseData.trim().startsWith("<!DOCTYPE")) {
|
|
15267
15309
|
return {
|
|
@@ -15269,13 +15311,15 @@ function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_
|
|
|
15269
15311
|
isError: true
|
|
15270
15312
|
};
|
|
15271
15313
|
}
|
|
15314
|
+
const returnedRows = extractReturnedRows(responseData);
|
|
15272
15315
|
let responseText = JSON.stringify(responseData);
|
|
15316
|
+
const originalLength = responseText.length;
|
|
15273
15317
|
const effectiveMax = Math.min(maxResponseSize, MAX_ALLOWED_RESPONSE_CHARS);
|
|
15274
15318
|
if (responseText.length > effectiveMax) {
|
|
15275
15319
|
responseText = responseText.slice(0, effectiveMax) + `
|
|
15276
15320
|
...[TRUNCATED - response was ${responseText.length} chars, showing first ${effectiveMax}]`;
|
|
15277
15321
|
}
|
|
15278
|
-
return { text: responseText, isError: false };
|
|
15322
|
+
return { text: responseText, isError: false, originalLength, returnedRows };
|
|
15279
15323
|
}
|
|
15280
15324
|
function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "ListWixSites", "ManageWixSite"], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize) {
|
|
15281
15325
|
const effectiveAllowedTools = [
|
|
@@ -15338,9 +15382,14 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
15338
15382
|
data: method === "GET" ? void 0 : body
|
|
15339
15383
|
});
|
|
15340
15384
|
const requestId = response.headers?.["x-wix-request-id"];
|
|
15341
|
-
setToolBiParams({ requestId, siteId });
|
|
15342
15385
|
const responseData = await handleWixAPIResponse(response);
|
|
15343
15386
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
15387
|
+
setToolBiParams({
|
|
15388
|
+
requestId,
|
|
15389
|
+
siteId,
|
|
15390
|
+
returnedRows: formatted.returnedRows,
|
|
15391
|
+
originalLength: formatted.originalLength
|
|
15392
|
+
});
|
|
15344
15393
|
if (formatted.isError) {
|
|
15345
15394
|
return {
|
|
15346
15395
|
content: [
|
|
@@ -15479,7 +15528,7 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
15479
15528
|
destructiveHint: true,
|
|
15480
15529
|
openWorldHint: false
|
|
15481
15530
|
}),
|
|
15482
|
-
async ({ url, body, method, reason }, { httpClient }) => {
|
|
15531
|
+
async ({ url, body, method, reason }, { httpClient, setToolBiParams }) => {
|
|
15483
15532
|
logger.log(
|
|
15484
15533
|
`Calling Wix Account level API: ${url}, reason="${reason}", body: ${JSON.stringify(body)}`
|
|
15485
15534
|
);
|
|
@@ -15508,6 +15557,10 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
15508
15557
|
});
|
|
15509
15558
|
const responseData = await handleWixAPIResponse(response);
|
|
15510
15559
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
15560
|
+
setToolBiParams({
|
|
15561
|
+
returnedRows: formatted.returnedRows,
|
|
15562
|
+
originalLength: formatted.originalLength
|
|
15563
|
+
});
|
|
15511
15564
|
if (formatted.isError) {
|
|
15512
15565
|
return {
|
|
15513
15566
|
content: [
|
|
@@ -15730,10 +15783,13 @@ function executeTextResult(message) {
|
|
|
15730
15783
|
content: [{ type: "text", text: message }]
|
|
15731
15784
|
};
|
|
15732
15785
|
}
|
|
15733
|
-
function formatExecuteResult(data, maxResponseSize) {
|
|
15786
|
+
function formatExecuteResult(data, maxResponseSize, reportBi) {
|
|
15734
15787
|
if (data.error) {
|
|
15735
15788
|
return executeErrorResult(data.error);
|
|
15736
15789
|
}
|
|
15790
|
+
reportBi?.({
|
|
15791
|
+
originalLength: typeof data.result === "string" ? data.result.length : JSON.stringify(data.result)?.length
|
|
15792
|
+
});
|
|
15737
15793
|
return {
|
|
15738
15794
|
content: [
|
|
15739
15795
|
{ type: "text", text: truncateResponse(data.result, maxResponseSize) }
|
|
@@ -15843,7 +15899,11 @@ function addExecuteTool(server, options) {
|
|
|
15843
15899
|
status: data.authErrorStatus
|
|
15844
15900
|
});
|
|
15845
15901
|
}
|
|
15846
|
-
return formatExecuteResult(
|
|
15902
|
+
return formatExecuteResult(
|
|
15903
|
+
data,
|
|
15904
|
+
maxResponseSize,
|
|
15905
|
+
extra?.setToolBiParams
|
|
15906
|
+
);
|
|
15847
15907
|
} catch (err) {
|
|
15848
15908
|
const message = err instanceof Error ? err.message : String(err);
|
|
15849
15909
|
logger.log(
|
|
@@ -17687,7 +17747,7 @@ function extractText(result) {
|
|
|
17687
17747
|
return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
|
|
17688
17748
|
}
|
|
17689
17749
|
var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
|
|
17690
|
-
function formatToolResultAdditionalFields(result) {
|
|
17750
|
+
function formatToolResultAdditionalFields(result, extras) {
|
|
17691
17751
|
const resultText = extractText(result);
|
|
17692
17752
|
const contentTypes = [
|
|
17693
17753
|
...new Set(
|
|
@@ -17703,7 +17763,8 @@ function formatToolResultAdditionalFields(result) {
|
|
|
17703
17763
|
resultPreview: resultText.slice(0, TOOL_RESULT_PREVIEW_MAX_CHARS),
|
|
17704
17764
|
resultTextLength: resultText.length,
|
|
17705
17765
|
resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
|
|
17706
|
-
resultContentTypes: contentTypes
|
|
17766
|
+
resultContentTypes: contentTypes,
|
|
17767
|
+
...extras
|
|
17707
17768
|
});
|
|
17708
17769
|
}
|
|
17709
17770
|
function createToolBiEvent(params) {
|
|
@@ -17941,7 +18002,10 @@ function createWixToolkit(options) {
|
|
|
17941
18002
|
if (!toolSucceeded) {
|
|
17942
18003
|
errorBody = extractText(cbResult);
|
|
17943
18004
|
} else {
|
|
17944
|
-
additionalFields = formatToolResultAdditionalFields(cbResult
|
|
18005
|
+
additionalFields = formatToolResultAdditionalFields(cbResult, {
|
|
18006
|
+
returnedRows: toolBiParams.returnedRows,
|
|
18007
|
+
originalLength: toolBiParams.originalLength
|
|
18008
|
+
});
|
|
17945
18009
|
}
|
|
17946
18010
|
if (!isDevEnvironment) {
|
|
17947
18011
|
if (toolSucceeded) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.82",
|
|
4
4
|
"description": "A Model Context Protocol server for Wix AI tools",
|
|
5
5
|
"bin": "./build/bin-standalone.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@wix/bi-logger-wix-code-data": "^1.485.0",
|
|
44
44
|
"@wix/common-widget-types": "^1.77.0",
|
|
45
45
|
"@wix/design-system": "^1.256.2",
|
|
46
|
-
"@wix/dynamic-context-enricher": "0.1.
|
|
46
|
+
"@wix/dynamic-context-enricher": "0.1.3",
|
|
47
47
|
"@wix/http-client": "^2.85.0",
|
|
48
48
|
"@wix/panorama-client-node": "^3.253.0",
|
|
49
49
|
"@wix/standalone-node-bi-logger": "^1.7.24",
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
]
|
|
134
134
|
}
|
|
135
135
|
},
|
|
136
|
-
"falconPackageHash": "
|
|
136
|
+
"falconPackageHash": "b8ae29303e3809101199412477e8e9124437d8603c423399ed88697d"
|
|
137
137
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { McpAuthenticationStrategy } from '../auth/index.js';
|
|
2
|
-
import { WixMcpServer } from '../wix-mcp-server.js';
|
|
3
|
-
export declare function addOpenHeadlessWixelProjectTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: {
|
|
4
|
-
conductorOverride?: string;
|
|
5
|
-
}): void;
|
|
6
|
-
//# sourceMappingURL=open-headless-wixel-project-tool.d.ts.map
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { openHeadlessWixelProject } from './api.js';
|
|
3
|
-
import { registerAppTool } from '@modelcontextprotocol/ext-apps/server';
|
|
4
|
-
const TOOL_NAME = 'openHeadlessWixelProject';
|
|
5
|
-
const TOOL_TITLE = 'Open Headless Wixel Project';
|
|
6
|
-
const TOOL_DESCRIPTION = `Open a headless Wixel project for background asset generation.`;
|
|
7
|
-
const TOOL_META = {
|
|
8
|
-
ui: { visibility: ['app'] }
|
|
9
|
-
};
|
|
10
|
-
export function addOpenHeadlessWixelProjectTool(server, authStrategy, options = {}) {
|
|
11
|
-
const { getAccountAuthHeaders } = authStrategy;
|
|
12
|
-
registerAppTool(server, TOOL_NAME, {
|
|
13
|
-
title: TOOL_TITLE,
|
|
14
|
-
description: TOOL_DESCRIPTION,
|
|
15
|
-
inputSchema: {
|
|
16
|
-
url: z.string().describe('The URL of the Wixel project'),
|
|
17
|
-
userPrompt: z.string().describe('The user prompt for the project'),
|
|
18
|
-
jobId: z.string().describe('The job ID'),
|
|
19
|
-
siteId: z.string().describe('The site ID'),
|
|
20
|
-
projectId: z.string().describe('The project ID'),
|
|
21
|
-
conversationId: z.string().describe('The conversation ID'),
|
|
22
|
-
withScreenshots: z
|
|
23
|
-
.boolean()
|
|
24
|
-
.optional()
|
|
25
|
-
.describe('Whether to include screenshots'),
|
|
26
|
-
useProvidedCookies: z
|
|
27
|
-
.boolean()
|
|
28
|
-
.optional()
|
|
29
|
-
.describe('Whether to use provided cookies'),
|
|
30
|
-
timeout: z.number().optional().describe('Timeout in milliseconds')
|
|
31
|
-
},
|
|
32
|
-
annotations: {
|
|
33
|
-
readOnlyHint: false,
|
|
34
|
-
destructiveHint: true,
|
|
35
|
-
openWorldHint: false
|
|
36
|
-
},
|
|
37
|
-
_meta: TOOL_META
|
|
38
|
-
}, async (args) => {
|
|
39
|
-
try {
|
|
40
|
-
const accountAuthHeaders = await getAccountAuthHeaders();
|
|
41
|
-
const result = await openHeadlessWixelProject({
|
|
42
|
-
accountAuthHeaders,
|
|
43
|
-
url: args.url,
|
|
44
|
-
userPrompt: args.userPrompt,
|
|
45
|
-
jobId: args.jobId,
|
|
46
|
-
siteId: args.siteId,
|
|
47
|
-
projectId: args.projectId,
|
|
48
|
-
conversationId: args.conversationId,
|
|
49
|
-
withScreenshots: args.withScreenshots,
|
|
50
|
-
useProvidedCookies: args.useProvidedCookies,
|
|
51
|
-
timeout: args.timeout,
|
|
52
|
-
conductorOverride: options.conductorOverride
|
|
53
|
-
});
|
|
54
|
-
return {
|
|
55
|
-
isError: false,
|
|
56
|
-
content: [
|
|
57
|
-
{
|
|
58
|
-
type: 'text',
|
|
59
|
-
text: `Headless Wixel project opened for job ${args.jobId}`
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
structuredContent: {
|
|
63
|
-
success: true,
|
|
64
|
-
jobId: args.jobId,
|
|
65
|
-
projectId: args.projectId,
|
|
66
|
-
...result
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
console.error('❌ Error opening headless Wixel project:', error);
|
|
72
|
-
const errorMessage = error.message;
|
|
73
|
-
return {
|
|
74
|
-
isError: true,
|
|
75
|
-
content: [{ type: 'text', text: errorMessage }],
|
|
76
|
-
structuredContent: {
|
|
77
|
-
success: false,
|
|
78
|
-
error: errorMessage
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=open-headless-wixel-project-tool.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { McpAuthenticationStrategy } from '../auth/index.js';
|
|
2
|
-
import { WixMcpServer } from '../wix-mcp-server.js';
|
|
3
|
-
export declare function addPullHeadlessWixelJobTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: {
|
|
4
|
-
conductorOverride?: string;
|
|
5
|
-
}): void;
|
|
6
|
-
//# sourceMappingURL=pull-headless-wixel-job-tool.d.ts.map
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { pullHeadlessWixelJob } from './api.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { registerAppTool } from '@modelcontextprotocol/ext-apps/server';
|
|
4
|
-
const TOOL_NAME = 'pullHeadlessWixelJob';
|
|
5
|
-
const TOOL_TITLE = 'Pull Headless Wixel Job';
|
|
6
|
-
const TOOL_DESCRIPTION = `Pull the next available headless Wixel job.`;
|
|
7
|
-
const TOOL_META = {
|
|
8
|
-
ui: { visibility: ['app'] }
|
|
9
|
-
};
|
|
10
|
-
export function addPullHeadlessWixelJobTool(server, authStrategy, options = {}) {
|
|
11
|
-
const { getAccountAuthHeaders } = authStrategy;
|
|
12
|
-
registerAppTool(server, TOOL_NAME, {
|
|
13
|
-
title: TOOL_TITLE,
|
|
14
|
-
description: TOOL_DESCRIPTION,
|
|
15
|
-
inputSchema: {
|
|
16
|
-
jobId: z.string().describe('The job ID')
|
|
17
|
-
},
|
|
18
|
-
annotations: {
|
|
19
|
-
readOnlyHint: false,
|
|
20
|
-
destructiveHint: false,
|
|
21
|
-
openWorldHint: false
|
|
22
|
-
},
|
|
23
|
-
_meta: TOOL_META
|
|
24
|
-
}, async (args) => {
|
|
25
|
-
try {
|
|
26
|
-
const accountAuthHeaders = await getAccountAuthHeaders();
|
|
27
|
-
const result = await pullHeadlessWixelJob({
|
|
28
|
-
accountAuthHeaders,
|
|
29
|
-
jobId: args.jobId,
|
|
30
|
-
conductorOverride: options.conductorOverride
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
isError: false,
|
|
34
|
-
content: [
|
|
35
|
-
{
|
|
36
|
-
type: 'text',
|
|
37
|
-
text: result.job
|
|
38
|
-
? `Pulled headless Wixel job: ${result.job.id}`
|
|
39
|
-
: 'No headless Wixel job available'
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
structuredContent: {
|
|
43
|
-
...result
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
console.error('❌ Error pulling headless Wixel job:', error);
|
|
49
|
-
const errorMessage = error.message;
|
|
50
|
-
return {
|
|
51
|
-
isError: true,
|
|
52
|
-
content: [{ type: 'text', text: errorMessage }],
|
|
53
|
-
structuredContent: {
|
|
54
|
-
success: false,
|
|
55
|
-
error: errorMessage
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=pull-headless-wixel-job-tool.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { McpAuthenticationStrategy } from '../auth/index.js';
|
|
2
|
-
import { WixMcpServer } from '../wix-mcp-server.js';
|
|
3
|
-
export declare function addUpdateHeadlessWixelJobTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: {
|
|
4
|
-
conductorOverride?: string;
|
|
5
|
-
}): void;
|
|
6
|
-
//# sourceMappingURL=update-headless-wixel-job-tool.d.ts.map
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { updateHeadlessWixelJob } from './api.js';
|
|
3
|
-
import { registerAppTool } from '@modelcontextprotocol/ext-apps/server';
|
|
4
|
-
const TOOL_NAME = 'updateHeadlessWixelJob';
|
|
5
|
-
const TOOL_TITLE = 'Update Headless Wixel Job';
|
|
6
|
-
const TOOL_DESCRIPTION = `Update the status and data of a headless Wixel job.`;
|
|
7
|
-
const TOOL_META = {
|
|
8
|
-
ui: { visibility: ['app'] }
|
|
9
|
-
};
|
|
10
|
-
const wixelJobStatusSchema = z.enum([
|
|
11
|
-
'STARTED',
|
|
12
|
-
'IN_PROGRESS',
|
|
13
|
-
'COMPLETED',
|
|
14
|
-
'FAILED',
|
|
15
|
-
'CANCELLED'
|
|
16
|
-
]);
|
|
17
|
-
export function addUpdateHeadlessWixelJobTool(server, authStrategy, options = {}) {
|
|
18
|
-
const { getAccountAuthHeaders } = authStrategy;
|
|
19
|
-
registerAppTool(server, TOOL_NAME, {
|
|
20
|
-
title: TOOL_TITLE,
|
|
21
|
-
description: TOOL_DESCRIPTION,
|
|
22
|
-
inputSchema: {
|
|
23
|
-
id: z.string().describe('The job ID'),
|
|
24
|
-
status: wixelJobStatusSchema.describe('The job status'),
|
|
25
|
-
userPrompt: z
|
|
26
|
-
.string()
|
|
27
|
-
.optional()
|
|
28
|
-
.describe('The user prompt for the job'),
|
|
29
|
-
shouldRefresh: z
|
|
30
|
-
.boolean()
|
|
31
|
-
.optional()
|
|
32
|
-
.describe('Whether the job should refresh'),
|
|
33
|
-
errorMessage: z
|
|
34
|
-
.string()
|
|
35
|
-
.optional()
|
|
36
|
-
.describe('Error message if the job failed'),
|
|
37
|
-
type: z.string().optional().describe('The type of asset being created'),
|
|
38
|
-
data: z
|
|
39
|
-
.object({
|
|
40
|
-
siteId: z.string().optional().describe('The site ID'),
|
|
41
|
-
assetId: z.string().optional().describe('The asset ID'),
|
|
42
|
-
projectId: z.string().optional().describe('The project ID'),
|
|
43
|
-
conversationId: z
|
|
44
|
-
.string()
|
|
45
|
-
.optional()
|
|
46
|
-
.describe('The conversation ID')
|
|
47
|
-
})
|
|
48
|
-
.optional()
|
|
49
|
-
.describe('Additional job data'),
|
|
50
|
-
userId: z.string().optional().describe('The user ID'),
|
|
51
|
-
accountId: z.string().optional().describe('The account ID')
|
|
52
|
-
},
|
|
53
|
-
annotations: {
|
|
54
|
-
readOnlyHint: false,
|
|
55
|
-
destructiveHint: true,
|
|
56
|
-
openWorldHint: false
|
|
57
|
-
},
|
|
58
|
-
_meta: TOOL_META
|
|
59
|
-
}, async (args) => {
|
|
60
|
-
try {
|
|
61
|
-
const accountAuthHeaders = await getAccountAuthHeaders();
|
|
62
|
-
const result = await updateHeadlessWixelJob({
|
|
63
|
-
accountAuthHeaders,
|
|
64
|
-
conductorOverride: options.conductorOverride,
|
|
65
|
-
job: {
|
|
66
|
-
id: args.id,
|
|
67
|
-
status: args.status,
|
|
68
|
-
userPrompt: args.userPrompt,
|
|
69
|
-
shouldRefresh: args.shouldRefresh,
|
|
70
|
-
errorMessage: args.errorMessage,
|
|
71
|
-
type: args.type,
|
|
72
|
-
data: args.data,
|
|
73
|
-
userId: args.userId,
|
|
74
|
-
accountId: args.accountId
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
return {
|
|
78
|
-
isError: false,
|
|
79
|
-
content: [
|
|
80
|
-
{
|
|
81
|
-
type: 'text',
|
|
82
|
-
text: `Headless Wixel job ${args.id} updated to status: ${args.status}`
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
structuredContent: {
|
|
86
|
-
jobId: args.id,
|
|
87
|
-
status: args.status,
|
|
88
|
-
...result
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
console.error('❌ Error updating headless Wixel job:', error);
|
|
94
|
-
const errorMessage = error.message;
|
|
95
|
-
return {
|
|
96
|
-
isError: true,
|
|
97
|
-
content: [{ type: 'text', text: errorMessage }],
|
|
98
|
-
structuredContent: {
|
|
99
|
-
success: false,
|
|
100
|
-
error: errorMessage
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=update-headless-wixel-job-tool.js.map
|