@wix/mcp 1.0.2 → 1.0.3

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.
@@ -2,8 +2,15 @@ import { z } from 'zod';
2
2
  import { logger } from '../logger.js';
3
3
  import { handleWixAPIResponse } from '../tool-utils.js';
4
4
  export function addApiCallTool(server, getSiteAccessToken, getAccountAccessToken) {
5
- server.tool('CallWixSiteAPI', '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,' +
6
- `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`, {
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, 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
+ 'If the error is related to error code "WDE0110: Wix Code not enabled." you should ask the user to do it in the editor',
11
+ '**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.',
12
+ 'For any other error, use your default error handling mechanism'
13
+ ].join('\n'), {
7
14
  siteId: z
8
15
  .string()
9
16
  .describe('The id of the site selected using site selection tool'),
@@ -18,7 +18,12 @@ export function addCliTools(server, allowedTools = [
18
18
  server.tool('CallWixAPI', 'Call Wix apis on an app. Use this to create, read, update, and delete data and other Wix entities in your Wix app.', {
19
19
  appPath: z
20
20
  .string()
21
- .describe('The dir path to the wix backoffice cli app to call the api on behalf of'), // should we have appPath or siteId here? (appPath encapsulates this more since we can get the siteId from the appPath then perform the call)
21
+ .describe('The dir path to the wix backoffice cli app to call the api on behalf of. should have {appPath}/.wix/app.config.json file with a siteId field. if passed, siteId is not required')
22
+ .optional(), // should we have appPath or siteId here? (appPath encapsulates this more since we can get the siteId from the appPath then perform the call)
23
+ siteId: z
24
+ .string()
25
+ .describe('The siteId of the wix backoffice cli app to call the api on behalf of. You can find the siteId in the {appPath}/.wix/app.config.json file. You can pass any other siteId if you want to call the api on behalf of a different site. If passed, appPath is not required. if not passed, the appPath must be provided.')
26
+ .optional(),
22
27
  url: z
23
28
  .string()
24
29
  .describe('The url of the api to call - usually you get this from the Wix REST docs or from the conversation context'),
@@ -29,11 +34,44 @@ export function addCliTools(server, allowedTools = [
29
34
  .string()
30
35
  .optional()
31
36
  .describe('A string representing of a valid JSON object to describe the body of the request')
32
- }, async ({ method, url, body, appPath }) => {
33
- logger.log(`Calling Wix API: ${appPath} ${method} ${url}, body: ${JSON.stringify(body)}`);
34
- const siteId = getSiteIdFromCliAppConfig(appPath);
35
- logger.log(`Site ID for Wix API call: ${siteId}`);
36
- const authorization = getCliAuthTokenForSiteId(siteId);
37
+ }, async ({ method, url, body, appPath, siteId }) => {
38
+ logger.log(`Calling Wix API: ${appPath} ${siteId} ${method} ${url}, body: ${JSON.stringify(body)}`);
39
+ if (!siteId && !appPath) {
40
+ return {
41
+ content: [
42
+ {
43
+ type: 'text',
44
+ text: 'Either appPath or siteId must be provided'
45
+ }
46
+ ]
47
+ };
48
+ }
49
+ let siteIdToUse = siteId;
50
+ if (!siteIdToUse && appPath) {
51
+ siteIdToUse = getSiteIdFromCliAppConfig(appPath);
52
+ }
53
+ if (!siteIdToUse) {
54
+ return {
55
+ content: [
56
+ {
57
+ type: 'text',
58
+ text: 'Either appPath or siteId must be provided'
59
+ }
60
+ ]
61
+ };
62
+ }
63
+ logger.log(`Site ID for Wix API call: ${siteIdToUse}`);
64
+ const authorization = getCliAuthTokenForSiteId(siteIdToUse);
65
+ if (!authorization) {
66
+ return {
67
+ content: [
68
+ {
69
+ type: 'text',
70
+ text: 'Failed to get authorization token. Please check your siteId and appPath'
71
+ }
72
+ ]
73
+ };
74
+ }
37
75
  try {
38
76
  const response = await fetch(url, {
39
77
  method,
@@ -184,7 +222,7 @@ export function addCliTools(server, allowedTools = [
184
222
  DO NOT USE THIS TOOL FOR ANY OTHER PURPOSE. IT IS ONLY FOR WIX CLI COMMANDS.`, {
185
223
  appPath: z
186
224
  .string()
187
- .describe('The full path to the Wix CLI app to run the command on'),
225
+ .describe('The full path to the Wix CLI app to run the command on.'),
188
226
  extensionType: z
189
227
  .enum([
190
228
  'dashboard-page',
@@ -135,8 +135,10 @@ export const addDocsTools = (server, allowedTools = [
135
135
  'It excels at guiding the creation of features like booking systems with payments.',
136
136
  'For example, it can guide the setup of a service in Wix Bookings where customers can pay using Wix Payments, such as creating a bookable yoga class',
137
137
  'It searches the Wix Business Solutions documentation for these integrated workflows involving services, bookings, payments, stores, blogs, and more.',
138
- 'Before attempting to implement a multi step API calls on Wix, YOU MUST TRY THIS TOOL FIRST.',
139
- 'If the result includes a link to another article, use ReadFullDocsArticle tool to fetch the full article.'
138
+ 'This tool returns a list of articles that are potentially relevant to the input search term.',
139
+ '**IMPORTANT NOTES:**',
140
+ '1. Before attempting to implement a multi step API calls on Wix, YOU MUST TRY THIS TOOL FIRST.',
141
+ '2. Out of the returned list of articles that you will receive, you MUST select the most relevant one and use the ReadFullDocsArticle tool to fetch it.'
140
142
  ].join('\n'), {
141
143
  searchTerm: z
142
144
  .string()
@@ -164,6 +166,10 @@ export const addDocsTools = (server, allowedTools = [
164
166
  {
165
167
  type: 'text',
166
168
  text: result
169
+ },
170
+ {
171
+ type: 'text',
172
+ text: `Out of the included list of articles, you **MUST** select the one that is most relevant to the user's request and use the ReadFullDocsArticle tool to fetch it.`
167
173
  }
168
174
  ]
169
175
  };
package/build/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export { addDocsTools, DocsTool, VALID_DOCS_TOOLS } from './docs/docs.js';
3
3
  export { addApiCallTool } from './api-call/index.js';
4
4
  export { handleWixAPIResponse } from './tool-utils.js';
5
5
  export { addDocsResources } from './resources/docs.js';
6
+ export { addSupportTool } from './support/index.js';
package/build/index.js CHANGED
@@ -3,3 +3,4 @@ export { addDocsTools, VALID_DOCS_TOOLS } from './docs/docs.js';
3
3
  export { addApiCallTool } from './api-call/index.js';
4
4
  export { handleWixAPIResponse } from './tool-utils.js';
5
5
  export { addDocsResources } from './resources/docs.js';
6
+ export { addSupportTool } from './support/index.js';
@@ -0,0 +1,2 @@
1
+ import { WixMcpServer } from '../wix-mcp-server.js';
2
+ export declare function addSupportTool(server: WixMcpServer): void;
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ export function addSupportTool(server) {
3
+ server.tool('SupportAndFeedback', [
4
+ 'If the user would like to provide Wix with some feedback (good or bad), about the tools in Wix MCP,',
5
+ 'for example they used the tools provided, and they reflected satisfaction or dissatisfaction with the tools.',
6
+ '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.',
7
+ 'You should let the user know that they can provide feedback to Wix using [Devs on Wix Discord community](https://discord.gg/GhdmDN926z). and suggest them to format the message using this tool',
8
+ '**IMPORTANT NOTES**',
9
+ '1. This tool is not sending the message formats it for users to use in discord',
10
+ '2. Mention in the provided message that it is related to Wix MCP and the tools provided'
11
+ ].join('\n'), {
12
+ requestId: z
13
+ .string()
14
+ .optional()
15
+ .describe('request id if returned from the server in a failed API call to Wix'),
16
+ message: z.string().describe('The message to send to Wix over discord')
17
+ }, async ({ requestId, message }) => {
18
+ return {
19
+ content: [
20
+ {
21
+ type: 'text',
22
+ text: `${message} ${requestId ? `request id: ${requestId}` : ''}`
23
+ },
24
+ {
25
+ type: 'text',
26
+ text: 'You should present the user with the formatted message above and ask them to send it over discord to Wix - [Devs on Wix Discord community](https://discord.gg/GhdmDN926z), if you have another tool to send it over discord, you can use it to send the message directly'
27
+ }
28
+ ]
29
+ };
30
+ });
31
+ }
@@ -18,7 +18,7 @@ export const handleWixAPIResponse = async (response) => {
18
18
  `Failed to call Wix API: ${response.status} ${response.statusText}.`,
19
19
  requestId ? `request id: ${requestId}` : '',
20
20
  // Wix 404 for API does not exist is huge (generic 404 page) and loaded to the context
21
- response.status === 404 && errorDetails.includes('<html>')
21
+ response.status === 404 && errorDetails.includes('<html')
22
22
  ? 'Not found'
23
23
  : errorDetails
24
24
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A Model Context Protocol server for Wix AI tools",
5
5
  "type": "module",
6
6
  "bin": "./bin.js",
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@modelcontextprotocol/sdk": "^1.9.0",
25
25
  "@sentry/node": "^9.13.0",
26
- "@wix/panorama-client-node": "^3.227.0",
26
+ "@wix/panorama-client-node": "^3.228.0",
27
27
  "execa": "^9.5.2",
28
28
  "minimist": "^1.2.8",
29
29
  "strip-ansi": "^7.1.0",
@@ -63,5 +63,5 @@
63
63
  ]
64
64
  }
65
65
  },
66
- "falconPackageHash": "bebb972f9d803a633e2609035dfd5fc65e5498fe3690a8393291520b"
66
+ "falconPackageHash": "b6e838772abadece4f3efd3c6c47cb26389c06c162e4d629e98eca81"
67
67
  }