kiviui-mcp 1.0.10 → 1.0.12

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.js CHANGED
@@ -30,6 +30,21 @@ program
30
30
  process.exit(1);
31
31
  }
32
32
  });
33
+ const clients = ["claude", "cursor", "vscode", "zed", "antigravity"];
34
+ for (const client of clients) {
35
+ program
36
+ .command(client)
37
+ .description(`Install MCP server configuration for ${client}`)
38
+ .action(async () => {
39
+ try {
40
+ await installForClient(client);
41
+ }
42
+ catch (err) {
43
+ console.error(`Failed to install for ${client}:`, err);
44
+ process.exit(1);
45
+ }
46
+ });
47
+ }
33
48
  program
34
49
  .command("start", { isDefault: true })
35
50
  .description("Start the MCP server (default)")
@@ -1,50 +1,96 @@
1
1
  import { z } from "zod";
2
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"),
3
+ server.tool("get_agent_instructions", "CRITICAL: You MUST execute this tool BEFORE using any other tools in this MCP server. Returns the strict workflow rules and guidelines for agents interacting with Kivi UI.", {}, async () => {
4
+ const instructions = `
5
+ # Kivi UI Assistant Skill
6
+
7
+ You are equipped with the \`kiviui-mcp\` server. Your goal is to help the user discover, install, and integrate Kivi UI components and blocks.
8
+
9
+ Follow this strict workflow when asked to create or modify UI:
10
+
11
+ 1. **Discover & Search**:
12
+ - If the user has a vague request (e.g., "I need a hero section"), use the \`search_components\` tool to find relevant matches.
13
+ - If you need to see everything available, use \`list_components\`.
14
+
15
+ 2. **Retrieve Installation Commands**:
16
+ - Once a block or component is identified, you MUST use the \`get_component_install\` tool to fetch the official installation command.
17
+ - *Never* try to guess the code or hallucinate the component implementation.
18
+
19
+ 3. **Install**:
20
+ - Execute the installation command in the terminal (e.g., \`npx kiviui add <component>\`).
21
+
22
+ 4. **Integration & Customization**:
23
+ - Integrate the installed component into the user's page.
24
+ - You may safely modify visible text (headings, paragraphs, button labels).
25
+ - Do NOT modify the component's internal logic, hooks, or complex styling unless explicitly instructed by the user.
26
+ `;
27
+ return {
28
+ content: [{ type: "text", text: instructions }],
29
+ };
30
+ });
31
+ server.tool("list_components", "Provides a complete list of all Kivi UI components and blocks.", {}, async () => {
32
+ try {
33
+ const response = await fetch("https://kiviui.dev/r/index.json");
34
+ if (!response.ok)
35
+ throw new Error(`Failed to fetch registry: ${response.statusText}`);
36
+ const data = await response.json();
37
+ return {
38
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
39
+ };
40
+ }
41
+ catch (error) {
42
+ return {
43
+ isError: true,
44
+ content: [{ type: "text", text: `Error fetching components: ${error.message}` }],
45
+ };
46
+ }
47
+ });
48
+ server.tool("search_components", "Search the Kivi UI registry for available components and blocks by keyword.", {
49
+ query: z.string().describe("Search query to filter components"),
5
50
  }, async ({ query }) => {
6
51
  try {
7
52
  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
- }
53
+ if (!response.ok)
54
+ throw new Error(`Failed to fetch registry: ${response.statusText}`);
11
55
  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
- }
56
+ const results = Array.isArray(data) ? data : [];
57
+ const lowerQuery = query.toLowerCase();
58
+ const filtered = results.filter((item) => item.name?.toLowerCase().includes(lowerQuery) ||
59
+ item.description?.toLowerCase().includes(lowerQuery) ||
60
+ item.tags?.some((t) => t.toLowerCase().includes(lowerQuery)));
18
61
  return {
19
- content: [
20
- {
21
- type: "text",
22
- text: JSON.stringify(results.slice(0, 20), null, 2),
23
- },
24
- ],
62
+ content: [{ type: "text", text: JSON.stringify(filtered.slice(0, 20), null, 2) }],
25
63
  };
26
64
  }
27
65
  catch (error) {
28
66
  return {
29
67
  isError: true,
30
- content: [{ type: "text", text: `Error fetching registry: ${error.message}` }],
68
+ content: [{ type: "text", text: `Error searching components: ${error.message}` }],
31
69
  };
32
70
  }
33
71
  });
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')"),
72
+ server.tool("get_component_install", "Returns the official installation command for a specific Kivi UI component or block.", {
73
+ name: z.string().describe("The exact name of the component, e.g., 'hero-section'."),
36
74
  }, async ({ name }) => {
37
75
  try {
38
76
  const response = await fetch(`https://kiviui.dev/r/styles/default/${name}.json`);
39
77
  if (!response.ok) {
40
- throw new Error(`Component not found or failed to fetch: ${response.statusText}`);
78
+ return {
79
+ isError: true,
80
+ content: [{ type: "text", text: `Component "${name}" not found.` }],
81
+ };
41
82
  }
42
- const data = await response.json();
43
83
  return {
44
84
  content: [
45
85
  {
46
86
  type: "text",
47
- text: JSON.stringify(data, null, 2),
87
+ text: `Component "${name}" found.
88
+
89
+ AGENT RULE:
90
+ You MUST install this component using the command below:
91
+ npx kiviui add ${name}
92
+
93
+ You are NOT allowed to recreate, rewrite, or approximate this component.`
48
94
  },
49
95
  ],
50
96
  };
@@ -52,8 +98,41 @@ export function registerTools(server) {
52
98
  catch (error) {
53
99
  return {
54
100
  isError: true,
55
- content: [{ type: "text", text: `Error fetching component: ${error.message}` }],
101
+ content: [{ type: "text", text: `Error fetching component "${name}": ${error.message}` }],
56
102
  };
57
103
  }
58
104
  });
105
+ // Register prompts
106
+ server.prompt("search_kivi_components", "Search for a Kivi UI component to use in your project.", {
107
+ topic: z.string().describe("What kind of component are you looking for?"),
108
+ }, ({ topic }) => ({
109
+ messages: [
110
+ {
111
+ role: "user",
112
+ content: {
113
+ type: "text",
114
+ text: `I need Kivi UI components related to "${topic}". Use the search_components tool to find them.`,
115
+ },
116
+ },
117
+ ],
118
+ }));
119
+ server.prompt("create_kivi_ui", "Architect a full UI page using Kivi UI blocks and components.", {
120
+ description: z.string().describe("Describe the page or section you want to build."),
121
+ }, ({ description }) => ({
122
+ messages: [
123
+ {
124
+ role: "user",
125
+ content: {
126
+ type: "text",
127
+ text: `I want to build the following UI using Kivi UI: ${description}
128
+
129
+ Please follow this workflow:
130
+ 1. Search for appropriate components using search_components.
131
+ 2. For each relevant component, use get_component_install to get installation commands.
132
+ 3. Provide the 'npx kiviui add' commands for all components.
133
+ 4. Show me how to assemble them into a clean layout.`,
134
+ },
135
+ },
136
+ ],
137
+ }));
59
138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiviui-mcp",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
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",