@wix/mcp 1.0.80 → 1.0.81
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 +72 -28
- package/build/cjs/index.cjs +90 -361
- package/build/cjs/toolkit.cjs +81 -30
- 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 +8 -2
- 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/infra/tool-bi.d.ts +1 -1
- package/build/dts/infra/tool-bi.js +3 -2
- 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 +2 -0
- package/build/dts/wix-mcp-server.js +4 -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 +90 -358
- package/build/esm/toolkit.js +81 -30
- 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/README.md
CHANGED
|
@@ -122,7 +122,7 @@ Set logging output:
|
|
|
122
122
|
- `VELO`: Velo Documentation (`SearchWixVeloDocumentation`)
|
|
123
123
|
- `BUSINESS_SOLUTIONS`: Business solutions recipes (`WixBusinessFlowsDocumentation`)
|
|
124
124
|
- `CLI`: Wix CLI Documentation (`SearchWixCLIDocumentation`)
|
|
125
|
-
- `OVERVIEW`: Wix
|
|
125
|
+
- `OVERVIEW`: Wix Development Documentation (`SearchDevelopmentDocumentation`)
|
|
126
126
|
|
|
127
127
|
**Experimental Tools:**
|
|
128
128
|
|
package/build/bin-standalone.js
CHANGED
|
@@ -71550,6 +71550,9 @@ function rethrowIfUnauthorized(error2) {
|
|
|
71550
71550
|
}
|
|
71551
71551
|
}
|
|
71552
71552
|
|
|
71553
|
+
// src/config/api-request-rules.ts
|
|
71554
|
+
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).";
|
|
71555
|
+
|
|
71553
71556
|
// src/config/default-config.ts
|
|
71554
71557
|
var AGENT_GOAL = dedent_default`
|
|
71555
71558
|
You are an agent that helps the user manage their Wix site.
|
|
@@ -71671,11 +71674,13 @@ var EXECUTE_WIX_API_INTRO = dedent_default`
|
|
|
71671
71674
|
CODE CONTRACT:
|
|
71672
71675
|
- Pass an async function expression: \`async function() { ... }\` or \`async () => { ... }\`. Put every declaration, \`await\`, and \`return\` inside it, and do not invoke it yourself.
|
|
71673
71676
|
- Use only \`wix.request({ method, url, body })\` and in-memory JavaScript. Node.js modules, filesystem access, and downloadable-file creation are unavailable.
|
|
71677
|
+
- 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.
|
|
71674
71678
|
|
|
71675
71679
|
CONFIRM API CONTRACTS:
|
|
71676
71680
|
- 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.
|
|
71677
71681
|
- Prefer \`method.publicUrl\` from SearchWixAPISpec; never use \`method.servers[0]\`. Pass all supporting documentation URLs through \`sourceDocUrls\`.
|
|
71678
71682
|
- 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.
|
|
71683
|
+
- ${ARRAY_QUERY_PARAMS_RULE}
|
|
71679
71684
|
- 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.
|
|
71680
71685
|
`;
|
|
71681
71686
|
var EXECUTE_WIX_API_OUTPUT_AND_ERRORS = dedent_default`
|
|
@@ -71691,6 +71696,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
71691
71696
|
SCOPE AND SITE TARGETING:
|
|
71692
71697
|
- 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.
|
|
71693
71698
|
- If \`scope\` is omitted it defaults to site when either the ExecuteWixAPI call or \`wix.request\` provides a \`siteId\`; otherwise it defaults to account.
|
|
71699
|
+
- 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.
|
|
71694
71700
|
- \`scope: "account"\` ignores any \`siteId\` you pass, so a site-level endpoint called that way fails.
|
|
71695
71701
|
- Authentication is injected automatically; never set Authorization, wix-site-id, or wix-account-id headers.
|
|
71696
71702
|
- For one named site, prefer GetSiteContext. If it is unavailable, resolve the exact site and perform the action in the same invocation.
|
|
@@ -72011,8 +72017,10 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
72011
72017
|
SearchBuildAppsDocumentation: dedent_default`
|
|
72012
72018
|
Searches the Wix Build Apps documentation.
|
|
72013
72019
|
`,
|
|
72014
|
-
|
|
72015
|
-
|
|
72020
|
+
SearchDevelopmentDocumentation: dedent_default`
|
|
72021
|
+
Broad Wix development documentation (platform concepts, developer guides, getting started). **Last resort — development tasks only.**
|
|
72022
|
+
Skip it entirely for general, business, support, or Wix-editor questions.
|
|
72023
|
+
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.
|
|
72016
72024
|
`,
|
|
72017
72025
|
SearchWixHeadlessDocumentation: dedent_default`
|
|
72018
72026
|
Searches the Wix Headless documentation.
|
|
@@ -72627,14 +72635,20 @@ function renderApps(apps, knownApps) {
|
|
|
72627
72635
|
}
|
|
72628
72636
|
function renderProperties(props) {
|
|
72629
72637
|
const sections = [];
|
|
72630
|
-
const
|
|
72631
|
-
if (props.language)
|
|
72632
|
-
if (props.locale?.country)
|
|
72633
|
-
|
|
72634
|
-
if (props.
|
|
72635
|
-
if (
|
|
72636
|
-
|
|
72637
|
-
|
|
72638
|
+
const regionalFormat = [];
|
|
72639
|
+
if (props.language) regionalFormat.push(`- Language: **${props.language}**`);
|
|
72640
|
+
if (props.locale?.country)
|
|
72641
|
+
regionalFormat.push(`- Locale region: **${props.locale.country}**`);
|
|
72642
|
+
if (props.timeZone) regionalFormat.push(`- Timezone: **${props.timeZone}**`);
|
|
72643
|
+
if (props.paymentCurrency)
|
|
72644
|
+
regionalFormat.push(`- Currency: **${props.paymentCurrency}**`);
|
|
72645
|
+
if (regionalFormat.length) {
|
|
72646
|
+
sections.push(`**Regional Format**
|
|
72647
|
+
${regionalFormat.join("\n")}`);
|
|
72648
|
+
}
|
|
72649
|
+
if (props.address?.country) {
|
|
72650
|
+
sections.push(`**Location**
|
|
72651
|
+
- Country: **${props.address.country}**`);
|
|
72638
72652
|
}
|
|
72639
72653
|
const contact = [];
|
|
72640
72654
|
if (props.email) contact.push(`- Email: **${props.email}**`);
|
|
@@ -72781,6 +72795,7 @@ var known_apps_default = {
|
|
|
72781
72795
|
"225dd912-7dea-4738-8688-4b8c6955ffc2": "Wix Forms",
|
|
72782
72796
|
"d80111c5-a0f4-47a8-b63a-65b54d774a27": "Wix Gift Cards",
|
|
72783
72797
|
"148c2287-c669-d849-d153-463c7486a694": "Wix Groups",
|
|
72798
|
+
"14bca956-e09f-f4d6-14d7-466cb3f09103": "Wix Hotels",
|
|
72784
72799
|
"13ee94c1-b635-8505-3391-97919052c16f": "Wix Invoices",
|
|
72785
72800
|
"14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9": "Wix Members Area",
|
|
72786
72801
|
"14d84998-ae09-1abf-c6fc-3f3cace5bf19": "Wix Multilingual",
|
|
@@ -72815,8 +72830,8 @@ async function getDynamicContext(auth, httpClient, filter, options) {
|
|
|
72815
72830
|
partnerContextEnabled: options,
|
|
72816
72831
|
includeAccountContext: options
|
|
72817
72832
|
} : options;
|
|
72818
|
-
const includePartnerContext = contextOptions?.partnerContextEnabled ??
|
|
72819
|
-
const includeAccountContext = contextOptions?.includeAccountContext ??
|
|
72833
|
+
const includePartnerContext = contextOptions?.partnerContextEnabled ?? true;
|
|
72834
|
+
const includeAccountContext = contextOptions?.includeAccountContext ?? true;
|
|
72820
72835
|
try {
|
|
72821
72836
|
const accountHeaders = await auth.getAccountAuthHeaders();
|
|
72822
72837
|
const noFilter = !filter?.siteId && !filter?.siteName;
|
|
@@ -72930,7 +72945,8 @@ var paramDescriptions = {
|
|
|
72930
72945
|
"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",
|
|
72931
72946
|
'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',
|
|
72932
72947
|
`Allowed API urls are: ${ALLOWED_HOSTNAMES.join(", ")}`,
|
|
72933
|
-
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool
|
|
72948
|
+
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`,
|
|
72949
|
+
ARRAY_QUERY_PARAMS_RULE
|
|
72934
72950
|
].join("\n"),
|
|
72935
72951
|
method: "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)",
|
|
72936
72952
|
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.',
|
|
@@ -73003,8 +73019,8 @@ var paramDescriptions = {
|
|
|
73003
73019
|
searchTerm: "The search term to search for in the Build Apps Documentation",
|
|
73004
73020
|
maxResults: "The maximum number of results to return, default is 10, max is 15"
|
|
73005
73021
|
},
|
|
73006
|
-
|
|
73007
|
-
searchTerm: "The search term
|
|
73022
|
+
SearchDevelopmentDocumentation: {
|
|
73023
|
+
searchTerm: "The development-related search term. Use only after a more specific docs search (REST/SDK/CLI/Build Apps/Headless/WDS) came back empty.",
|
|
73008
73024
|
maxResults: "The maximum number of results to return, default is 10, max is 15"
|
|
73009
73025
|
},
|
|
73010
73026
|
SearchWixHeadlessDocumentation: {
|
|
@@ -73811,15 +73827,15 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
73811
73827
|
}
|
|
73812
73828
|
);
|
|
73813
73829
|
}
|
|
73814
|
-
if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("
|
|
73830
|
+
if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchDevelopmentDocumentation")) {
|
|
73815
73831
|
server2.tool(
|
|
73816
|
-
"
|
|
73832
|
+
"SearchDevelopmentDocumentation",
|
|
73817
73833
|
getDescription(
|
|
73818
|
-
"
|
|
73819
|
-
defaultToolDescriptions.
|
|
73834
|
+
"SearchDevelopmentDocumentation",
|
|
73835
|
+
defaultToolDescriptions.SearchDevelopmentDocumentation ?? ""
|
|
73820
73836
|
),
|
|
73821
73837
|
(() => {
|
|
73822
|
-
const d = desc("
|
|
73838
|
+
const d = desc("SearchDevelopmentDocumentation");
|
|
73823
73839
|
return {
|
|
73824
73840
|
searchTerm: external_exports.string().describe(d.searchTerm),
|
|
73825
73841
|
maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
|
|
@@ -73849,8 +73865,8 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
73849
73865
|
panorama.errorMonitor().reportError(error2);
|
|
73850
73866
|
captureException(error2, {
|
|
73851
73867
|
tags: {
|
|
73852
|
-
componentId: "
|
|
73853
|
-
toolName: "
|
|
73868
|
+
componentId: "SearchDevelopmentDocumentation",
|
|
73869
|
+
toolName: "SearchDevelopmentDocumentation"
|
|
73854
73870
|
}
|
|
73855
73871
|
});
|
|
73856
73872
|
logger2.error(
|
|
@@ -85265,7 +85281,7 @@ function extractText(result) {
|
|
|
85265
85281
|
return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
|
|
85266
85282
|
}
|
|
85267
85283
|
var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
|
|
85268
|
-
function formatToolResultAdditionalFields(result) {
|
|
85284
|
+
function formatToolResultAdditionalFields(result, extras) {
|
|
85269
85285
|
const resultText = extractText(result);
|
|
85270
85286
|
const contentTypes = [
|
|
85271
85287
|
...new Set(
|
|
@@ -85281,7 +85297,8 @@ function formatToolResultAdditionalFields(result) {
|
|
|
85281
85297
|
resultPreview: resultText.slice(0, TOOL_RESULT_PREVIEW_MAX_CHARS),
|
|
85282
85298
|
resultTextLength: resultText.length,
|
|
85283
85299
|
resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
|
|
85284
|
-
resultContentTypes: contentTypes
|
|
85300
|
+
resultContentTypes: contentTypes,
|
|
85301
|
+
...extras
|
|
85285
85302
|
});
|
|
85286
85303
|
}
|
|
85287
85304
|
function createToolBiEvent(params) {
|
|
@@ -85454,7 +85471,10 @@ var WixMcpServer = class extends McpServer {
|
|
|
85454
85471
|
if (!toolSucceeded) {
|
|
85455
85472
|
errorBody = extractText(cbResult);
|
|
85456
85473
|
} else {
|
|
85457
|
-
additionalFields = formatToolResultAdditionalFields(cbResult
|
|
85474
|
+
additionalFields = formatToolResultAdditionalFields(cbResult, {
|
|
85475
|
+
returnedRows: toolBiParams.returnedRows,
|
|
85476
|
+
originalLength: toolBiParams.originalLength
|
|
85477
|
+
});
|
|
85458
85478
|
}
|
|
85459
85479
|
if (toolSucceeded && !isDevEnvironment) {
|
|
85460
85480
|
panorama.transaction(toolName).finish({ toolInvocationId });
|
|
@@ -85982,6 +86002,19 @@ var MAX_ALLOWED_RESPONSE_CHARS = 2e6;
|
|
|
85982
86002
|
|
|
85983
86003
|
// src/api-call/index.ts
|
|
85984
86004
|
var DEFAULT_MAX_RESPONSE_SIZE = 5e4;
|
|
86005
|
+
function extractReturnedRows(responseData) {
|
|
86006
|
+
if (responseData === null || typeof responseData !== "object") {
|
|
86007
|
+
return void 0;
|
|
86008
|
+
}
|
|
86009
|
+
const data = responseData;
|
|
86010
|
+
const block = data.pagingMetadata ?? data.cursorPagingMetadata ?? data.pagingOffsetMetadata ?? data.metaData ?? data.metadata;
|
|
86011
|
+
const raw = block?.count;
|
|
86012
|
+
if (typeof raw !== "number" && (typeof raw !== "string" || raw.trim() === "")) {
|
|
86013
|
+
return void 0;
|
|
86014
|
+
}
|
|
86015
|
+
const count2 = Number(raw);
|
|
86016
|
+
return Number.isFinite(count2) ? count2 : void 0;
|
|
86017
|
+
}
|
|
85985
86018
|
function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_SIZE) {
|
|
85986
86019
|
if (typeof responseData === "string" && responseData.trim().startsWith("<!DOCTYPE")) {
|
|
85987
86020
|
return {
|
|
@@ -85989,13 +86022,15 @@ function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_
|
|
|
85989
86022
|
isError: true
|
|
85990
86023
|
};
|
|
85991
86024
|
}
|
|
86025
|
+
const returnedRows = extractReturnedRows(responseData);
|
|
85992
86026
|
let responseText = JSON.stringify(responseData);
|
|
86027
|
+
const originalLength = responseText.length;
|
|
85993
86028
|
const effectiveMax = Math.min(maxResponseSize, MAX_ALLOWED_RESPONSE_CHARS);
|
|
85994
86029
|
if (responseText.length > effectiveMax) {
|
|
85995
86030
|
responseText = responseText.slice(0, effectiveMax) + `
|
|
85996
86031
|
...[TRUNCATED - response was ${responseText.length} chars, showing first ${effectiveMax}]`;
|
|
85997
86032
|
}
|
|
85998
|
-
return { text: responseText, isError: false };
|
|
86033
|
+
return { text: responseText, isError: false, originalLength, returnedRows };
|
|
85999
86034
|
}
|
|
86000
86035
|
function addApiCallTool(server2, strategy, allowedTools = ["CallWixSiteAPI", "ListWixSites", "ManageWixSite"], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize) {
|
|
86001
86036
|
const effectiveAllowedTools = [
|
|
@@ -86058,9 +86093,14 @@ function addApiCallTool(server2, strategy, allowedTools = ["CallWixSiteAPI", "Li
|
|
|
86058
86093
|
data: method === "GET" ? void 0 : body
|
|
86059
86094
|
});
|
|
86060
86095
|
const requestId = response.headers?.["x-wix-request-id"];
|
|
86061
|
-
setToolBiParams({ requestId, siteId });
|
|
86062
86096
|
const responseData = await handleWixAPIResponse(response);
|
|
86063
86097
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
86098
|
+
setToolBiParams({
|
|
86099
|
+
requestId,
|
|
86100
|
+
siteId,
|
|
86101
|
+
returnedRows: formatted.returnedRows,
|
|
86102
|
+
originalLength: formatted.originalLength
|
|
86103
|
+
});
|
|
86064
86104
|
if (formatted.isError) {
|
|
86065
86105
|
return {
|
|
86066
86106
|
content: [
|
|
@@ -86199,7 +86239,7 @@ function addApiCallTool(server2, strategy, allowedTools = ["CallWixSiteAPI", "Li
|
|
|
86199
86239
|
destructiveHint: true,
|
|
86200
86240
|
openWorldHint: false
|
|
86201
86241
|
}),
|
|
86202
|
-
async ({ url, body, method, reason }, { httpClient }) => {
|
|
86242
|
+
async ({ url, body, method, reason }, { httpClient, setToolBiParams }) => {
|
|
86203
86243
|
logger2.log(
|
|
86204
86244
|
`Calling Wix Account level API: ${url}, reason="${reason}", body: ${JSON.stringify(body)}`
|
|
86205
86245
|
);
|
|
@@ -86228,6 +86268,10 @@ function addApiCallTool(server2, strategy, allowedTools = ["CallWixSiteAPI", "Li
|
|
|
86228
86268
|
});
|
|
86229
86269
|
const responseData = await handleWixAPIResponse(response);
|
|
86230
86270
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
86271
|
+
setToolBiParams({
|
|
86272
|
+
returnedRows: formatted.returnedRows,
|
|
86273
|
+
originalLength: formatted.originalLength
|
|
86274
|
+
});
|
|
86231
86275
|
if (formatted.isError) {
|
|
86232
86276
|
return {
|
|
86233
86277
|
content: [
|