uiplug-mcp 1.1.2 → 1.2.1
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 +80 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -96,13 +96,59 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
96
96
|
},
|
|
97
97
|
},
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
name: "create_component",
|
|
101
|
+
description: "Submit a new UI component to the UIPlug marketplace. " +
|
|
102
|
+
"The component will be submitted for review (status: pending) and visible in your dashboard at uiplug.com/dashboard/components. " +
|
|
103
|
+
"Use this after building a component to share it with the community.",
|
|
104
|
+
inputSchema: {
|
|
105
|
+
type: "object",
|
|
106
|
+
required: ["name", "description", "framework", "category", "code"],
|
|
107
|
+
properties: {
|
|
108
|
+
name: {
|
|
109
|
+
type: "string",
|
|
110
|
+
description: "Component name (e.g. 'Gradient Button').",
|
|
111
|
+
},
|
|
112
|
+
description: {
|
|
113
|
+
type: "string",
|
|
114
|
+
description: "A clear description of what the component does and its key features.",
|
|
115
|
+
},
|
|
116
|
+
framework: {
|
|
117
|
+
type: "string",
|
|
118
|
+
description: "Framework: React | Vue | Svelte | Angular | HTML / CSS | " +
|
|
119
|
+
"Jetpack Compose | Compose Multiplatform | Flutter | SwiftUI | React Native",
|
|
120
|
+
},
|
|
121
|
+
category: {
|
|
122
|
+
type: "string",
|
|
123
|
+
description: "Category: Layout | Navigation | Input | Data Display | Feedback | Sensors",
|
|
124
|
+
},
|
|
125
|
+
code: {
|
|
126
|
+
type: "string",
|
|
127
|
+
description: "Full component source code.",
|
|
128
|
+
},
|
|
129
|
+
installation: {
|
|
130
|
+
type: "string",
|
|
131
|
+
description: "Optional dependency/installation snippet (e.g. 'npm install some-package').",
|
|
132
|
+
},
|
|
133
|
+
tags: {
|
|
134
|
+
type: "array",
|
|
135
|
+
items: { type: "string" },
|
|
136
|
+
description: "Optional tag names (e.g. ['button', 'gradient', 'animation']).",
|
|
137
|
+
},
|
|
138
|
+
model: {
|
|
139
|
+
type: "string",
|
|
140
|
+
description: "Optional — AI model used to build this (e.g. 'Claude Sonnet 4.6').",
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
99
145
|
],
|
|
100
146
|
}));
|
|
101
147
|
// ── Tool handlers ─────────────────────────────────────────────────────────────
|
|
102
148
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
103
149
|
const { name, arguments: args } = request.params;
|
|
104
150
|
// ── Validate API key ─────────────────────────────────────────────────────────
|
|
105
|
-
const { error: authError } = await validateApiKey(process.env.UIPLUG_API_KEY);
|
|
151
|
+
const { userId, error: authError } = await validateApiKey(process.env.UIPLUG_API_KEY);
|
|
106
152
|
if (authError) {
|
|
107
153
|
return { content: [{ type: "text", text: authError }], isError: true };
|
|
108
154
|
}
|
|
@@ -282,6 +328,39 @@ ${c.code_component}
|
|
|
282
328
|
`;
|
|
283
329
|
return { content: [{ type: "text", text: output }] };
|
|
284
330
|
}
|
|
331
|
+
// ── create_component ────────────────────────────────────────────────────────
|
|
332
|
+
if (name === "create_component") {
|
|
333
|
+
const { name: compName, description, framework, category, code, installation, tags, model, } = (args ?? {});
|
|
334
|
+
const { createHash: createHash2 } = await import("crypto");
|
|
335
|
+
const keyHashForCreate = createHash2("sha256").update(process.env.UIPLUG_API_KEY ?? "").digest("hex");
|
|
336
|
+
const { data: componentId, error } = await supabase.rpc("create_component", {
|
|
337
|
+
p_key_hash: keyHashForCreate,
|
|
338
|
+
p_name: compName,
|
|
339
|
+
p_description: description,
|
|
340
|
+
p_framework: framework,
|
|
341
|
+
p_category: category,
|
|
342
|
+
p_code: code,
|
|
343
|
+
p_installation: installation ?? null,
|
|
344
|
+
p_tags: tags ?? [],
|
|
345
|
+
p_model: model ?? null,
|
|
346
|
+
});
|
|
347
|
+
if (error) {
|
|
348
|
+
return { content: [{ type: "text", text: `Error submitting component: ${error.message}` }], isError: true };
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
content: [
|
|
352
|
+
{
|
|
353
|
+
type: "text",
|
|
354
|
+
text: `Component submitted for review!\n\n` +
|
|
355
|
+
`**Name:** ${compName}\n` +
|
|
356
|
+
`**Framework:** ${framework}\n` +
|
|
357
|
+
`**Category:** ${category}\n` +
|
|
358
|
+
`**ID:** ${componentId}\n\n` +
|
|
359
|
+
`View and manage it at: https://uiplug.com/dashboard/components`,
|
|
360
|
+
},
|
|
361
|
+
],
|
|
362
|
+
};
|
|
363
|
+
}
|
|
285
364
|
return {
|
|
286
365
|
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
287
366
|
isError: true,
|