@wix/mcp 1.0.12 → 1.0.14

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.
@@ -15065,7 +15065,7 @@ var runSemanticSearchAndFormat = async ({
15065
15065
  import { captureException } from "@sentry/node";
15066
15066
 
15067
15067
  // src/docs/fetch-article.ts
15068
- async function fetchArticleContentFromDigor(httpClient, articleUrl, mode) {
15068
+ async function fetchArticleContentFromDigor(httpClient, articleUrl, mode, stripHeader = false) {
15069
15069
  const url = new URL(`https://dev.wix.com/digor/api/get-article-content`);
15070
15070
  url.searchParams.set("articleUrl", articleUrl);
15071
15071
  const schema = mode === "methodSchema" ? "true" : "false";
@@ -15073,14 +15073,133 @@ async function fetchArticleContentFromDigor(httpClient, articleUrl, mode) {
15073
15073
  logger.log(`Fetching resource from docs ${url.toString()}`);
15074
15074
  const { data } = await httpClient.get(url.toString());
15075
15075
  logger.log(`Fetched resource from docs: ${data.articleContent}`);
15076
+ const headerDivider = "## Article Content:";
15077
+ if (stripHeader) {
15078
+ const headerIndex = data.articleContent.indexOf(headerDivider);
15079
+ if (headerIndex !== -1) {
15080
+ return data.articleContent.substring(
15081
+ headerIndex + headerDivider.length
15082
+ );
15083
+ }
15084
+ }
15076
15085
  return data.articleContent;
15077
15086
  }
15078
- async function fetchArticleContent(httpClient, articleUrl, mode) {
15087
+ async function fetchArticleContent(httpClient, articleUrl, mode, stripHeader = false) {
15079
15088
  if (mode === "raw") {
15080
15089
  const { data: doc } = await httpClient.get(articleUrl);
15081
15090
  return doc;
15082
15091
  }
15083
- return fetchArticleContentFromDigor(httpClient, articleUrl, mode);
15092
+ return fetchArticleContentFromDigor(
15093
+ httpClient,
15094
+ articleUrl,
15095
+ mode,
15096
+ stripHeader
15097
+ );
15098
+ }
15099
+
15100
+ // src/docs/get-to-know.ts
15101
+ var docURLs = [
15102
+ {
15103
+ url: "https://dev.wix.com/docs/picasso/wix-ai-docs/index/get-to-know-wix-llm-instructions",
15104
+ action: "include"
15105
+ },
15106
+ {
15107
+ url: "https://dev.wix.com/docs/picasso/wix-ai-docs/index/wix-concepts",
15108
+ action: "include"
15109
+ },
15110
+ {
15111
+ url: "https://dev.wix.com/docs/picasso/wix-ai-docs/index/wix-business-solutions",
15112
+ action: "index",
15113
+ title: "Wix Business Solutions",
15114
+ description: `This document provides an overview of the all business solutions available in Wix.
15115
+
15116
+ Use this document under the following scenarios:
15117
+ 1. The user asks general questions about Wix business solutions.
15118
+ 2. The user asks about a specific business solution, and you want to provide a high-level overview of it.
15119
+ 3. The user looks for a specific business solution, and you want to provide a list of all available solutions.
15120
+
15121
+ Please note that this is a large document. Only use it for the scenarios mentioned above.`
15122
+ },
15123
+ {
15124
+ url: "https://dev.wix.com/docs/picasso/wix-ai-docs/index/wix-business-solutions-recipes",
15125
+ action: "include"
15126
+ }
15127
+ ];
15128
+ var DESCRIPTION = `# Tool: WixREADME
15129
+
15130
+ **Directive:** \`WixREADME\` is the **MANDATORY FIRST STEP** for all Wix-related tasks. Its output (including relevant linked documents) provides foundational context for all other Wix tools. Adherence to this protocol is **NON-NEGOTIABLE**.
15131
+
15132
+ **Operational Protocol (Strictly Sequential):**
15133
+
15134
+ 1. **Execute \`WixREADME\`:**
15135
+ * **Action:** Invoke \`WixREADME\`.
15136
+ * **Constraint:** MUST complete successfully. NO other Wix tool before this.
15137
+
15138
+ 2. **Process \`WixREADME\` Output (Link Identification & Relevance Assessment):**
15139
+ * **A. Identify Candidate Links:** Scan \`WixREADME\` output. Extract *only* URLs found within \`<urls>{urls}</urls>\` tags. Ignore all other URLs.
15140
+ * **B. Assess Relevance:** For EACH candidate URL from (A), assess its relevance to the **current user's specific prompt/task**.
15141
+ * **Outcome:** A list of *relevant* document URLs. If no links are found in \`<urls>\` tags or none are deemed relevant, note this and proceed to Step 4.
15142
+
15143
+ 3. **Fetch Relevant Documents (via \`ReadFullDocsArticle\`):**
15144
+ * **Condition:** ONLY if Step 2B identified one or more *relevant* URLs.
15145
+ * **Action:** For EACH *relevant* URL, invoke \`ReadFullDocsArticle\` to fetch its full content.
15146
+ * **Constraint:** All *relevant* documents MUST be fetched before Step 4.
15147
+
15148
+ 4. **Proceed with Other Wix Tools:**
15149
+ * **Condition:** ONLY after completing Steps 1, 2, and 3 (if Step 3 was applicable).
15150
+ * **Action:** Use other Wix tools as needed, utilizing the full context from \`WixREADME\` and fetched relevant documents.
15151
+
15152
+ **Summary of Critical Rules:**
15153
+ * \`WixREADME\` is **ALWAYS FIRST**.
15154
+ * Analyze \`WixREADME\` output: Extract links *only* from \`<urls>{urls}</urls>\` tags.
15155
+ * Assess relevance of *each* extracted link against the user's current task.
15156
+ * Fetch **ONLY RELEVANT** linked documents using \`ReadFullDocsArticle\` before any other Wix tool.
15157
+ * **FAILURE TO FOLLOW THIS EXACT SEQUENCE WILL LEAD TO ERRORS.** Strict adherence is mandatory.`;
15158
+ var WixREADME_DEPENDENT_DESCRIPTION = "**Dependency:** Must be used after 'WixREADME' has successfully run.";
15159
+ async function addGetToKnowTools(server2) {
15160
+ server2.tool("WixREADME", DESCRIPTION, async ({ httpClient }) => {
15161
+ try {
15162
+ const contents = await Promise.all(
15163
+ docURLs.map(async ({ url, action, description, title }) => {
15164
+ if (action === "index") {
15165
+ return {
15166
+ type: "text",
15167
+ text: `## ${title}
15168
+
15169
+ <urls>
15170
+ ${url}
15171
+ </urls>
15172
+
15173
+ ${description}`
15174
+ };
15175
+ }
15176
+ const content = await fetchArticleContent(
15177
+ httpClient,
15178
+ url,
15179
+ "article",
15180
+ true
15181
+ );
15182
+ return {
15183
+ type: "text",
15184
+ text: content
15185
+ };
15186
+ })
15187
+ );
15188
+ return {
15189
+ content: contents
15190
+ };
15191
+ } catch (error) {
15192
+ return {
15193
+ isError: true,
15194
+ content: [
15195
+ {
15196
+ type: "text",
15197
+ text: `Error fetching the document: ${error.message}`
15198
+ }
15199
+ ]
15200
+ };
15201
+ }
15202
+ });
15084
15203
  }
15085
15204
 
15086
15205
  // src/docs/docs.ts
@@ -15099,7 +15218,10 @@ var addDocsTools = (server2, allowedTools = [
15099
15218
  "BUILD_APPS",
15100
15219
  "WIX_HEADLESS",
15101
15220
  "BUSINESS_SOLUTIONS"
15102
- ]) => {
15221
+ ], getToKnowWixEnabled = false) => {
15222
+ if (getToKnowWixEnabled) {
15223
+ addGetToKnowTools(server2);
15224
+ }
15103
15225
  if (allowedTools.includes("WDS")) {
15104
15226
  server2.tool(
15105
15227
  "SearchWixWDSDocumentation",
@@ -15107,7 +15229,8 @@ var addDocsTools = (server2, allowedTools = [
15107
15229
  "Searches the Wix Design System Documentation for components and patterns.",
15108
15230
  "Use this tool when you need to understand or implement UI components and design patterns in a Wix project.",
15109
15231
  "Search for specific component names, patterns, or UI requirements.",
15110
- "If you can't find what you need, try to rephrase your search term or use bigger maxResults value."
15232
+ "If you can't find what you need, try to rephrase your search term or use bigger maxResults value.",
15233
+ getToKnowWixEnabled ? WixREADME_DEPENDENT_DESCRIPTION : ""
15111
15234
  ].join("\n"),
15112
15235
  {
15113
15236
  searchTerm: z.string().describe(
@@ -15161,7 +15284,8 @@ var addDocsTools = (server2, allowedTools = [
15161
15284
  "Searches the official Wix REST API documentation.",
15162
15285
  "Use this tool whenever you need to to interact with the Wix platform via HTTP requests.",
15163
15286
  "Specify the API endpoint, resource, or action you need information about (e.g., 'get site details endpoint', 'create data collection', 'update product API', 'REST authentication').",
15164
- "If you can't find what you need, try to rephrase your search term or use bigger maxResults value."
15287
+ "If you can't find what you need, try to rephrase your search term or use bigger maxResults value.",
15288
+ getToKnowWixEnabled ? WixREADME_DEPENDENT_DESCRIPTION : ""
15165
15289
  ].join("\n"),
15166
15290
  {
15167
15291
  searchTerm: z.string().describe(
@@ -15213,7 +15337,7 @@ var addDocsTools = (server2, allowedTools = [
15213
15337
  }
15214
15338
  );
15215
15339
  }
15216
- if (allowedTools.includes("BUSINESS_SOLUTIONS")) {
15340
+ if (allowedTools.includes("BUSINESS_SOLUTIONS") && !getToKnowWixEnabled) {
15217
15341
  server2.tool(
15218
15342
  "WixBusinessFlowsDocumentation",
15219
15343
  [
@@ -15282,7 +15406,8 @@ var addDocsTools = (server2, allowedTools = [
15282
15406
  "Searches the official Wix javascript SDK documentation.",
15283
15407
  "Use this tool whenever you need to write or modify Wix related SDK code.",
15284
15408
  "Specify the SDK module, function, or feature you need information about (e.g., 'how to query all items from a data collection?', 'how to use wix-stores-backend', 'authentication methods in the SDK').",
15285
- "If you can't find what you need, try to rephrase your search term or use bigger maxResults value."
15409
+ "If you can't find what you need, try to rephrase your search term or use bigger maxResults value.",
15410
+ getToKnowWixEnabled ? WixREADME_DEPENDENT_DESCRIPTION : ""
15286
15411
  ].join("\n"),
15287
15412
  {
15288
15413
  searchTerm: z.string().describe(
@@ -15343,7 +15468,8 @@ var addDocsTools = (server2, allowedTools = [
15343
15468
  "Searches the official Build Apps documentation.",
15344
15469
  "Use this tool when you need to understand or implement Wix CLI applications related code.",
15345
15470
  "The search term should be a specific Wix CLI command or specific topic related to Wix CLI applications or its ecosystem (e.g. deployment, creating new extensions etc).",
15346
- "If you can't find what you need, try to rephrase your search term or use bigger maxResults value."
15471
+ "If you can't find what you need, try to rephrase your search term or use bigger maxResults value.",
15472
+ getToKnowWixEnabled ? WixREADME_DEPENDENT_DESCRIPTION : ""
15347
15473
  ].join("\n"),
15348
15474
  {
15349
15475
  searchTerm: z.string().describe(
@@ -15396,7 +15522,8 @@ var addDocsTools = (server2, allowedTools = [
15396
15522
  "Searches the official Wix Headless Documentation.",
15397
15523
  "Use this tool when you need to understand or implement Headless related code.",
15398
15524
  "The search term should be a specific Wix Headless topic or feature you need information about.",
15399
- "If you can't find what you need, try to rephrase your search term or use bigger maxResults value."
15525
+ "If you can't find what you need, try to rephrase your search term or use bigger maxResults value.",
15526
+ getToKnowWixEnabled ? WixREADME_DEPENDENT_DESCRIPTION : ""
15400
15527
  ].join("\n"),
15401
15528
  {
15402
15529
  searchTerm: z.string().describe(
@@ -15446,7 +15573,8 @@ var addDocsTools = (server2, allowedTools = [
15446
15573
  "ReadFullDocsArticle",
15447
15574
  [
15448
15575
  "Fetches the full Wix docs article or method article.",
15449
- "Use this tool when you read a summary of a docs article or method article, you have the docs url and want to read the full article."
15576
+ "Use this tool when you read a summary of a docs article or method article, you have the docs url and want to read the full article.",
15577
+ getToKnowWixEnabled ? WixREADME_DEPENDENT_DESCRIPTION : ""
15450
15578
  ].join("\n"),
15451
15579
  {
15452
15580
  articleUrl: z.string().describe(
@@ -15539,41 +15667,6 @@ var addDocsTools = (server2, allowedTools = [
15539
15667
  );
15540
15668
  };
15541
15669
 
15542
- // src/docs/get-to-know.ts
15543
- var defaultDocUrl = "https://dev.wix.com/docs/picasso/wix-ai-docs/rules/get-to-know-wix-llm-instructions";
15544
- var DESCRIPTION = `**Tool Name:** WixREADME
15545
- **Description for LLM:**
15546
- "**Mandatory First Action for Wix Tasks.** This tool, 'WixREADME', MUST be executed at the very beginning of any process involving Wix functionalities. It provides the indispensable foundational Wix ecosystem context, global setup details, and current best practices.
15547
-
15548
- **Operational Rule:** Your processing protocol for any Wix-related task dictates that 'WixREADME' is successfully invoked and its output comprehensively analyzed BEFORE any other Wix-specific tool (such as 'ReadFullDocsArticle' or 'SearchX..') is considered or used. This is a non-negotiable prerequisite.
15549
-
15550
- **Function:** Acts as the sole authoritative source for Wix global operational standards and session initialization. Its output is essential for the correct and safe execution of all subsequent Wix-related actions. All other Wix tools are designed to rely on the information it provides."`;
15551
- async function addGetToKnowTools(server2, docUrl) {
15552
- server2.tool("WixREADME", DESCRIPTION, async ({ httpClient }) => {
15553
- try {
15554
- const doc = docUrl ? await fetchArticleContent(httpClient, docUrl, "raw") : await fetchArticleContent(httpClient, defaultDocUrl, "article");
15555
- return {
15556
- content: [
15557
- {
15558
- type: "text",
15559
- text: doc
15560
- }
15561
- ]
15562
- };
15563
- } catch (error) {
15564
- return {
15565
- isError: true,
15566
- content: [
15567
- {
15568
- type: "text",
15569
- text: `Error fetching the document: ${error.message}`
15570
- }
15571
- ]
15572
- };
15573
- }
15574
- });
15575
- }
15576
-
15577
15670
  // src/cli-tools/cli.ts
15578
15671
  import { z as z2 } from "zod";
15579
15672
 
@@ -16473,7 +16566,7 @@ var docsTools = activeTools.filter(
16473
16566
  );
16474
16567
  if (docsTools.length > 0) {
16475
16568
  logger.log("Adding docs tools:", docsTools);
16476
- addDocsTools(server, docsTools);
16569
+ addDocsTools(server, docsTools, activeTools.includes("GET_TO_KNOW_WIX"));
16477
16570
  }
16478
16571
  var isWixOne = parsedArgs["cli"] === "wix-one";
16479
16572
  var cliTools = activeTools.filter(
@@ -16483,10 +16576,6 @@ if (cliTools.length > 0) {
16483
16576
  logger.log("Adding cli tools:", cliTools, "isWixOne:", isWixOne);
16484
16577
  addCliTools(server, cliTools, isWixOne);
16485
16578
  }
16486
- if (activeTools.includes("GET_TO_KNOW_WIX")) {
16487
- const docUrl = parsedArgs["get-to-know-wix-url"];
16488
- await addGetToKnowTools(server, docUrl);
16489
- }
16490
16579
  try {
16491
16580
  const portals = parsedArgs["portals"]?.split(",") || [];
16492
16581
  if (portals.length > 0) {