@wix/mcp 1.0.4 → 1.0.6

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 (41) hide show
  1. package/bin.js +1 -1
  2. package/build/bin.d.ts +3 -3
  3. package/build/bin.js +657 -82
  4. package/build/chunk-YRLMZUQM.js +1834 -0
  5. package/build/index.d.ts +30 -6
  6. package/build/index.js +193 -6
  7. package/package.json +7 -4
  8. package/build/api-call/index.d.ts +0 -2
  9. package/build/api-call/index.js +0 -124
  10. package/build/cli-tools/cli.d.ts +0 -4
  11. package/build/cli-tools/cli.js +0 -337
  12. package/build/cli-tools/utils.d.ts +0 -2
  13. package/build/cli-tools/utils.js +0 -12
  14. package/build/docs/docs.d.ts +0 -4
  15. package/build/docs/docs.js +0 -448
  16. package/build/docs/long-content.d.ts +0 -1
  17. package/build/docs/long-content.js +0 -1
  18. package/build/docs/semanticSearch.d.ts +0 -10
  19. package/build/docs/semanticSearch.js +0 -108
  20. package/build/docs/semanticSearch.test.d.ts +0 -1
  21. package/build/docs/semanticSearch.test.js +0 -459
  22. package/build/interactive-command-tools/eventually.d.ts +0 -6
  23. package/build/interactive-command-tools/eventually.js +0 -15
  24. package/build/interactive-command-tools/handleStdout.d.ts +0 -13
  25. package/build/interactive-command-tools/handleStdout.js +0 -75
  26. package/build/interactive-command-tools/interactive-command-utils.d.ts +0 -7
  27. package/build/interactive-command-tools/interactive-command-utils.js +0 -75
  28. package/build/logger.d.ts +0 -10
  29. package/build/logger.js +0 -61
  30. package/build/resources/docs.d.ts +0 -2
  31. package/build/resources/docs.js +0 -45
  32. package/build/sentry.d.ts +0 -1
  33. package/build/sentry.js +0 -10
  34. package/build/support/index.d.ts +0 -2
  35. package/build/support/index.js +0 -32
  36. package/build/tool-utils.d.ts +0 -1
  37. package/build/tool-utils.js +0 -29
  38. package/build/tool-utils.spec.d.ts +0 -1
  39. package/build/tool-utils.spec.js +0 -119
  40. package/build/wix-mcp-server.d.ts +0 -13
  41. package/build/wix-mcp-server.js +0 -51
package/build/index.d.ts CHANGED
@@ -1,6 +1,30 @@
1
- export { WixMcpServer } from './wix-mcp-server.js';
2
- export { addDocsTools, DocsTool, VALID_DOCS_TOOLS } from './docs/docs.js';
3
- export { addApiCallTool } from './api-call/index.js';
4
- export { handleWixAPIResponse } from './tool-utils.js';
5
- export { addDocsResources } from './resources/docs.js';
6
- export { addSupportTool } from './support/index.js';
1
+ import { ZodRawShape, z, ZodTypeAny } from 'zod';
2
+ import { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
3
+ import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
4
+ import { PanoramaClientForComponent } from '@wix/panorama-client-node';
5
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
+
7
+ type WixRequestHandlerExtra = RequestHandlerExtra & {
8
+ panorama: PanoramaClientForComponent;
9
+ };
10
+ type WixToolCallback<Args extends undefined | ZodRawShape = undefined> = Args extends ZodRawShape ? (args: z.objectOutputType<Args, ZodTypeAny>, extra: WixRequestHandlerExtra) => CallToolResult | Promise<CallToolResult> : (extra: WixRequestHandlerExtra) => CallToolResult | Promise<CallToolResult>;
11
+ declare class WixMcpServer extends McpServer {
12
+ tool(name: string, cb: WixToolCallback): void;
13
+ tool(name: string, description: string, cb: WixToolCallback): void;
14
+ tool<Args extends ZodRawShape>(name: string, paramsSchema: Args, cb: WixToolCallback<Args>): void;
15
+ tool<Args extends ZodRawShape>(name: string, description: string, paramsSchema: Args, cb: WixToolCallback<Args>): void;
16
+ }
17
+
18
+ declare const VALID_DOCS_TOOLS: readonly ["WDS", "REST", "SDK", "BUILD_APPS", "WIX_HEADLESS", "BUSINESS_SOLUTIONS"];
19
+ type DocsTool = (typeof VALID_DOCS_TOOLS)[number];
20
+ declare const addDocsTools: (server: WixMcpServer, allowedTools?: DocsTool[]) => void;
21
+
22
+ declare function addApiCallTool(server: WixMcpServer, getSiteAccessToken: (siteId: string) => Promise<string>, getAccountAccessToken: () => Promise<string>): void;
23
+
24
+ declare const handleWixAPIResponse: <T = any>(response: Response) => Promise<T>;
25
+
26
+ declare const addDocsResources: (server: McpServer, portals: string[]) => Promise<void>;
27
+
28
+ declare function addSupportTool(server: WixMcpServer): void;
29
+
30
+ export { type DocsTool, VALID_DOCS_TOOLS, WixMcpServer, addApiCallTool, addDocsResources, addDocsTools, addSupportTool, handleWixAPIResponse };
package/build/index.js CHANGED
@@ -1,6 +1,193 @@
1
- export { WixMcpServer } from './wix-mcp-server.js';
2
- export { addDocsTools, VALID_DOCS_TOOLS } from './docs/docs.js';
3
- export { addApiCallTool } from './api-call/index.js';
4
- export { handleWixAPIResponse } from './tool-utils.js';
5
- export { addDocsResources } from './resources/docs.js';
6
- export { addSupportTool } from './support/index.js';
1
+ import {
2
+ VALID_DOCS_TOOLS,
3
+ WixMcpServer,
4
+ addDocsResources,
5
+ addDocsTools,
6
+ handleWixAPIResponse,
7
+ logger
8
+ } from "./chunk-YRLMZUQM.js";
9
+
10
+ // src/api-call/index.ts
11
+ import { z } from "zod";
12
+ function addApiCallTool(server, getSiteAccessToken, getAccountAccessToken) {
13
+ server.tool(
14
+ "CallWixSiteAPI",
15
+ [
16
+ "Call Wix apis on a business or site. Use this to create, read, update, and delete data and other Wix entities in your Wix site,",
17
+ `You should ALWAYS check the rest docs - "SearchWixRESTDocumentation" for the specific API you want to call, don't just call it without knowing what it does, CHECK THE DOCS`,
18
+ "Error Handling:",
19
+ 'If the error is related to missing installed app or "WDE0110: Wix Code not enabled", you should install the missing app by using ReadFullDocsArticle tool to fetch the article - https://dev.wix.com/docs/kb-only/MCP_REST_RECIPES_KB_ID/TRAIN_wix.devcenter.apps.installer.v1.AppsInstallerService.InstallApp',
20
+ "**Note:** there is no need to check if an app is installed/ Wix Code enabled in advance, just call the API and handle the error if it occurs, the API error message will state it clearly.",
21
+ "For any other error, use your default error handling mechanism"
22
+ ].join("\n"),
23
+ {
24
+ siteId: z.string().describe("The id of the site selected using site selection tool"),
25
+ url: z.string().describe(
26
+ "The url of the api to call - ALWAYS get the information from the Wix REST docs or from the conversation context, the URL MUST BE ABSOLUTE URL"
27
+ ),
28
+ method: z.string().describe(
29
+ "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)"
30
+ ),
31
+ body: z.string().optional().describe(
32
+ "A string representing of a valid JSON object to describe the body of the request"
33
+ )
34
+ },
35
+ async ({ url, body, method, siteId }) => {
36
+ logger.log(
37
+ `Calling Wix Site API: ${siteId} ${url}, body: ${JSON.stringify(body)}`
38
+ );
39
+ const authorization = await getSiteAccessToken(siteId);
40
+ try {
41
+ const response = await fetch(url, {
42
+ method,
43
+ headers: {
44
+ Authorization: authorization,
45
+ ...body ? { "Content-Type": "application/json" } : {}
46
+ },
47
+ body: method === "GET" ? void 0 : body
48
+ });
49
+ const responseData = await handleWixAPIResponse(response);
50
+ return {
51
+ content: [
52
+ {
53
+ type: "text",
54
+ text: `Wix Site API call successful: ${JSON.stringify(responseData)}`
55
+ }
56
+ ]
57
+ };
58
+ } catch (error) {
59
+ logger.error(`Failed to call Wix Site API: ${error}`);
60
+ throw new Error(`Failed to call Wix Site API: ${error}`);
61
+ }
62
+ }
63
+ );
64
+ server.tool(
65
+ "ListWixSites",
66
+ "List Wix sites for the current user",
67
+ async () => {
68
+ const sitesRes = await fetch(
69
+ "https://www.wixapis.com/site-list/v2/sites/query",
70
+ {
71
+ method: "POST",
72
+ headers: {
73
+ "Content-Type": "application/json",
74
+ Accept: "application/json, text/plain, */*",
75
+ Authorization: await getAccountAccessToken()
76
+ },
77
+ body: JSON.stringify({
78
+ query: {
79
+ cursorPaging: { limit: 50 }
80
+ }
81
+ })
82
+ }
83
+ );
84
+ const result = await sitesRes.json().then(
85
+ ({ sites }) => sites?.map(({ id, displayName }) => ({
86
+ id,
87
+ name: displayName
88
+ })) ?? []
89
+ );
90
+ return {
91
+ content: [
92
+ {
93
+ type: "text",
94
+ text: JSON.stringify(result)
95
+ },
96
+ {
97
+ type: "text",
98
+ text: "if there is more than one site returned, the user should pick one from a list, list the sites (only name) for the user and ask them to pick one"
99
+ }
100
+ ]
101
+ };
102
+ }
103
+ );
104
+ server.tool(
105
+ "ManageWixSite",
106
+ `Use account level API in order to create a site, update a site and publish site.
107
+ ALWAYS use "SearchWixRESTDocumentation" to search for the API you should invoke, NEVER GUESS THE SITE API URL
108
+ You should ALWAYS check the rest docs - "SearchWixRESTDocumentation" for the specific API you want to call, don't just call it without knowing what it does, CHECK THE DOCS`,
109
+ {
110
+ url: z.string().describe(
111
+ "The url of the api to call - ALWAYS get the information from the Wix REST docs DONT GUESS IT, the URL MUST BE ABSOLUTE URL"
112
+ ),
113
+ method: z.string().describe(
114
+ "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)"
115
+ ),
116
+ body: z.string().optional().describe(
117
+ "A string representing of a valid JSON object to describe the body of the request"
118
+ )
119
+ },
120
+ async ({ url, body, method }) => {
121
+ logger.log(
122
+ `Calling Wix Account level API: ${url}, body: ${JSON.stringify(body)}`
123
+ );
124
+ const authorization = await getAccountAccessToken();
125
+ try {
126
+ const response = await fetch(url, {
127
+ method,
128
+ headers: {
129
+ Authorization: authorization,
130
+ ...body ? { "Content-Type": "application/json" } : {}
131
+ },
132
+ body: method === "GET" ? void 0 : body
133
+ });
134
+ const responseData = await handleWixAPIResponse(response);
135
+ return {
136
+ content: [
137
+ {
138
+ type: "text",
139
+ text: `Wix Account API call successful: ${JSON.stringify(responseData)}`
140
+ }
141
+ ]
142
+ };
143
+ } catch (error) {
144
+ logger.error(`Failed to call Wix Account API: ${error}`);
145
+ throw new Error(`Failed to call Wix Account API: ${error}`);
146
+ }
147
+ }
148
+ );
149
+ }
150
+
151
+ // src/support/index.ts
152
+ import { z as z2 } from "zod";
153
+ function addSupportTool(server) {
154
+ server.tool(
155
+ "SupportAndFeedback",
156
+ [
157
+ "If the user would like to provide Wix with some feedback (good or bad), about the tools in Wix MCP,",
158
+ "for example they used the tools provided, and they reflected satisfaction or dissatisfaction with the tools.",
159
+ "Also, if you encounter too many errors tyring to call the Wix API, you can also suggest the user to provide feedback to Wix using this tool.",
160
+ "**IMPORTANT NOTE**",
161
+ "This tool is not sending the message, but formats it in order to another tool to actually send it"
162
+ ].join("\n"),
163
+ {
164
+ requestId: z2.string().optional().describe(
165
+ "request id if returned from the server in a failed API call to Wix"
166
+ ),
167
+ message: z2.string().describe("The message to send to Wix")
168
+ },
169
+ async ({ requestId, message }) => {
170
+ return {
171
+ content: [
172
+ {
173
+ type: "text",
174
+ text: `${message} ${requestId ? `request id: ${requestId}` : ""}`
175
+ },
176
+ {
177
+ type: "text",
178
+ text: "You should present the user with the formatted message above and ask if they would like to send it to Wix.If the user confirms, you can get the details about send feedback API from the article `https://dev.wix.com/docs/kb-only/MCP_REST_RECIPES_KB_ID/TRAIN_send_mcp_feedback_to_wix_from_user`.You can use the `ReadFullDocsArticle` tool to fetch the article and get the details about the API call.Once you have the details, you can use the `ManageWixSite` (if site id is in context) or `CallWixSiteAPI` (if site id is not in context) tool to call the API and send the feedback to Wix."
179
+ }
180
+ ]
181
+ };
182
+ }
183
+ );
184
+ }
185
+ export {
186
+ VALID_DOCS_TOOLS,
187
+ WixMcpServer,
188
+ addApiCallTool,
189
+ addDocsResources,
190
+ addDocsTools,
191
+ addSupportTool,
192
+ handleWixAPIResponse
193
+ };
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@wix/mcp",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "A Model Context Protocol server for Wix AI tools",
5
5
  "type": "module",
6
6
  "bin": "./bin.js",
7
7
  "files": [
8
- "build"
8
+ "build",
9
+ "README.md"
9
10
  ],
10
11
  "scripts": {
11
- "build": "tsc",
12
+ "build": "tsc --noEmit && tsup-node",
12
13
  "test": "vitest run",
13
14
  "test:watch": "vitest",
14
15
  "start": "npm run build && node ./build/bin.js",
@@ -35,11 +36,13 @@
35
36
  "@types/express": "^5.0.1",
36
37
  "@types/minimist": "^1.2.5",
37
38
  "@types/node": "^20.17.31",
39
+ "@wix/panorama-client-node": "^3.228.0",
38
40
  "eslint": "^9.25.1",
39
41
  "eslint-config-prettier": "^10.1.2",
40
42
  "eslint-plugin-prettier": "^5.2.6",
41
43
  "globals": "^16.0.0",
42
44
  "prettier": "^3.5.3",
45
+ "tsup": "^8.4.0",
43
46
  "typescript": "^5.8.3",
44
47
  "typescript-eslint": "^8.31.0",
45
48
  "vitest": "^3.1.2"
@@ -62,5 +65,5 @@
62
65
  ]
63
66
  }
64
67
  },
65
- "falconPackageHash": "4fdd1bedb002c7deddf1dd04c2810b00c9864cbed6168260ad3a32d0"
68
+ "falconPackageHash": "6bff51606aed52121711cca3ff10da3c1ba3bef77a9bc77809146d16"
66
69
  }
@@ -1,2 +0,0 @@
1
- import { WixMcpServer } from '../wix-mcp-server.js';
2
- export declare function addApiCallTool(server: WixMcpServer, getSiteAccessToken: (siteId: string) => Promise<string>, getAccountAccessToken: () => Promise<string>): void;
@@ -1,124 +0,0 @@
1
- import { z } from 'zod';
2
- import { logger } from '../logger.js';
3
- import { handleWixAPIResponse } from '../tool-utils.js';
4
- export function addApiCallTool(server, getSiteAccessToken, getAccountAccessToken) {
5
- server.tool('CallWixSiteAPI', [
6
- 'Call Wix apis on a business or site. Use this to create, read, update, and delete data and other Wix entities in your Wix site,',
7
- `You should ALWAYS check the rest docs - "SearchWixRESTDocumentation" for the specific API you want to call, don't just call it without knowing what it does, CHECK THE DOCS`,
8
- 'Error Handling:',
9
- 'If the error is related to missing installed app or "WDE0110: Wix Code not enabled", you should install the missing app by using ReadFullDocsArticle tool to fetch the article - https://dev.wix.com/docs/kb-only/MCP_REST_RECIPES_KB_ID/TRAIN_wix.devcenter.apps.installer.v1.AppsInstallerService.InstallApp',
10
- '**Note:** there is no need to check if an app is installed/ Wix Code enabled in advance, just call the API and handle the error if it occurs, the API error message will state it clearly.',
11
- 'For any other error, use your default error handling mechanism'
12
- ].join('\n'), {
13
- siteId: z
14
- .string()
15
- .describe('The id of the site selected using site selection tool'),
16
- url: z
17
- .string()
18
- .describe('The url of the api to call - ALWAYS get the information from the Wix REST docs or from the conversation context, the URL MUST BE ABSOLUTE URL'),
19
- method: z
20
- .string()
21
- .describe('The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)'),
22
- body: z
23
- .string()
24
- .optional()
25
- .describe('A string representing of a valid JSON object to describe the body of the request')
26
- }, async ({ url, body, method, siteId }) => {
27
- logger.log(`Calling Wix Site API: ${siteId} ${url}, body: ${JSON.stringify(body)}`);
28
- const authorization = await getSiteAccessToken(siteId);
29
- try {
30
- const response = await fetch(url, {
31
- method,
32
- headers: {
33
- Authorization: authorization,
34
- ...(body ? { 'Content-Type': 'application/json' } : {})
35
- },
36
- body: method === 'GET' ? undefined : body
37
- });
38
- const responseData = await handleWixAPIResponse(response);
39
- return {
40
- content: [
41
- {
42
- type: 'text',
43
- text: `Wix Site API call successful: ${JSON.stringify(responseData)}`
44
- }
45
- ]
46
- };
47
- }
48
- catch (error) {
49
- logger.error(`Failed to call Wix Site API: ${error}`);
50
- throw new Error(`Failed to call Wix Site API: ${error}`);
51
- }
52
- });
53
- server.tool('ListWixSites', 'List Wix sites for the current user', async () => {
54
- const sitesRes = await fetch('https://www.wixapis.com/site-list/v2/sites/query', {
55
- method: 'POST',
56
- headers: {
57
- 'Content-Type': 'application/json',
58
- Accept: 'application/json, text/plain, */*',
59
- Authorization: await getAccountAccessToken()
60
- },
61
- body: JSON.stringify({
62
- query: {
63
- cursorPaging: { limit: 50 }
64
- }
65
- })
66
- });
67
- const result = await sitesRes.json().then(({ sites }) => sites?.map(({ id, displayName }) => ({
68
- id,
69
- name: displayName
70
- })) ?? []);
71
- return {
72
- content: [
73
- {
74
- type: 'text',
75
- text: JSON.stringify(result)
76
- },
77
- {
78
- type: 'text',
79
- text: 'if there is more than one site returned, the user should pick one from a list, list the sites (only name) for the user and ask them to pick one'
80
- }
81
- ]
82
- };
83
- });
84
- server.tool('ManageWixSite', `Use account level API in order to create a site, update a site and publish site.
85
- ALWAYS use "SearchWixRESTDocumentation" to search for the API you should invoke, NEVER GUESS THE SITE API URL
86
- You should ALWAYS check the rest docs - "SearchWixRESTDocumentation" for the specific API you want to call, don't just call it without knowing what it does, CHECK THE DOCS`, {
87
- url: z
88
- .string()
89
- .describe('The url of the api to call - ALWAYS get the information from the Wix REST docs DONT GUESS IT, the URL MUST BE ABSOLUTE URL'),
90
- method: z
91
- .string()
92
- .describe('The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)'),
93
- body: z
94
- .string()
95
- .optional()
96
- .describe('A string representing of a valid JSON object to describe the body of the request')
97
- }, async ({ url, body, method }) => {
98
- logger.log(`Calling Wix Account level API: ${url}, body: ${JSON.stringify(body)}`);
99
- const authorization = await getAccountAccessToken();
100
- try {
101
- const response = await fetch(url, {
102
- method,
103
- headers: {
104
- Authorization: authorization,
105
- ...(body ? { 'Content-Type': 'application/json' } : {})
106
- },
107
- body: method === 'GET' ? undefined : body
108
- });
109
- const responseData = await handleWixAPIResponse(response);
110
- return {
111
- content: [
112
- {
113
- type: 'text',
114
- text: `Wix Account API call successful: ${JSON.stringify(responseData)}`
115
- }
116
- ]
117
- };
118
- }
119
- catch (error) {
120
- logger.error(`Failed to call Wix Account API: ${error}`);
121
- throw new Error(`Failed to call Wix Account API: ${error}`);
122
- }
123
- });
124
- }
@@ -1,4 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- export declare const VALID_CLI_TOOLS: readonly ["WIX_API", "CLI_COMMAND", "CLI_COMMAND_INTERACTIVE_MODE"];
3
- export type CLITool = (typeof VALID_CLI_TOOLS)[number];
4
- export declare function addCliTools(server: McpServer, allowedTools?: CLITool[], isWixOne?: boolean): void;