@wix/mcp 1.0.82 → 1.0.84

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.
@@ -6,9 +6,13 @@ const WIX_APIS_BASE_URL = 'https://www.wixapis.com';
6
6
  // Sites keep this placeholder until the owner renames them, and domain search
7
7
  // rejects it as a blacklisted term.
8
8
  const DEFAULT_SITE_NAME = /^my site(\s+\d+)?$/i;
9
- function isDefaultSiteName(siteName) {
10
- return DEFAULT_SITE_NAME.test(siteName.trim());
9
+ // Domains are Latin, so the caller's query beats a site name in another script.
10
+ const NON_LATIN_LETTER = /(?![\p{Script=Latin}])\p{L}/u;
11
+ function isSearchableSiteName(siteName) {
12
+ return (!DEFAULT_SITE_NAME.test(siteName.trim()) && !NON_LATIN_LETTER.test(siteName));
11
13
  }
14
+ // Domain search rejects longer queries.
15
+ const MAX_QUERY_LENGTH = 100;
12
16
  async function fetchSiteDisplayName(siteAuthorization, siteId) {
13
17
  const response = await fetch(`${WIX_APIS_BASE_URL}/site-properties/v4/properties`, {
14
18
  headers: {
@@ -39,7 +43,7 @@ export function addSuggestedDomainTool(server, authStrategy) {
39
43
  query: z
40
44
  .string()
41
45
  .optional()
42
- .describe("Free-text keywords, business idea, or brand concept to base suggestions on. Use the user's own words."),
46
+ .describe("A few keywords, a business idea, or a brand name to base suggestions on, up to 100 characters. Use the user's own words."),
43
47
  siteId: z
44
48
  .string()
45
49
  .optional()
@@ -47,7 +51,7 @@ export function addSuggestedDomainTool(server, authStrategy) {
47
51
  tlds: z
48
52
  .array(z.string())
49
53
  .optional()
50
- .describe('Filter by specific TLDs (e.g. ["com", "net"]). Do not include the dot.'),
54
+ .describe('Optional. Include only when the user asks for specific TLDs. Filter by specific TLDs (e.g. ["com", "net"]). Do not include the dot.'),
51
55
  limit: z
52
56
  .number()
53
57
  .optional()
@@ -106,7 +110,7 @@ export function addSuggestedDomainTool(server, authStrategy) {
106
110
  structuredContent: { domains: [] }
107
111
  };
108
112
  }
109
- if (!isDefaultSiteName(siteName) || !resolvedQuery) {
113
+ if (isSearchableSiteName(siteName) || !resolvedQuery) {
110
114
  resolvedQuery = siteName;
111
115
  }
112
116
  }
@@ -126,7 +130,9 @@ export function addSuggestedDomainTool(server, authStrategy) {
126
130
  }
127
131
  }
128
132
  }
129
- const params = new URLSearchParams({ query: resolvedQuery });
133
+ const params = new URLSearchParams({
134
+ query: resolvedQuery.slice(0, MAX_QUERY_LENGTH)
135
+ });
130
136
  if (limit) {
131
137
  params.set('paging.limit', String(limit));
132
138
  }
@@ -135,14 +141,21 @@ export function addSuggestedDomainTool(server, authStrategy) {
135
141
  params.append('tlds', tld);
136
142
  }
137
143
  }
138
- const response = await fetch(`${WIX_APIS_BASE_URL}/domain-search/v2/suggest-domains?${params}`, {
144
+ const suggestDomains = () => fetch(`${WIX_APIS_BASE_URL}/domain-search/v2/suggest-domains?${params}`, {
139
145
  method: 'GET',
140
146
  headers: {
141
147
  Accept: 'application/json'
142
148
  }
143
149
  });
150
+ let response = await suggestDomains();
151
+ let errorText = response.ok ? '' : await response.text();
152
+ // Domain search sells only some TLDs and rejects the whole request for one it doesn't.
153
+ if (errorText.includes('TLD_NOT_SUPPORTED') && params.has('tlds')) {
154
+ params.delete('tlds');
155
+ response = await suggestDomains();
156
+ errorText = response.ok ? '' : await response.text();
157
+ }
144
158
  if (!response.ok) {
145
- const errorText = await response.text();
146
159
  throw new Error(`Domain suggestions API returned ${response.status}: ${errorText}`);
147
160
  }
148
161
  const data = (await response.json());
@@ -314,6 +314,17 @@ export interface CodeValidationResult {
314
314
  error?: string;
315
315
  }
316
316
  export declare function validateExecuteCode(code: string): CodeValidationResult;
317
+ /** Wix "Auto GraphQL": one schema generated over all Wix public APIs. */
318
+ export declare const WIX_GRAPHQL_ENDPOINT = "https://www.wixapis.com/graphql/alpha";
319
+ export declare const SEARCH_GRAPHQL_TOOL_NAME = "SearchWixGraphQLOperations";
320
+ export declare const INSPECT_GRAPHQL_TOOL_NAME = "InspectWixGraphQLSchema";
321
+ export declare const EXECUTE_GRAPHQL_TOOL_NAME = "ExecuteWixGraphQL";
322
+ export declare const GRAPHQL_TOOL_NAMES: readonly [
323
+ "SearchWixGraphQLOperations",
324
+ "InspectWixGraphQLSchema",
325
+ "ExecuteWixGraphQL"
326
+ ];
327
+ export type GraphqlToolName = (typeof GRAPHQL_TOOL_NAMES)[number];
317
328
  /** URL for the management recipes index article */
318
329
  export declare const RECIPES_INDEX_URL = "https://dev.wix.com/docs/api-reference/articles/ai-tools/wix-mcp/skills/wix-management-recipes-index";
319
330
  /**
@@ -379,6 +390,7 @@ export interface ModeDefaultConfig {
379
390
  partnerContextEnabled?: boolean;
380
391
  usePlatformizedSearch?: boolean;
381
392
  skillsPrOverrideEnabled?: boolean;
393
+ graphqlEnabled?: boolean;
382
394
  }
383
395
  export declare const SYSTEM_REMINDER_GUIDELINES: string;
384
396
  export declare const SYSTEM_REMINDER: string;
@@ -314,6 +314,17 @@ export interface CodeValidationResult {
314
314
  error?: string;
315
315
  }
316
316
  export declare function validateExecuteCode(code: string): CodeValidationResult;
317
+ /** Wix "Auto GraphQL": one schema generated over all Wix public APIs. */
318
+ export declare const WIX_GRAPHQL_ENDPOINT = "https://www.wixapis.com/graphql/alpha";
319
+ export declare const SEARCH_GRAPHQL_TOOL_NAME = "SearchWixGraphQLOperations";
320
+ export declare const INSPECT_GRAPHQL_TOOL_NAME = "InspectWixGraphQLSchema";
321
+ export declare const EXECUTE_GRAPHQL_TOOL_NAME = "ExecuteWixGraphQL";
322
+ export declare const GRAPHQL_TOOL_NAMES: readonly [
323
+ "SearchWixGraphQLOperations",
324
+ "InspectWixGraphQLSchema",
325
+ "ExecuteWixGraphQL"
326
+ ];
327
+ export type GraphqlToolName = (typeof GRAPHQL_TOOL_NAMES)[number];
317
328
  /** URL for the management recipes index article */
318
329
  export declare const RECIPES_INDEX_URL = "https://dev.wix.com/docs/api-reference/articles/ai-tools/wix-mcp/skills/wix-management-recipes-index";
319
330
  /**
@@ -379,6 +390,7 @@ export interface ModeDefaultConfig {
379
390
  partnerContextEnabled?: boolean;
380
391
  usePlatformizedSearch?: boolean;
381
392
  skillsPrOverrideEnabled?: boolean;
393
+ graphqlEnabled?: boolean;
382
394
  }
383
395
  export declare const SYSTEM_REMINDER_GUIDELINES: string;
384
396
  export declare const SYSTEM_REMINDER: string;
@@ -16,6 +16,10 @@ export { WixFetchError } from './wix-fetch-error.js';
16
16
  export { attachConsoleLogger } from './infra/logger.js';
17
17
  // Code-mode validation (pre-flight the same check the runtime applies)
18
18
  export { validateExecuteCode, EXECUTE_FUNCTION_EXPRESSION_HINT } from './code-mode/validation.js';
19
+ // GraphQL tool names/constants (register the tools via createWixToolkit's
20
+ // api.tools / api.enableTools; addGraphqlTools itself stays on the main entry
21
+ // because its WixMcpServer parameter would pull the SDK types into this bundle)
22
+ export { GRAPHQL_TOOL_NAMES, SEARCH_GRAPHQL_TOOL_NAME, INSPECT_GRAPHQL_TOOL_NAME, EXECUTE_GRAPHQL_TOOL_NAME, WIX_GRAPHQL_ENDPOINT } from './graphql/index.js';
19
23
  // Docs fetch utilities
20
24
  export { fetchRecipesIndex, fetchArticle, RECIPES_INDEX_URL } from './docs/fetch-article.js';
21
25
  // Config (the widget-related config exports stay on the main entry)
@@ -32,6 +32,7 @@ import { v4 as uuidv4 } from 'uuid';
32
32
  import { HttpClient } from '@wix/http-client';
33
33
  import { addDocsTools } from './docs/docs.js';
34
34
  import { addApiCallTool } from './api-call/index.js';
35
+ import { addGraphqlTools, GRAPHQL_TOOL_NAMES } from './graphql/index.js';
35
36
  import { addExecuteCodeModeTool, addSearchCodeModeTool } from './code-mode/index.js';
36
37
  import { defaultReadmeDocs, executeCodeModeToolDescriptions, buildToolDescriptions } from './config/default-config.js';
37
38
  import { getDynamicContext } from './docs/get-to-know.js';
@@ -224,6 +225,19 @@ export function createWixToolkit(options) {
224
225
  maxResponseSize
225
226
  });
226
227
  }
228
+ // GraphQL tools register only the ones requested (each is opt-in by name).
229
+ const requestedGraphqlTools = GRAPHQL_TOOL_NAMES.filter((name) => requestedTools.has(name));
230
+ if (requestedGraphqlTools.length > 0) {
231
+ addGraphqlTools(server, {
232
+ authStrategy,
233
+ disableTools: [
234
+ ...(disableTools ?? []),
235
+ ...GRAPHQL_TOOL_NAMES.filter((n) => !requestedTools.has(n))
236
+ ],
237
+ toolDescriptions: effectiveToolDescriptions,
238
+ maxResponseSize
239
+ });
240
+ }
227
241
  }
228
242
  else {
229
243
  // Default: register all API tools
@@ -3,6 +3,8 @@ import { WixMcpServer } from '../wix-mcp-server.js';
3
3
  export interface WixelSessionToolOptions {
4
4
  conductorOverride?: string;
5
5
  supportsWidgets?: () => boolean;
6
+ /** Shared by the session tools of one server; created by addWixelSessionTools. */
7
+ liveCards?: LiveCardRegistry;
6
8
  }
7
9
  type WixelAssetEntity = {
8
10
  id?: string;
@@ -30,11 +32,52 @@ export type WixelDeck = {
30
32
  };
31
33
  export declare function collectDecks(projectAssets: WixelAssetEntity[], deckIds: Set<string>): Map<string, WixelDeck>;
32
34
  export declare function extractAssetIds(text: string): string[];
35
+ /**
36
+ * Live result cards, per Wixel session handle: the turns a card was rendered
37
+ * for (and when), the asset ids / media URLs those cards display, and the
38
+ * last turn send_wixel_message opened. The model does not reliably obey "do
39
+ * not poll" once a live card is up, so the tools enforce it: list_wixel_events
40
+ * refuses while a card is active, get_wixel_asset_result refuses to render
41
+ * the same result a second time, and get_wixel_pending_question stays quiet
42
+ * for a question the card already shows.
43
+ *
44
+ * One registry per server instance (like list_wixel_events' cursor memory),
45
+ * so sessions never see each other's records. In-memory like that memory
46
+ * too: a Durable Object wake-up starts empty, and the intercepts simply
47
+ * don't apply until the next send.
48
+ */
49
+ type LiveCardRecord = {
50
+ /** Turn id → when its live card was rendered. */
51
+ turns: Map<string, number>;
52
+ /** Turns whose card reached done/failed — the agent may poll again. */
53
+ finishedTurns: Set<string>;
54
+ shownAssets: Set<string>;
55
+ lastSentTurn: string | null;
56
+ };
57
+ export type LiveCardRegistry = ReturnType<typeof createLiveCardRegistry>;
58
+ export declare function createLiveCardRegistry(): {
59
+ get: (handle: string) => LiveCardRecord | undefined;
60
+ forHandle: (handle: string) => LiveCardRecord;
61
+ isActive: (handle: string, params: {
62
+ authHeaders: Record<string, string>;
63
+ conductorOverride?: string;
64
+ metaSiteId: string;
65
+ }) => Promise<boolean>;
66
+ };
33
67
  export declare function addGetWixelPendingQuestionTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
34
68
  export declare function addStartWixelSessionTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
35
69
  export declare function addSendWixelMessageTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
36
70
  export declare function addListWixelEventsTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
37
71
  export declare function addGetWixelStylePresetsTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
72
+ export type WixelTurnStatus = 'generating' | 'question' | 'done' | 'failed';
73
+ export declare function addGetWixelTurnResultTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
74
+ export type WixelResultAssetEntry = {
75
+ id: string;
76
+ kind: 'image' | 'video' | 'slides' | 'document';
77
+ name: string | null;
78
+ url: string;
79
+ slideUrls?: string[];
80
+ };
38
81
  export declare function addGetWixelAssetResultTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
39
82
  export declare function addWixelSessionTools(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
40
83
  export {};