uiplug-mcp 1.3.0 → 1.3.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.
Files changed (2) hide show
  1. package/dist/index.js +27 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -469,6 +469,32 @@ ${c.code_component}
469
469
  const { name: compName, description, framework, category, code, installation, tags, model, group_slug, visibility = "public", } = (args ?? {});
470
470
  const { createHash: createHash2 } = await import("crypto");
471
471
  const keyHashForCreate = createHash2("sha256").update(process.env.UIPLUG_API_KEY ?? "").digest("hex");
472
+ // Resolve tag names → UUIDs (create missing tags automatically)
473
+ let tagIds = [];
474
+ if (tags && tags.length > 0) {
475
+ const normalizedNames = tags.map((t) => t.trim().toLowerCase().replace(/\s+/g, "-")).filter(Boolean);
476
+ // Fetch existing tags
477
+ const { data: existingTags } = await supabase
478
+ .from("tags")
479
+ .select("id, name")
480
+ .in("name", normalizedNames);
481
+ const existingMap = {};
482
+ for (const t of (existingTags ?? [])) {
483
+ existingMap[t.name] = t.id;
484
+ }
485
+ // Create any tags that don't exist yet
486
+ const missing = normalizedNames.filter((n) => !existingMap[n]);
487
+ if (missing.length > 0) {
488
+ const { data: created } = await supabase
489
+ .from("tags")
490
+ .insert(missing.map((name) => ({ name })))
491
+ .select("id, name");
492
+ for (const t of (created ?? [])) {
493
+ existingMap[t.name] = t.id;
494
+ }
495
+ }
496
+ tagIds = normalizedNames.map((n) => existingMap[n]).filter(Boolean);
497
+ }
472
498
  const { data: componentId, error } = await supabase.rpc("create_component", {
473
499
  p_key_hash: keyHashForCreate,
474
500
  p_name: compName,
@@ -477,7 +503,7 @@ ${c.code_component}
477
503
  p_category: category,
478
504
  p_code: code,
479
505
  p_installation: installation ?? null,
480
- p_tags: tags ?? [],
506
+ p_tags: tagIds,
481
507
  p_model: model ?? null,
482
508
  p_group_slug: group_slug ?? null,
483
509
  p_visibility: group_slug ? (visibility ?? "public") : "public",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uiplug-mcp",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "MCP server for UIPlug — gives AI agents access to the UIPlug UI component marketplace",
5
5
  "type": "module",
6
6
  "bin": {