@wix/mcp 1.0.84 → 1.0.86

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.
@@ -13226,6 +13226,22 @@ function renderApps(apps, knownApps) {
13226
13226
  }
13227
13227
  return lines.join("\n");
13228
13228
  }
13229
+ function sanitizeCustomAppName(raw) {
13230
+ return raw.replace(/[\x00-\x1f\x7f]/g, " ").replace(/[`*_[\]|<>]/g, "").replace(/\s+/g, " ").trim().slice(0, 60);
13231
+ }
13232
+ function renderCustomAppsWithSkillsTools(apps) {
13233
+ const relevant = apps.filter((a) => a.appId && (a.hasSkills || a.hasTools)).sort(
13234
+ (a, b) => (a.appName ?? a.appId ?? "").localeCompare(b.appName ?? b.appId ?? "")
13235
+ );
13236
+ if (!relevant.length) return "";
13237
+ const lines = [];
13238
+ for (const app of relevant) {
13239
+ const sanitizedName = app.appName ? sanitizeCustomAppName(app.appName) : "";
13240
+ const name = sanitizedName || app.appId;
13241
+ lines.push(`- \`${name}\` (ID: \`${app.appId}\`)`);
13242
+ }
13243
+ return lines.join("\n");
13244
+ }
13229
13245
  function renderProperties(props) {
13230
13246
  const sections = [];
13231
13247
  const regionalFormat = [];
@@ -13288,6 +13304,15 @@ function renderSite(site, index, knownApps) {
13288
13304
  lines.push("");
13289
13305
  lines.push(appsContent);
13290
13306
  }
13307
+ const customAppsWithSkillsToolsContent = renderCustomAppsWithSkillsTools(
13308
+ site.customApps ?? []
13309
+ );
13310
+ if (customAppsWithSkillsToolsContent) {
13311
+ lines.push("");
13312
+ lines.push("### Custom Apps with skills and tools");
13313
+ lines.push("");
13314
+ lines.push(customAppsWithSkillsToolsContent);
13315
+ }
13291
13316
  lines.push("");
13292
13317
  lines.push("---");
13293
13318
  lines.push("");
@@ -14079,7 +14104,9 @@ function getErrorMessage(error) {
14079
14104
  }
14080
14105
  function shouldTryMenuFallbackForDocsRead(error, articleUrl) {
14081
14106
  const message = getErrorMessage(error);
14082
- if (!message.includes("404") || !articleUrl.includes("/api-reference/")) {
14107
+ const { pathname } = new URL(articleUrl);
14108
+ const isMenuFallbackUrl = articleUrl.includes("/api-reference/") || pathname.startsWith("/docs/velo");
14109
+ if (!message.includes("404") || !isMenuFallbackUrl) {
14083
14110
  return false;
14084
14111
  }
14085
14112
  return !["This resource is deprecated", "No schema found"].some(
@@ -14732,7 +14759,7 @@ var addDocsTools = (server, allowedTools = [
14732
14759
  content: [
14733
14760
  {
14734
14761
  type: "text",
14735
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
14762
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
14736
14763
 
14737
14764
  ${text}`
14738
14765
  }
@@ -14824,7 +14851,7 @@ ${text}`
14824
14851
  content: [
14825
14852
  {
14826
14853
  type: "text",
14827
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
14854
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
14828
14855
 
14829
14856
  ${text}`
14830
14857
  }
@@ -16447,11 +16474,13 @@ function validateExecuteCode(code) {
16447
16474
  }
16448
16475
 
16449
16476
  // src/code-mode/index.ts
16477
+ var defaultCodeModeFetch = (url, init) => fetch(url, init);
16450
16478
  var SEARCH_TOOL_NAME = "SearchWixAPISpec";
16451
16479
  var EXECUTE_TOOL_NAME = "ExecuteWixAPI";
16452
16480
  function addSearchCodeModeTool(server, options) {
16453
16481
  const {
16454
16482
  codeModeBaseUrl,
16483
+ codeModeFetch,
16455
16484
  authStrategy,
16456
16485
  disableTools = [],
16457
16486
  toolDescriptions,
@@ -16466,12 +16495,14 @@ function addSearchCodeModeTool(server, options) {
16466
16495
  codeModeBaseUrl,
16467
16496
  description,
16468
16497
  maxResponseSize,
16469
- authStrategy
16498
+ authStrategy,
16499
+ codeModeFetch
16470
16500
  );
16471
16501
  }
16472
16502
  function addExecuteCodeModeTool(server, options) {
16473
16503
  const {
16474
16504
  codeModeBaseUrl,
16505
+ codeModeFetch,
16475
16506
  authStrategy,
16476
16507
  visitor,
16477
16508
  disableTools = [],
@@ -16483,6 +16514,7 @@ function addExecuteCodeModeTool(server, options) {
16483
16514
  }
16484
16515
  addExecuteTool(server, {
16485
16516
  codeModeBaseUrl,
16517
+ codeModeFetch,
16486
16518
  authStrategy,
16487
16519
  visitor,
16488
16520
  toolDescriptions,
@@ -16497,7 +16529,7 @@ async function resolveLoopbackAuthorization(authStrategy) {
16497
16529
  return void 0;
16498
16530
  }
16499
16531
  }
16500
- function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSize, authStrategy) {
16532
+ function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSize, authStrategy, codeModeFetch = defaultCodeModeFetch) {
16501
16533
  const searchUrl = `${codeModeBaseUrl}/api/code-mode/search`;
16502
16534
  server.tool(
16503
16535
  SEARCH_TOOL_NAME,
@@ -16517,7 +16549,7 @@ function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSiz
16517
16549
  );
16518
16550
  try {
16519
16551
  const authorization3 = await resolveLoopbackAuthorization(authStrategy);
16520
- const resp = await fetch(searchUrl, {
16552
+ const resp = await codeModeFetch(searchUrl, {
16521
16553
  method: "POST",
16522
16554
  headers: {
16523
16555
  "Content-Type": "application/json",
@@ -16568,8 +16600,8 @@ function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSiz
16568
16600
  }
16569
16601
  );
16570
16602
  }
16571
- async function postExecute(executeUrl, body, authorization3) {
16572
- const resp = await fetch(executeUrl, {
16603
+ async function postExecute(executeUrl, body, authorization3, codeModeFetch = defaultCodeModeFetch) {
16604
+ const resp = await codeModeFetch(executeUrl, {
16573
16605
  method: "POST",
16574
16606
  headers: {
16575
16607
  "Content-Type": "application/json",
@@ -16611,6 +16643,7 @@ function formatExecuteResult(data, maxResponseSize, reportBi) {
16611
16643
  function addExecuteTool(server, options) {
16612
16644
  const {
16613
16645
  codeModeBaseUrl,
16646
+ codeModeFetch,
16614
16647
  authStrategy,
16615
16648
  visitor,
16616
16649
  toolDescriptions,
@@ -16699,7 +16732,8 @@ function addExecuteTool(server, options) {
16699
16732
  accountId: accountHeaders?.["wix-account-id"],
16700
16733
  siteAuthContext
16701
16734
  },
16702
- visitor ? visitorToken : accountHeaders?.Authorization ?? siteHeaders?.Authorization
16735
+ visitor ? visitorToken : accountHeaders?.Authorization ?? siteHeaders?.Authorization,
16736
+ codeModeFetch
16703
16737
  );
16704
16738
  if (data.authErrorStatus && visitor) {
16705
16739
  return executeErrorResult(
@@ -18559,7 +18593,25 @@ function extractText(result) {
18559
18593
  return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
18560
18594
  }
18561
18595
  var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
18562
- function formatToolResultAdditionalFields(result, extras) {
18596
+ var CODEX_OUTPUT_BUDGET_BYTES = 4e4;
18597
+ function getCodexTruncation(resultText, client) {
18598
+ const isCodex = [client?.name, client?.userAgent].some(
18599
+ (identity) => identity?.toLowerCase().includes("codex")
18600
+ );
18601
+ if (!isCodex) {
18602
+ return void 0;
18603
+ }
18604
+ const resultBytes = new TextEncoder().encode(resultText).length;
18605
+ if (resultBytes <= CODEX_OUTPUT_BUDGET_BYTES) {
18606
+ return void 0;
18607
+ }
18608
+ return {
18609
+ resultBytes,
18610
+ budgetBytes: CODEX_OUTPUT_BUDGET_BYTES,
18611
+ truncatedBytes: resultBytes - CODEX_OUTPUT_BUDGET_BYTES
18612
+ };
18613
+ }
18614
+ function formatToolResultAdditionalFields(result, extras, client) {
18563
18615
  const resultText = extractText(result);
18564
18616
  const contentTypes = [
18565
18617
  ...new Set(
@@ -18576,6 +18628,7 @@ function formatToolResultAdditionalFields(result, extras) {
18576
18628
  resultTextLength: resultText.length,
18577
18629
  resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
18578
18630
  resultContentTypes: contentTypes,
18631
+ codexTruncation: getCodexTruncation(resultText, client),
18579
18632
  ...extras
18580
18633
  });
18581
18634
  }
@@ -18713,7 +18766,8 @@ function createWixToolkit(options) {
18713
18766
  toolDescriptions,
18714
18767
  toolHints,
18715
18768
  maxResponseSize,
18716
- codeModeBaseUrl = "https://mcp.wix.com"
18769
+ codeModeBaseUrl = "https://mcp.wix.com",
18770
+ codeModeFetch
18717
18771
  } = api;
18718
18772
  const effectiveToolDescriptions = {
18719
18773
  ...descriptionsWithoutReadme,
@@ -18737,6 +18791,7 @@ function createWixToolkit(options) {
18737
18791
  if (requestedTools.has("SearchWixAPISpec") && !disableTools?.includes("SearchWixAPISpec")) {
18738
18792
  addSearchCodeModeTool(server, {
18739
18793
  codeModeBaseUrl,
18794
+ codeModeFetch,
18740
18795
  authStrategy,
18741
18796
  disableTools,
18742
18797
  toolDescriptions: effectiveToolDescriptions,
@@ -18746,6 +18801,7 @@ function createWixToolkit(options) {
18746
18801
  if (requestedTools.has("ExecuteWixAPI") && !disableTools?.includes("ExecuteWixAPI")) {
18747
18802
  addExecuteCodeModeTool(server, {
18748
18803
  codeModeBaseUrl,
18804
+ codeModeFetch,
18749
18805
  authStrategy,
18750
18806
  disableTools,
18751
18807
  toolDescriptions: effectiveToolDescriptions,
@@ -18828,10 +18884,14 @@ function createWixToolkit(options) {
18828
18884
  if (!toolSucceeded) {
18829
18885
  errorBody = extractText(cbResult);
18830
18886
  } else {
18831
- additionalFields = formatToolResultAdditionalFields(cbResult, {
18832
- returnedRows: toolBiParams.returnedRows,
18833
- originalLength: toolBiParams.originalLength
18834
- });
18887
+ additionalFields = formatToolResultAdditionalFields(
18888
+ cbResult,
18889
+ {
18890
+ returnedRows: toolBiParams.returnedRows,
18891
+ originalLength: toolBiParams.originalLength
18892
+ },
18893
+ { name: clientName }
18894
+ );
18835
18895
  }
18836
18896
  if (!isDevEnvironment) {
18837
18897
  if (toolSucceeded) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/mcp",
3
- "version": "1.0.84",
3
+ "version": "1.0.86",
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.3",
46
+ "@wix/dynamic-context-enricher": "0.1.4",
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": "c391c0fba13ea30921f1c007a71a652bd532ba1f063ebed6c8c35627"
136
+ "falconPackageHash": "bfa0ad2bd45ba9e54844e736741354d379ec2790f92872287c5fc1d2"
137
137
  }