@wix/mcp 1.0.1 → 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.
- package/README.md +3 -0
- package/build/api-call/index.js +11 -3
- package/build/bin.js +3 -2
- package/build/cli-tools/cli.d.ts +1 -1
- package/build/cli-tools/cli.js +50 -9
- package/build/docs/docs.js +15 -6
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/support/index.d.ts +2 -0
- package/build/support/index.js +31 -0
- package/build/tool-utils.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -29,6 +29,9 @@ args: ["/Users/absolute/path/to/build/bin.js"]
|
|
|
29
29
|
### enable experimental tools:
|
|
30
30
|
`--experimental=WIX_API,CLI_COMMAND` - enable specific experimental tools (disabled by default)
|
|
31
31
|
|
|
32
|
+
### choose a CLI mode:
|
|
33
|
+
`--cli=wix-one` - specifies to use Wix One CLI mode (if not specified, default CLI mode is used)
|
|
34
|
+
|
|
32
35
|
### choose a logger:
|
|
33
36
|
`--logger=mcp` - log to MCP server (default)
|
|
34
37
|
`--logger=file` - log to file (in `~/wix-mcp-log.txt`)
|
package/build/api-call/index.js
CHANGED
|
@@ -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',
|
|
6
|
-
|
|
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'),
|
|
@@ -76,7 +83,8 @@ export function addApiCallTool(server, getSiteAccessToken, getAccountAccessToken
|
|
|
76
83
|
};
|
|
77
84
|
});
|
|
78
85
|
server.tool('ManageWixSite', `Use account level API in order to create a site, update a site and publish site.
|
|
79
|
-
ALWAYS use "SearchWixRESTDocumentation" to search for the API you should invoke, NEVER GUESS THE SITE API URL
|
|
86
|
+
ALWAYS use "SearchWixRESTDocumentation" to search for the API you should invoke, NEVER GUESS THE SITE API URL
|
|
87
|
+
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`, {
|
|
80
88
|
url: z
|
|
81
89
|
.string()
|
|
82
90
|
.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'),
|
package/build/bin.js
CHANGED
|
@@ -71,10 +71,11 @@ if (docsTools.length > 0) {
|
|
|
71
71
|
logger.log('Adding docs tools:', docsTools);
|
|
72
72
|
addDocsTools(server, docsTools);
|
|
73
73
|
}
|
|
74
|
+
const isWixOne = parsedArgs['cli'] === 'wix-one';
|
|
74
75
|
const cliTools = activeTools.filter((tool) => VALID_CLI_TOOLS.includes(tool));
|
|
75
76
|
if (cliTools.length > 0) {
|
|
76
|
-
logger.log('Adding cli tools:', cliTools);
|
|
77
|
-
addCliTools(server, cliTools);
|
|
77
|
+
logger.log('Adding cli tools:', cliTools, 'isWixOne:', isWixOne);
|
|
78
|
+
addCliTools(server, cliTools, isWixOne);
|
|
78
79
|
}
|
|
79
80
|
try {
|
|
80
81
|
const portals = parsedArgs['portals']?.split(',') || [];
|
package/build/cli-tools/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
export declare const VALID_CLI_TOOLS: readonly ["WIX_API", "CLI_COMMAND", "CLI_COMMAND_INTERACTIVE_MODE"];
|
|
3
3
|
export type CLITool = (typeof VALID_CLI_TOOLS)[number];
|
|
4
|
-
export declare function addCliTools(server: McpServer, allowedTools?: CLITool[]): void;
|
|
4
|
+
export declare function addCliTools(server: McpServer, allowedTools?: CLITool[], isWixOne?: boolean): void;
|
package/build/cli-tools/cli.js
CHANGED
|
@@ -13,12 +13,17 @@ export function addCliTools(server, allowedTools = [
|
|
|
13
13
|
'WIX_API',
|
|
14
14
|
'CLI_COMMAND',
|
|
15
15
|
'CLI_COMMAND_INTERACTIVE_MODE'
|
|
16
|
-
]) {
|
|
16
|
+
], isWixOne = false) {
|
|
17
17
|
if (allowedTools.includes('WIX_API')) {
|
|
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
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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',
|
|
@@ -240,7 +278,7 @@ export function addCliTools(server, allowedTools = [
|
|
|
240
278
|
// Format generate command with proper arguments
|
|
241
279
|
commandName = 'npx';
|
|
242
280
|
commandArgs = [
|
|
243
|
-
'wix',
|
|
281
|
+
isWixOne ? 'wix-one' : 'wix',
|
|
244
282
|
'app',
|
|
245
283
|
'generate',
|
|
246
284
|
'-t',
|
|
@@ -255,6 +293,9 @@ export function addCliTools(server, allowedTools = [
|
|
|
255
293
|
commandName = commandParts[0];
|
|
256
294
|
commandArgs = commandParts.slice(1);
|
|
257
295
|
}
|
|
296
|
+
if (isWixOne && commandName === 'wix') {
|
|
297
|
+
commandName = 'wix-one';
|
|
298
|
+
}
|
|
258
299
|
try {
|
|
259
300
|
logger.log(`Executing Wix CLI command: ${commandName} ${commandArgs.join(' ')}`);
|
|
260
301
|
// Execute with timeout
|
package/build/docs/docs.js
CHANGED
|
@@ -130,11 +130,15 @@ export const addDocsTools = (server, allowedTools = [
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
if (allowedTools.includes('BUSINESS_SOLUTIONS')) {
|
|
133
|
-
server.tool('
|
|
134
|
-
'
|
|
135
|
-
'
|
|
136
|
-
'For example,
|
|
137
|
-
'
|
|
133
|
+
server.tool('WixBusinessFlowsDocumentation', [
|
|
134
|
+
'This tool provides step-by-step recipes for setting up complex Wix business solutions that involve multiple API calls.',
|
|
135
|
+
'It excels at guiding the creation of features like booking systems with payments.',
|
|
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
|
+
'It searches the Wix Business Solutions documentation for these integrated workflows involving services, bookings, payments, stores, blogs, and more.',
|
|
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.'
|
|
138
142
|
].join('\n'), {
|
|
139
143
|
searchTerm: z
|
|
140
144
|
.string()
|
|
@@ -152,7 +156,8 @@ export const addDocsTools = (server, allowedTools = [
|
|
|
152
156
|
const result = await runSemanticSearchAndFormat({
|
|
153
157
|
toolName: 'BUSINESS_SOLUTIONS',
|
|
154
158
|
toolParams: {
|
|
155
|
-
searchTerm: '
|
|
159
|
+
searchTerm: '**RECIPE**: Business Recipes - full setup flow for::: ' +
|
|
160
|
+
searchTerm
|
|
156
161
|
},
|
|
157
162
|
maxResults: Math.max(1, Math.min(maxResults ?? 5, 15))
|
|
158
163
|
});
|
|
@@ -161,6 +166,10 @@ export const addDocsTools = (server, allowedTools = [
|
|
|
161
166
|
{
|
|
162
167
|
type: 'text',
|
|
163
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.`
|
|
164
173
|
}
|
|
165
174
|
]
|
|
166
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,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
|
+
}
|
package/build/tool-utils.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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": "
|
|
66
|
+
"falconPackageHash": "b6e838772abadece4f3efd3c6c47cb26389c06c162e4d629e98eca81"
|
|
67
67
|
}
|