kiviui-mcp 1.0.8 → 1.0.10
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/dist/install.js +9 -1
- package/package.json +1 -1
package/dist/install.js
CHANGED
|
@@ -8,7 +8,7 @@ const isMac = os.platform() === "darwin";
|
|
|
8
8
|
// npx -y kiviui-mcp
|
|
9
9
|
const MCP_SERVER_COMMAND = "npx";
|
|
10
10
|
const MCP_SERVER_ARGS = ["-y", "kiviui-mcp"];
|
|
11
|
-
async function updateJsonConfig(configPath, serverName, command, args,
|
|
11
|
+
async function updateJsonConfig(configPath, serverName, command, args, defaultRootKey = "mcpServers") {
|
|
12
12
|
let config = {};
|
|
13
13
|
try {
|
|
14
14
|
const fileContent = await fs.readFile(configPath, "utf-8");
|
|
@@ -20,6 +20,14 @@ async function updateJsonConfig(configPath, serverName, command, args, rootKey =
|
|
|
20
20
|
}
|
|
21
21
|
// File doesn't exist, will be created
|
|
22
22
|
}
|
|
23
|
+
// Determine the actual root key to use. If 'servers' already exists, use it. Otherwise use the default.
|
|
24
|
+
let rootKey = defaultRootKey;
|
|
25
|
+
if (config["servers"]) {
|
|
26
|
+
rootKey = "servers";
|
|
27
|
+
}
|
|
28
|
+
else if (config["mcpServers"]) {
|
|
29
|
+
rootKey = "mcpServers";
|
|
30
|
+
}
|
|
23
31
|
if (!config[rootKey]) {
|
|
24
32
|
config[rootKey] = {};
|
|
25
33
|
}
|