@wix/mcp 1.0.81 → 1.0.83
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 +3 -1
- package/build/bin-standalone.js +847 -4
- package/build/cjs/index.cjs +900 -20
- package/build/cjs/toolkit.cjs +844 -4
- package/build/dts/bin.d.ts +1 -1
- package/build/dts/bin.js +13 -1
- package/build/dts/config/default-config.d.ts +1 -0
- package/build/dts/config/default-config.js +33 -2
- package/build/dts/config/param-descriptions.d.ts +21 -0
- package/build/dts/config/param-descriptions.js +21 -0
- package/build/dts/graphql/constants.d.ts +8 -0
- package/build/dts/graphql/constants.js +11 -0
- package/build/dts/graphql/index.d.ts +30 -0
- package/build/dts/graphql/index.js +259 -0
- package/build/dts/graphql/introspection.d.ts +106 -0
- package/build/dts/graphql/introspection.js +282 -0
- package/build/dts/graphql/search.d.ts +25 -0
- package/build/dts/graphql/search.js +277 -0
- package/build/dts/import-claude-design-tool/index.js +2 -2
- package/build/dts/index.d.ts +2 -1
- package/build/dts/index.js +3 -1
- package/build/dts/site-widget-tools/constants.d.ts +12 -5
- package/build/dts/site-widget-tools/constants.js +20 -11
- package/build/dts/site-widget-tools/site-builder-tool/index.js +1 -1
- package/build/dts/site-widget-tools/site-creation-tool/index.js +3 -2
- package/build/dts/site-widget-tools/suggested-domain-tool/index.js +25 -5
- package/build/dts/toolkit-entry.d.cts +12 -0
- package/build/dts/toolkit-entry.d.ts +12 -0
- package/build/dts/toolkit-entry.js +4 -0
- package/build/dts/toolkit.js +14 -0
- package/build/dts/wix-mcp-server.d.ts +2 -0
- package/build/dts/wix-mcp-server.js +5 -0
- package/build/esm/index.js +892 -20
- package/build/esm/toolkit.js +839 -4
- package/package.json +2 -2
|
@@ -23,14 +23,28 @@ export const SITE_CREATION_CUSTOM_ACTIONS_GUIDANCE = `2–3 specific, high-value
|
|
|
23
23
|
* General / Unspecified: "${SITE_CREATION_DEFAULT_ACTIONS}"
|
|
24
24
|
If none of these patterns fit the site, infer 2–3 actions that suit what that kind of business would manage on its site.`;
|
|
25
25
|
/**
|
|
26
|
-
* Builds the WixSiteCreation chooser reply. The message is fully composed here and wrapped in
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* Builds the WixSiteCreation chooser reply. The message is fully composed here and wrapped in a
|
|
27
|
+
* preamble that tells the host model to display the body verbatim (keeping the bullets and line
|
|
28
|
+
* breaks). The site type comes from `query`; the "Next up:" actions come from the inferred
|
|
29
|
+
* `customActions`.
|
|
30
|
+
*
|
|
31
|
+
* With `plain`, only the message itself is returned. Microsoft 365 Copilot's safety filter reads
|
|
32
|
+
* instructions inside a tool result ("you are the assistant…", "word for word…") as prompt
|
|
33
|
+
* injection and blocks the whole reply ("Sorry, it looks like I can't chat about this"); there the
|
|
34
|
+
* verbatim-reply instruction lives only in the tool description.
|
|
30
35
|
*/
|
|
31
|
-
export function buildSiteCreationSelectorMessage(siteType, customActions) {
|
|
36
|
+
export function buildSiteCreationSelectorMessage(siteType, customActions, { plain = false } = {}) {
|
|
32
37
|
const type = (siteType ?? '').trim() || 'new';
|
|
33
38
|
const actions = (customActions ?? '').trim() || SITE_CREATION_DEFAULT_ACTIONS;
|
|
39
|
+
const body = `Ready to set up your ${type} site? Choose your path in the widget above:
|
|
40
|
+
|
|
41
|
+
* **Build with AI** for a custom, tailor-made layout
|
|
42
|
+
* **Pick a template** to start with a pre-designed layout
|
|
43
|
+
|
|
44
|
+
**Next up:** Once your site is created, you can customize it in Wix or ask me to ${actions}—right here in the chat!`;
|
|
45
|
+
if (plain) {
|
|
46
|
+
return body;
|
|
47
|
+
}
|
|
34
48
|
return `You are the assistant replying to the user — say this message out loud in chat (do NOT stay silent, and do NOT just point at the widget). Your reply is only complete if it includes ALL of the following, word for word, each on its own line and in this order:
|
|
35
49
|
1. "Ready to set up your ${type} site? Choose your path in the widget above:" — keep the "Choose your path in the widget above:" part.
|
|
36
50
|
2. "* **Build with AI** for a custom, tailor-made layout"
|
|
@@ -39,12 +53,7 @@ export function buildSiteCreationSelectorMessage(siteType, customActions) {
|
|
|
39
53
|
|
|
40
54
|
Copy those four lines as written; do not summarize, shorten, reorder, or reword any of them. Here is the full message to send:
|
|
41
55
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* **Build with AI** for a custom, tailor-made layout
|
|
45
|
-
* **Pick a template** to start with a pre-designed layout
|
|
46
|
-
|
|
47
|
-
**Next up:** Once your site is created, you can customize it in Wix or ask me to ${actions}—right here in the chat!`;
|
|
56
|
+
${body}`;
|
|
48
57
|
}
|
|
49
58
|
/** OpenAI/ChatGPT widget MIME type for Skybridge rendering */
|
|
50
59
|
export const OPENAI_WIDGET_MIME_TYPE = 'text/html+skybridge';
|
|
@@ -67,7 +67,7 @@ export function addCreateSiteWidgetTool(server, authStrategy, options) {
|
|
|
67
67
|
suggestedSiteName: z
|
|
68
68
|
.string()
|
|
69
69
|
.optional()
|
|
70
|
-
.describe('
|
|
70
|
+
.describe('You must provide this on every call, including updates to an existing job, in English. A short name for the site: the business name the user gave, or one you derive from the site prompt.')
|
|
71
71
|
},
|
|
72
72
|
_meta: toolDefinitionMeta,
|
|
73
73
|
annotations: {
|
|
@@ -85,8 +85,9 @@ export function addWixSiteCreationTool(server, _authStrategy, options) {
|
|
|
85
85
|
// Reply instruction: a fixed SHAPE (question + the two options + a "Next up:" line) built
|
|
86
86
|
// from the query (site type) and the inferred customActions, with the two option lines left
|
|
87
87
|
// for the model to tailor to the industry. Returned as-is; the tool description also
|
|
88
|
-
// instructs the model to write it out (both are load-bearing).
|
|
89
|
-
|
|
88
|
+
// instructs the model to write it out (both are load-bearing). Microsoft Copilot gets the
|
|
89
|
+
// message without the preamble: its safety filter blocks the reply otherwise.
|
|
90
|
+
const message = buildSiteCreationSelectorMessage(args.query, args.customActions, { plain: server.isMicrosoftCopilotClient() });
|
|
90
91
|
return withJsonContent({
|
|
91
92
|
content: [
|
|
92
93
|
{
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { rethrowIfUnauthorized } from '../../auth/index.js';
|
|
2
2
|
import z from 'zod';
|
|
3
|
+
import dedent from 'dedent';
|
|
3
4
|
import { GET_SUGGESTED_DOMAINS_TOOL_NAME } from '../constants.js';
|
|
4
5
|
const WIX_APIS_BASE_URL = 'https://www.wixapis.com';
|
|
6
|
+
// Sites keep this placeholder until the owner renames them, and domain search
|
|
7
|
+
// rejects it as a blacklisted term.
|
|
8
|
+
const DEFAULT_SITE_NAME = /^my site(\s+\d+)?$/i;
|
|
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));
|
|
13
|
+
}
|
|
5
14
|
async function fetchSiteDisplayName(siteAuthorization, siteId) {
|
|
6
15
|
const response = await fetch(`${WIX_APIS_BASE_URL}/site-properties/v4/properties`, {
|
|
7
16
|
headers: {
|
|
@@ -19,7 +28,15 @@ export function addSuggestedDomainTool(server, authStrategy) {
|
|
|
19
28
|
const { getSiteAuthHeaders, isAnonymous } = authStrategy;
|
|
20
29
|
server.registerTool(GET_SUGGESTED_DOMAINS_TOOL_NAME, {
|
|
21
30
|
title: 'Get Suggested Domains',
|
|
22
|
-
description:
|
|
31
|
+
description: dedent `
|
|
32
|
+
Suggests available domain names for a business, brand, or Wix site.
|
|
33
|
+
|
|
34
|
+
Call this when the user asks for domain name ideas, wants to know which domains are available, or wants a domain for a new or existing site.
|
|
35
|
+
|
|
36
|
+
Provide either a free-text \`query\` (the user's own words, e.g. "pancakes business", "modern yoga studio") OR a \`siteId\` to base the suggestions on that site's name. At least one of them is required.
|
|
37
|
+
|
|
38
|
+
Present the returned domains to the user as a short list. This tool only suggests domains — it does not purchase or connect them.
|
|
39
|
+
`,
|
|
23
40
|
inputSchema: {
|
|
24
41
|
query: z
|
|
25
42
|
.string()
|
|
@@ -45,10 +62,11 @@ export function addSuggestedDomainTool(server, authStrategy) {
|
|
|
45
62
|
},
|
|
46
63
|
_meta: {
|
|
47
64
|
securitySchemes: [{ type: 'oauth2', scopes: ['offline_access'] }],
|
|
48
|
-
|
|
65
|
+
// Model-visible so hosts (e.g. Microsoft 365 Copilot) can call it directly and show it
|
|
66
|
+
// in their debug info; 'app' keeps it callable from the site-builder widget.
|
|
67
|
+
ui: { visibility: ['app', 'model'] },
|
|
49
68
|
'openai/toolInvocation/invoking': 'Fetching suggested domains',
|
|
50
|
-
'openai/toolInvocation/invoked': 'Suggested domains retrieved'
|
|
51
|
-
'openai/visibility': 'private'
|
|
69
|
+
'openai/toolInvocation/invoked': 'Suggested domains retrieved'
|
|
52
70
|
}
|
|
53
71
|
}, async (args, { panorama }) => {
|
|
54
72
|
console.log('[getSuggestedDomains] Invoked with args:', args);
|
|
@@ -90,7 +108,9 @@ export function addSuggestedDomainTool(server, authStrategy) {
|
|
|
90
108
|
structuredContent: { domains: [] }
|
|
91
109
|
};
|
|
92
110
|
}
|
|
93
|
-
resolvedQuery
|
|
111
|
+
if (isSearchableSiteName(siteName) || !resolvedQuery) {
|
|
112
|
+
resolvedQuery = siteName;
|
|
113
|
+
}
|
|
94
114
|
}
|
|
95
115
|
catch (error) {
|
|
96
116
|
panorama
|
|
@@ -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)
|
package/build/dts/toolkit.js
CHANGED
|
@@ -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
|
|
@@ -58,6 +58,8 @@ export declare class WixMcpServer extends McpServer {
|
|
|
58
58
|
setOpenAiMcpAppsEnabled(enabled: boolean): void;
|
|
59
59
|
setMcpAppsInMcpEnabled(enabled: boolean): void;
|
|
60
60
|
isMcpAppsInMcpEnabled(): boolean;
|
|
61
|
+
/** Microsoft 365 Copilot ("sydney" at runtime) or Copilot Cowork ("copilot"). */
|
|
62
|
+
isMicrosoftCopilotClient(): boolean;
|
|
61
63
|
shouldRenderMcpApps(): boolean;
|
|
62
64
|
getWidgetExtras(): WidgetExtras;
|
|
63
65
|
tool(name: string, cb: WixToolCallback): RegisteredTool;
|
|
@@ -60,6 +60,11 @@ export class WixMcpServer extends McpServer {
|
|
|
60
60
|
isMcpAppsInMcpEnabled() {
|
|
61
61
|
return this.mcpAppsInMcpEnabled;
|
|
62
62
|
}
|
|
63
|
+
/** Microsoft 365 Copilot ("sydney" at runtime) or Copilot Cowork ("copilot"). */
|
|
64
|
+
isMicrosoftCopilotClient() {
|
|
65
|
+
const clientName = this.getClientName?.()?.toLowerCase() ?? '';
|
|
66
|
+
return clientName.includes('sydney') || clientName.includes('copilot');
|
|
67
|
+
}
|
|
63
68
|
shouldRenderMcpApps() {
|
|
64
69
|
const clientName = this.getClientName?.()?.toLowerCase();
|
|
65
70
|
const isOpenAi = clientName?.includes('openai') ?? false;
|