kiviui-mcp 1.0.0 → 1.0.2
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/index.d.ts +1 -0
- package/dist/index.js +31 -4
- package/dist/install.d.ts +1 -0
- package/dist/install.js +105 -0
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
4
|
import { registerTools } from "./tools/index.js";
|
|
4
|
-
|
|
5
|
+
import { program } from "commander";
|
|
6
|
+
import { installForClient } from "./install.js";
|
|
7
|
+
async function runServer() {
|
|
5
8
|
const server = new McpServer({
|
|
6
9
|
name: "Kivi UI Local MCP",
|
|
7
10
|
version: "1.0.0",
|
|
@@ -12,7 +15,31 @@ async function main() {
|
|
|
12
15
|
await server.connect(transport);
|
|
13
16
|
console.error("Kivi UI Local MCP Server running on stdio");
|
|
14
17
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
program
|
|
19
|
+
.name("kiviui-mcp")
|
|
20
|
+
.description("CLI and MCP Server for Kivi UI");
|
|
21
|
+
program
|
|
22
|
+
.command("install <client>")
|
|
23
|
+
.description("Install MCP server configuration for a specific client (claude, cursor, vscode, antigravity)")
|
|
24
|
+
.action(async (client) => {
|
|
25
|
+
try {
|
|
26
|
+
await installForClient(client);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
console.error(`Failed to install for ${client}:`, err);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
18
32
|
});
|
|
33
|
+
program
|
|
34
|
+
.command("start", { isDefault: true })
|
|
35
|
+
.description("Start the MCP server (default)")
|
|
36
|
+
.action(async () => {
|
|
37
|
+
try {
|
|
38
|
+
await runServer();
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error("Server error:", error);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
program.parse(process.argv);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function installForClient(client: string): Promise<void>;
|
package/dist/install.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import os from "os";
|
|
4
|
+
// Helper to determine OS
|
|
5
|
+
const isWindows = os.platform() === "win32";
|
|
6
|
+
const isMac = os.platform() === "darwin";
|
|
7
|
+
// Command to run the MCP server
|
|
8
|
+
// npx -y kiviui-mcp
|
|
9
|
+
const MCP_SERVER_COMMAND = "npx";
|
|
10
|
+
const MCP_SERVER_ARGS = ["-y", "kiviui-mcp"];
|
|
11
|
+
async function updateJsonConfig(configPath, serverName, command, args) {
|
|
12
|
+
let config = { mcpServers: {} };
|
|
13
|
+
try {
|
|
14
|
+
const fileContent = await fs.readFile(configPath, "utf-8");
|
|
15
|
+
config = JSON.parse(fileContent);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
if (err.code !== "ENOENT") {
|
|
19
|
+
throw err;
|
|
20
|
+
}
|
|
21
|
+
// File doesn't exist, will be created
|
|
22
|
+
}
|
|
23
|
+
if (!config.mcpServers) {
|
|
24
|
+
config.mcpServers = {};
|
|
25
|
+
}
|
|
26
|
+
config.mcpServers[serverName] = {
|
|
27
|
+
command,
|
|
28
|
+
args
|
|
29
|
+
};
|
|
30
|
+
await fs.mkdir(path.dirname(configPath), { recursive: true });
|
|
31
|
+
await fs.writeFile(configPath, JSON.stringify(config, null, 2));
|
|
32
|
+
console.log(`✅ Successfully updated configuration at: ${configPath}`);
|
|
33
|
+
console.log(`Added MCP server: ${serverName}`);
|
|
34
|
+
}
|
|
35
|
+
export async function installForClient(client) {
|
|
36
|
+
const normalizedClient = client.toLowerCase();
|
|
37
|
+
const serverName = "kivi-ui";
|
|
38
|
+
const homeDir = os.homedir();
|
|
39
|
+
switch (normalizedClient) {
|
|
40
|
+
case "claude": {
|
|
41
|
+
let configPath = "";
|
|
42
|
+
if (isMac) {
|
|
43
|
+
configPath = path.join(homeDir, "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
44
|
+
}
|
|
45
|
+
else if (isWindows) {
|
|
46
|
+
configPath = path.join(process.env.APPDATA || path.join(homeDir, "AppData", "Roaming"), "Claude", "claude_desktop_config.json");
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// Linux (Unofficial)
|
|
50
|
+
configPath = path.join(homeDir, ".config", "Claude", "claude_desktop_config.json");
|
|
51
|
+
}
|
|
52
|
+
await updateJsonConfig(configPath, serverName, MCP_SERVER_COMMAND, MCP_SERVER_ARGS);
|
|
53
|
+
console.log("Please restart Claude Desktop for the changes to take effect.");
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case "cursor": {
|
|
57
|
+
// Cursor doesn't have a standard global json for this yet, but we can instruct the user
|
|
58
|
+
// or try to update a known cursor path if it exists.
|
|
59
|
+
// For now, let's just give instructions since cursor configuration is often project-specific or manual in UI.
|
|
60
|
+
console.log("To use Kivi UI MCP in Cursor:");
|
|
61
|
+
console.log("1. Open Cursor Settings (Cursor Settings > Features > MCP)");
|
|
62
|
+
console.log("2. Click '+ Add New MCP Server'");
|
|
63
|
+
console.log("3. Type: command");
|
|
64
|
+
console.log(`4. Name: ${serverName}`);
|
|
65
|
+
console.log(`5. Command: ${MCP_SERVER_COMMAND} ${MCP_SERVER_ARGS.join(" ")}`);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case "vscode": {
|
|
69
|
+
// VSCode doesn't have native MCP support yet without extensions like Cline or Roo.
|
|
70
|
+
// We will provide instructions for Cline.
|
|
71
|
+
let configPath = "";
|
|
72
|
+
if (isMac) {
|
|
73
|
+
configPath = path.join(homeDir, "Library", "Application Support", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json");
|
|
74
|
+
}
|
|
75
|
+
else if (isWindows) {
|
|
76
|
+
configPath = path.join(process.env.APPDATA || path.join(homeDir, "AppData", "Roaming"), "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json");
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
configPath = path.join(homeDir, ".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json");
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
await updateJsonConfig(configPath, serverName, MCP_SERVER_COMMAND, MCP_SERVER_ARGS);
|
|
83
|
+
console.log("Successfully configured Kivi UI MCP for Cline/Roo Code in VS Code.");
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
console.log("Could not find Cline MCP config. To configure manually in VS Code:");
|
|
87
|
+
console.log(`Command: ${MCP_SERVER_COMMAND} ${MCP_SERVER_ARGS.join(" ")}`);
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case "antigravity":
|
|
92
|
+
case "agy": {
|
|
93
|
+
// Antigravity MCP config
|
|
94
|
+
const configPath = path.join(homeDir, ".gemini", "config", "mcp_config.json");
|
|
95
|
+
await updateJsonConfig(configPath, serverName, MCP_SERVER_COMMAND, MCP_SERVER_ARGS);
|
|
96
|
+
console.log("Successfully configured Kivi UI MCP for Antigravity.");
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
default: {
|
|
100
|
+
console.error(`Unknown client: ${client}`);
|
|
101
|
+
console.log("Supported clients: claude, cursor, vscode, antigravity");
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kiviui-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Local MCP server for Kivi UI designed for Claude Desktop and VS Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"kiviui-
|
|
8
|
+
"kiviui-mcp": "dist/index.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
20
|
+
"commander": "^14.0.3",
|
|
20
21
|
"zod": "^3.23.8"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|