@wix/mcp 1.0.94 → 1.0.95

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.
Files changed (79) hide show
  1. package/README.md +2 -2
  2. package/build/bin-standalone.js +1116 -321
  3. package/build/cjs/index.cjs +2813 -1147
  4. package/build/cjs/toolkit.cjs +1788 -362
  5. package/build/dts/api-call/headless-release.d.ts +56 -0
  6. package/build/dts/api-call/headless-release.js +135 -0
  7. package/build/dts/api-call/index.d.ts +9 -1
  8. package/build/dts/api-call/index.js +13 -7
  9. package/build/dts/api-call/site-files.d.ts +14 -0
  10. package/build/dts/api-call/site-files.js +106 -10
  11. package/build/dts/api-call/upload-headless-website-files.d.ts +88 -5
  12. package/build/dts/api-call/upload-headless-website-files.js +473 -20
  13. package/build/dts/api-call/upload-image-tool.d.ts +2 -0
  14. package/build/dts/api-call/upload-image-tool.js +8 -4
  15. package/build/dts/bin.d.ts +1 -1
  16. package/build/dts/bin.js +3 -1
  17. package/build/dts/code-mode/index.d.ts +6 -1
  18. package/build/dts/code-mode/index.js +30 -10
  19. package/build/dts/code-mode/truncate-response.js +5 -1
  20. package/build/dts/config/default-config.d.ts +35 -5
  21. package/build/dts/config/default-config.js +334 -178
  22. package/build/dts/config/file-params.d.ts +22 -0
  23. package/build/dts/config/file-params.js +24 -0
  24. package/build/dts/config/param-descriptions.d.ts +14 -2
  25. package/build/dts/config/param-descriptions.js +33 -14
  26. package/build/dts/constants.d.ts +1 -0
  27. package/build/dts/constants.js +1 -0
  28. package/build/dts/docs/docs.d.ts +12 -1
  29. package/build/dts/docs/docs.js +210 -42
  30. package/build/dts/docs/fetch-article.d.ts +21 -0
  31. package/build/dts/docs/fetch-article.js +66 -4
  32. package/build/dts/docs/get-to-know.d.ts +7 -2
  33. package/build/dts/docs/get-to-know.js +36 -14
  34. package/build/dts/docs/mintlify-docs.d.ts +121 -0
  35. package/build/dts/docs/mintlify-docs.js +391 -0
  36. package/build/dts/docs/semanticSearch.d.ts +2 -1
  37. package/build/dts/docs/semanticSearch.js +14 -7
  38. package/build/dts/docs/start-deploy-website.d.ts +7 -6
  39. package/build/dts/docs/start-deploy-website.js +13 -8
  40. package/build/dts/docs/start-headless-build.d.ts +8 -10
  41. package/build/dts/docs/start-headless-build.js +14 -28
  42. package/build/dts/index.d.ts +2 -2
  43. package/build/dts/index.js +2 -2
  44. package/build/dts/infra/redact-personal-data.d.ts +4 -0
  45. package/build/dts/infra/redact-personal-data.js +79 -0
  46. package/build/dts/site-widget-tools/constants.d.ts +49 -1
  47. package/build/dts/site-widget-tools/constants.js +64 -7
  48. package/build/dts/site-widget-tools/index.d.ts +1 -0
  49. package/build/dts/site-widget-tools/index.js +1 -0
  50. package/build/dts/site-widget-tools/pick-images-tool/index.d.ts +14 -0
  51. package/build/dts/site-widget-tools/pick-images-tool/index.js +138 -0
  52. package/build/dts/site-widget-tools/search-site-templates-tool/index.js +16 -2
  53. package/build/dts/site-widget-tools/site-builder-tool/index.js +22 -2
  54. package/build/dts/site-widget-tools/site-creation-tool/index.d.ts +7 -1
  55. package/build/dts/site-widget-tools/site-creation-tool/index.js +22 -51
  56. package/build/dts/site-widget-tools/suggested-domain-tool/index.js +6 -3
  57. package/build/dts/support/index.d.ts +4 -0
  58. package/build/dts/support/index.js +13 -7
  59. package/build/dts/toolkit-entry.d.cts +15 -10
  60. package/build/dts/toolkit-entry.d.ts +15 -10
  61. package/build/dts/toolkit.d.ts +2 -2
  62. package/build/dts/toolkit.js +14 -7
  63. package/build/dts/wix-mcp-server.d.ts +10 -1
  64. package/build/dts/wix-mcp-server.js +25 -7
  65. package/build/dts/wixel/constants.d.ts +8 -1
  66. package/build/dts/wixel/constants.js +8 -1
  67. package/build/dts/wixel/index.d.ts +1 -1
  68. package/build/dts/wixel/index.js +2 -2
  69. package/build/dts/wixel/wixel-a2a-client.d.ts +83 -0
  70. package/build/dts/wixel/wixel-a2a-client.js +166 -0
  71. package/build/dts/wixel/wixel-bi.d.ts +2 -1
  72. package/build/dts/wixel/wixel-bi.js +2 -1
  73. package/build/dts/wixel/{external-agent-api.d.ts → wixel-session-entries.d.ts} +11 -33
  74. package/build/dts/wixel/{external-agent-api.js → wixel-session-entries.js} +33 -54
  75. package/build/dts/wixel/wixel-session-tools.d.ts +21 -26
  76. package/build/dts/wixel/wixel-session-tools.js +494 -599
  77. package/build/esm/index.js +2824 -1170
  78. package/build/esm/toolkit.js +1786 -360
  79. package/package.json +4 -4
package/build/dts/bin.js CHANGED
@@ -95,7 +95,9 @@ if (docsTools.length > 0 || hasGetToKnowWix) {
95
95
  logger.log('Adding docs tools:', docsTools);
96
96
  addDocsTools(server, docsTools, {
97
97
  getToKnowWixEnabled: hasGetToKnowWix,
98
- dynamicContextEnabled: hasDynamicContext
98
+ dynamicContextEnabled: hasDynamicContext,
99
+ // Mintlify docs: --docsSite=mintlify-links (or WIX_MCP_DOCS_SITE).
100
+ docsSite: parsedArgs['docsSite'] ?? process.env.WIX_MCP_DOCS_SITE
99
101
  });
100
102
  }
101
103
  if (activeTools.includes('VELO_README')) {
@@ -20,8 +20,13 @@ export interface CodeModeOptions {
20
20
  };
21
21
  disableTools?: string[];
22
22
  toolDescriptions?: Record<string, string>;
23
- /** Max response size in chars before truncation (default: 24,000, ~6,000 tokens). */
23
+ /** Max response size in chars before truncation (defaults: ExecuteWixAPI 100,000, SearchWixAPISpec 64,000). */
24
24
  maxResponseSize?: number;
25
+ /**
26
+ * The connection's docsSite (see ../docs/mintlify-docs.ts). SearchWixAPISpec
27
+ * passes it on, so a Mintlify mode also finds schemas by Mintlify page URL.
28
+ */
29
+ docsSite?: string;
25
30
  }
26
31
  export declare const EXECUTE_TOOL_NAME = "ExecuteWixAPI";
27
32
  export declare function addCodeModeTools(server: WixMcpServer, options: CodeModeOptions): Promise<void>;
@@ -1,11 +1,13 @@
1
1
  import { z } from 'zod';
2
2
  import { AttachmentError, resolveAttachments } from './attachments.js';
3
+ import { fileParamNote } from '../config/file-params.js';
3
4
  import { logger } from '../infra/logger.js';
4
5
  import { defaultToolDescriptions } from '../config/default-config.js';
5
6
  import { truncateResponse } from './truncate-response.js';
6
7
  import { MAX_ALLOWED_RESPONSE_CHARS } from '../infra/response-size-limits.js';
7
8
  import { validateExecuteCode } from './validation.js';
8
9
  import { desc } from '../config/param-descriptions.js';
10
+ import { isMintlifyDocsSite, rewriteDocsLinks, toDevWixHostText } from '../docs/mintlify-docs.js';
9
11
  import { rethrowIfUnauthorized } from '../auth/index.js';
10
12
  import { WixFetchError } from '../wix-fetch-error.js';
11
13
  import { addUploadHeadlessWebsiteFilesTool, UPLOAD_HEADLESS_WEBSITE_FILES_TOOL_NAME } from '../api-call/upload-headless-website-files.js';
@@ -44,13 +46,13 @@ export async function addCodeModeTools(server, options) {
44
46
  * lightIndex.
45
47
  */
46
48
  export function addSearchCodeModeTool(server, options) {
47
- const { codeModeBaseUrl, codeModeFetch, authStrategy, disableTools = [], toolDescriptions, maxResponseSize } = options;
49
+ const { codeModeBaseUrl, codeModeFetch, authStrategy, disableTools = [], toolDescriptions, maxResponseSize, docsSite } = options;
48
50
  if (disableTools.includes(SEARCH_TOOL_NAME)) {
49
51
  return;
50
52
  }
51
53
  const description = toolDescriptions?.[SEARCH_TOOL_NAME] ??
52
54
  defaultToolDescriptions.SearchWixAPISpec;
53
- registerSearchTool(server, codeModeBaseUrl, description, maxResponseSize, authStrategy, codeModeFetch);
55
+ registerSearchTool(server, codeModeBaseUrl, description, maxResponseSize, authStrategy, codeModeFetch, docsSite);
54
56
  }
55
57
  export function addExecuteCodeModeTool(server, options) {
56
58
  const { codeModeBaseUrl, codeModeFetch, authStrategy, visitor, disableTools = [], toolDescriptions, maxResponseSize } = options;
@@ -67,6 +69,9 @@ export function addExecuteCodeModeTool(server, options) {
67
69
  });
68
70
  }
69
71
  const SEARCH_MAX_RESPONSE_CHARS = 64_000;
72
+ // ExecuteWixAPI's own default, ~25,000 tokens, so a full API listing comes back
73
+ // whole. A session's maxResponseSize still overrides it.
74
+ const EXECUTE_MAX_RESPONSE_CHARS = 100_000;
70
75
  /**
71
76
  * Search needs no auth of its own; without a header the call is bucketed by the
72
77
  * Worker's own IP (see postExecute). Anonymous sessions throw here and stay on
@@ -80,7 +85,7 @@ async function resolveLoopbackAuthorization(authStrategy) {
80
85
  return undefined;
81
86
  }
82
87
  }
83
- function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSize, authStrategy, codeModeFetch = defaultCodeModeFetch) {
88
+ function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSize, authStrategy, codeModeFetch = defaultCodeModeFetch, docsSite) {
84
89
  const searchUrl = `${codeModeBaseUrl}/api/code-mode/search`;
85
90
  server.tool(SEARCH_TOOL_NAME, description, {
86
91
  code: z
@@ -99,7 +104,8 @@ function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSiz
99
104
  'Content-Type': 'application/json',
100
105
  ...(authorization ? { Authorization: authorization } : {})
101
106
  },
102
- body: JSON.stringify({ code })
107
+ // docsSite only when set: without it the request is as before.
108
+ body: JSON.stringify(docsSite ? { code, docsSite } : { code })
103
109
  });
104
110
  if (!resp.ok) {
105
111
  const errorBody = await resp.text();
@@ -126,7 +132,13 @@ function registerSearchTool(server, codeModeBaseUrl, description, maxResponseSiz
126
132
  ]
127
133
  };
128
134
  }
129
- const text = truncateResponse(data.result, maxResponseSize ?? SEARCH_MAX_RESPONSE_CHARS);
135
+ // Mintlify docs: the index shows docsUrls on the Mintlify host by rule.
136
+ // Map them back, then resolve each to its Mintlify page as the docs tools
137
+ // do, so a page the site doesn't have keeps its dev.wix.com link.
138
+ const result = isMintlifyDocsSite(docsSite) && data.result !== undefined
139
+ ? JSON.parse((await rewriteDocsLinks(toDevWixHostText(JSON.stringify(data.result)), { label: 'search SearchWixAPISpec' })).text)
140
+ : data.result;
141
+ const text = truncateResponse(result, maxResponseSize ?? SEARCH_MAX_RESPONSE_CHARS);
130
142
  return {
131
143
  content: [{ type: 'text', text }]
132
144
  };
@@ -167,10 +179,13 @@ async function postExecute(executeUrl, body, authorization, codeModeFetch = defa
167
179
  }
168
180
  return (await resp.json());
169
181
  }
170
- function executeErrorResult(message) {
182
+ function executeErrorResult(message, failedCalls) {
171
183
  return {
172
184
  isError: true,
173
- content: [{ type: 'text', text: `Execute error: ${message}` }]
185
+ content: [{ type: 'text', text: `Execute error: ${message}` }],
186
+ // The failed calls as fields, request ids included. The text carries the
187
+ // ids too, for clients that don't read structured results.
188
+ ...(failedCalls?.length ? { structuredContent: { failedCalls } } : {})
174
189
  };
175
190
  }
176
191
  function executeTextResult(message) {
@@ -180,7 +195,7 @@ function executeTextResult(message) {
180
195
  }
181
196
  function formatExecuteResult(data, maxResponseSize, reportBi) {
182
197
  if (data.error) {
183
- return executeErrorResult(data.error);
198
+ return executeErrorResult(data.error, data.failedCalls);
184
199
  }
185
200
  // Before the slice -- resultTextLength is measured after it and saturates.
186
201
  reportBi?.({
@@ -203,7 +218,10 @@ function formatExecuteResult(data, maxResponseSize, reportBi) {
203
218
  }
204
219
  return {
205
220
  content: [
206
- { type: 'text', text: truncateResponse(data.result, maxResponseSize) }
221
+ {
222
+ type: 'text',
223
+ text: truncateResponse(data.result, maxResponseSize ?? EXECUTE_MAX_RESPONSE_CHARS)
224
+ }
207
225
  ]
208
226
  };
209
227
  }
@@ -269,7 +287,8 @@ function addExecuteTool(server, options) {
269
287
  mime_type: z.string().optional()
270
288
  }))
271
289
  .optional()
272
- .describe('ChatGPT only. Files attached in the chat or created in your sandbox (any type: a zip of a site, HTML, images, PDFs): pass each file as you have it, its file id or its /mnt/data path, and ChatGPT swaps it for { download_url, file_id, file_name?, mime_type? } before the call reaches Wix. No other client does this swap, so outside ChatGPT a path or file:// URL here fails at once; leave this out and use `files`, or upload from your shell if it reaches the internet. The bytes are fetched here and appended to the `files` global as { path, content, encoding: "base64" } entries (path = file_name), so `wix.multipart()` and `wix.unzip()` work on them unchanged. Prefer this over base64 in `files` whenever you have a file handle. Up to 10 MB per call.'),
290
+ .describe(fileParamNote('use `files`, or upload from your shell if it reaches the internet') +
291
+ ' Any type: a zip of a site, HTML, images, PDFs. The bytes are fetched here and appended to the `files` global as { path, content, encoding: "base64" } entries (path = file_name), so `wix.multipart()` and `wix.unzip()` work on them unchanged. Prefer this over base64 in `files` whenever you have a file handle. Up to 10 MB per call.'),
273
292
  // Visitor mode takes an agent-supplied token and pins the site; account/site
274
293
  // mode lets the agent pick the site.
275
294
  ...(visitor
@@ -360,6 +379,7 @@ function addExecuteTool(server, options) {
360
379
  sessionId,
361
380
  toolInvocationId,
362
381
  clientName: server.server?.getClientVersion?.()?.name,
382
+ ...(visitor ? { visitorMode: true } : {}),
363
383
  // A visitor token is a site-scoped bearer token: sent as siteToken
364
384
  // (→ Authorization + wix-site-id) and as accountToken only to satisfy
365
385
  // the runtime's required field. Account/site mode uses strategy tokens.
@@ -17,6 +17,10 @@ export function truncateResponse(content, maxChars = DEFAULT_MAX_CHARS) {
17
17
  const truncated = text.slice(0, effectiveMax);
18
18
  const estimatedTokens = Math.ceil(text.length / CHARS_PER_TOKEN);
19
19
  const limitTokens = Math.ceil(effectiveMax / CHARS_PER_TOKEN);
20
- return `${truncated}\n\n--- TRUNCATED ---\nResponse was ~${estimatedTokens.toLocaleString()} tokens (limit: ${limitTokens.toLocaleString()}). Refine your code to return less data.`;
20
+ const cutChars = text.length - effectiveMax;
21
+ const note = `Response was ~${estimatedTokens.toLocaleString()} tokens (limit: ${limitTokens.toLocaleString()}). Showing the first ${effectiveMax.toLocaleString()} of ${text.length.toLocaleString()} characters; the last ${cutChars.toLocaleString()} were cut. To get the rest, run again and return less per call — only the fields you need, the next page (cursor or offset), or the next slice of a large array — and repeat until you have it all.`;
22
+ // At the top as well as the end: a client that cuts a long result keeps its
23
+ // head, so a note only at the end is the first thing lost.
24
+ return `[TRUNCATED: ${note}]\n\n${truncated}\n\n--- TRUNCATED ---\n${note}`;
21
25
  }
22
26
  //# sourceMappingURL=truncate-response.js.map
@@ -21,29 +21,48 @@ export interface ModeDefaultConfig {
21
21
  skillsPrOverrideEnabled?: boolean;
22
22
  graphqlEnabled?: boolean;
23
23
  }
24
+ /**
25
+ * CallWixSiteAPI's advice when the Wix MCP lists no ExecuteWixAPI. True only where the server serves
26
+ * ExecuteWixAPI (a client with an old or cached tool list); `addApiCallTool` swaps it for
27
+ * `CALL_WIX_SITE_API_NO_EXECUTE_LINE` where ExecuteWixAPI is off on purpose.
28
+ */
29
+ export declare const CALL_WIX_SITE_API_RECONNECT_LINE = "If the Wix MCP offers no ExecuteWixAPI at all, your Wix connection is likely an old or cached version: tell the user once to reconnect the Wix connector or restart the client, and use this tool until then.";
30
+ export declare const CALL_WIX_SITE_API_NO_EXECUTE_LINE = "If ExecuteWixAPI isn't in your tool list, use this tool.";
24
31
  export declare const SYSTEM_REMINDER_GUIDELINES: string;
25
32
  export declare function buildSystemReminder(includeReadme: boolean, includeImageUploadGuidance?: boolean): string;
26
33
  export declare const SYSTEM_REMINDER: string;
34
+ /** SearchWixHelpCenter's description and response both carry this: Help Center is for people, the developer docs for the agent's own actions. */
35
+ export declare const HELP_CENTER_IS_FOR_PEOPLE = "The Help Center is written for people doing things by hand in Wix's dashboard and editors. To act on a site yourself, the Wix developer docs come first: find the method with SearchWixRESTDocumentation or BrowseWixRESTDocsMenu.";
36
+ /**
37
+ * The MCP server's \`instructions\`, sent in its reply to initialize. Clients that show them
38
+ * (ChatGPT and Codex use the first 512 characters; Claude Code loads them at session start and
39
+ * cuts at 4,096) get the site-creation routing before any tool definition. Sent only to a session
40
+ * that has every tool it names (SERVER_INSTRUCTIONS_TOOLS).
41
+ * Each tool named here carries a comment pointing back to this text. A change to any of them (a
42
+ * name, what it is for, a new site-creation tool) updates this text and that list with it.
43
+ */
44
+ export declare const SERVER_INSTRUCTIONS = "Wix: build and manage Wix sites. A new site is written in code and uploaded: StartDeployWebsite returns the upload guide; StartHeadlessBuild returns the headless guide, for a site that needs Wix business features (forms, a store, bookings, a CMS, members, payments). WixSiteBuilder or SearchSiteTemplates only when the user asked for Wix's editor, the Wix Harmony Editor, a template, Wix Studio or the Classic Editor. For anything else, except ListWixSites and UploadImageToWixSite, call WixREADME first.";
45
+ /** The tools SERVER_INSTRUCTIONS names. */
46
+ export declare const SERVER_INSTRUCTIONS_TOOLS: string[];
27
47
  export declare const SITE_CREATION_COPY: {
28
48
  readonly templatePick: {
29
49
  readonly nonWidget: "After the user selects a template, call `CreateSiteFromTemplate`.";
30
50
  readonly widget: "The gallery creates the site when the user picks one.";
31
51
  };
32
- readonly unstatedMethod: {
33
- readonly nonWidget: "you MUST ask whether they want to build with AI or start from a template, and create nothing and show nothing until they answer";
34
- readonly widget: "you MUST call `WixSiteCreation` and let them choose";
35
- };
36
52
  };
37
53
  /** Rewrites non-widget copy into its widget form; a no-op on text that carries no divergence. */
38
54
  export declare const toWidget: (text: string) => string;
39
55
  export declare const executeWixApiDescription: string;
40
- export declare function buildToolDescriptions(includeReadme: boolean, includeImageUploadGuidance?: boolean): Record<string, string>;
56
+ export declare function buildToolDescriptions(includeReadme: boolean, includeImageUploadGuidance?: boolean, { usageGuideOnce }?: {
57
+ usageGuideOnce?: boolean;
58
+ }): Record<string, string>;
41
59
  /**
42
60
  * Canonical (README-inclusive) tool descriptions used by the live MCP server and
43
61
  * all existing importers.
44
62
  */
45
63
  export declare const defaultToolDescriptions: Record<string, string>;
46
64
  export declare const executeCodeModeToolDescriptions: Record<string, string>;
65
+ export declare const WIX_SKILLS_README_SECTION: string;
47
66
  /**
48
67
  * Default readme docs - content for WixREADME tool response.
49
68
  * Assumes both ExecuteWixAPI and SearchWixAPISpec are available (execute-and-search mode).
@@ -51,6 +70,9 @@ export declare const executeCodeModeToolDescriptions: Record<string, string>;
51
70
  * Joined rather than interpolated into one `dedent` — `dedent` reads indentation from the literal
52
71
  * parts only, so a multi-line interpolation gets flattened.
53
72
  */
73
+ export declare function buildReadmeDocs({ recipesIndex }?: {
74
+ recipesIndex?: boolean;
75
+ }): ReadmeDocConfig[];
54
76
  export declare const defaultReadmeDocs: ReadmeDocConfig[];
55
77
  /**
56
78
  * Merge base config with overrides
@@ -64,6 +86,14 @@ export declare function mergeConfig(base: ModeDefaultConfig, overrides: Partial<
64
86
  * All tools enabled, all descriptions, good readmeDocs
65
87
  */
66
88
  export declare const defaultConfig: ModeDefaultConfig;
89
+ /**
90
+ * For a session without WixREADME (mode=code, getToKnowWixEnabled off, WixREADME disabled): the
91
+ * usage guide WixREADME carries goes back onto every tool, as it was before usageGuideOnce.
92
+ * Custom tool descriptions are kept.
93
+ */
94
+ export declare function withUsageGuideOnEveryTool<Config extends {
95
+ toolDescriptions?: Record<string, string>;
96
+ }>(config: Config): Config;
67
97
  /**
68
98
  * Delta for clients that declared the MCP-Apps UI extension. Merged over the mode config at
69
99
  * request time, since the mode override and the widget variant have to compose.