@wix/mcp 1.0.4 → 1.0.5
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/build/cli-tools/cli.js +1 -0
- package/build/cli-tools/utils.js +16 -3
- package/package.json +2 -2
package/build/cli-tools/cli.js
CHANGED
package/build/cli-tools/utils.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
2
|
import { homedir } from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
export function getCliAuthTokenForSiteId(siteIdOrAccountsFileName) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
// check if the api-key.json file exists:
|
|
6
|
+
const apiKeyFileName = path.join(homedir(), `.wix/auth/api-key.json`);
|
|
7
|
+
const apiKeyFileExists = existsSync(apiKeyFileName);
|
|
8
|
+
if (apiKeyFileExists) {
|
|
9
|
+
const apiKeyData = JSON.parse(readFileSync(apiKeyFileName, 'utf8'));
|
|
10
|
+
return (apiKeyData.token || apiKeyData.accessToken);
|
|
11
|
+
}
|
|
12
|
+
const siteTokenFileName = path.join(homedir(), `.wix/auth/${siteIdOrAccountsFileName}.json`);
|
|
13
|
+
// check if the site token file exists:
|
|
14
|
+
const siteTokenFileExists = existsSync(siteTokenFileName);
|
|
15
|
+
if (siteTokenFileExists) {
|
|
16
|
+
const authData = JSON.parse(readFileSync(siteTokenFileName, 'utf8'));
|
|
17
|
+
return (authData.accessToken || authData.token);
|
|
18
|
+
}
|
|
19
|
+
throw new Error('No site token or api key found. You need to authenticate with Wix CLI first.');
|
|
7
20
|
}
|
|
8
21
|
// f"first get the site id - its in the `{backoffice_app_dir}/.wix/app.config.json` file, it has a json object with a siteId field",
|
|
9
22
|
export function getSiteIdFromCliAppConfig(appPath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "A Model Context Protocol server for Wix AI tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./bin.js",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
]
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
"falconPackageHash": "
|
|
65
|
+
"falconPackageHash": "2b9b8f55614d88448109d86ff590f94348739875ce6b9769eeca1339"
|
|
66
66
|
}
|