kiviui-mcp 1.0.0
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 +18 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +59 -0
- package/package.json +32 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { registerTools } from "./tools/index.js";
|
|
4
|
+
async function main() {
|
|
5
|
+
const server = new McpServer({
|
|
6
|
+
name: "Kivi UI Local MCP",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
description: "Local MCP server for Kivi UI that provides tools for exploring the registry.",
|
|
9
|
+
});
|
|
10
|
+
registerTools(server);
|
|
11
|
+
const transport = new StdioServerTransport();
|
|
12
|
+
await server.connect(transport);
|
|
13
|
+
console.error("Kivi UI Local MCP Server running on stdio");
|
|
14
|
+
}
|
|
15
|
+
main().catch((error) => {
|
|
16
|
+
console.error("Server error:", error);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerTools(server) {
|
|
3
|
+
server.tool("search_kivi_components", "Search the Kivi UI registry for available components and blocks", {
|
|
4
|
+
query: z.string().optional().describe("Search query to filter components"),
|
|
5
|
+
}, async ({ query }) => {
|
|
6
|
+
try {
|
|
7
|
+
const response = await fetch("https://kiviui.dev/r/index.json");
|
|
8
|
+
if (!response.ok) {
|
|
9
|
+
throw new Error(`Failed to fetch registry index: ${response.statusText}`);
|
|
10
|
+
}
|
|
11
|
+
const data = await response.json();
|
|
12
|
+
let results = Array.isArray(data) ? data : [];
|
|
13
|
+
if (query) {
|
|
14
|
+
const lowerQuery = query.toLowerCase();
|
|
15
|
+
results = results.filter((item) => item.name?.toLowerCase().includes(lowerQuery) ||
|
|
16
|
+
item.description?.toLowerCase().includes(lowerQuery));
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: "text",
|
|
22
|
+
text: JSON.stringify(results.slice(0, 20), null, 2),
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return {
|
|
29
|
+
isError: true,
|
|
30
|
+
content: [{ type: "text", text: `Error fetching registry: ${error.message}` }],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
server.tool("get_kivi_component", "Get detailed information about a specific Kivi UI component or block", {
|
|
35
|
+
name: z.string().describe("The name of the component or block (e.g. 'button', 'hero-section')"),
|
|
36
|
+
}, async ({ name }) => {
|
|
37
|
+
try {
|
|
38
|
+
const response = await fetch(`https://kiviui.dev/r/styles/default/${name}.json`);
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
throw new Error(`Component not found or failed to fetch: ${response.statusText}`);
|
|
41
|
+
}
|
|
42
|
+
const data = await response.json();
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: "text",
|
|
47
|
+
text: JSON.stringify(data, null, 2),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return {
|
|
54
|
+
isError: true,
|
|
55
|
+
content: [{ type: "text", text: `Error fetching component: ${error.message}` }],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kiviui-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Local MCP server for Kivi UI designed for Claude Desktop and VS Code",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"kiviui-local-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "node ./dist/index.js",
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"postinstall": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
20
|
+
"zod": "^3.23.8"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^22.0.0",
|
|
24
|
+
"typescript": "^5.5.0"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
},
|
|
29
|
+
"author": "",
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"types": "./dist/index.d.ts"
|
|
32
|
+
}
|