@rlx-ui/mcp 0.0.1 → 0.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/cli.js CHANGED
@@ -1,11 +1,394 @@
1
- import { McpServer as n } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { StdioServerTransport as o } from "@modelcontextprotocol/sdk/server/stdio.js";
3
- import { z as i } from "zod";
4
- async function s() {
5
- const e = new n(
1
+ import { McpServer as I } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { StdioServerTransport as U } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import { z as p } from "zod";
4
+ import { readFileSync as _ } from "fs";
5
+ import { fileURLToPath as P } from "url";
6
+ import { join as x, dirname as X } from "path";
7
+ const E = P(import.meta.url), w = X(E);
8
+ let h = null;
9
+ function f() {
10
+ if (h)
11
+ return h;
12
+ try {
13
+ const s = [
14
+ x(w, "data/registry.json"),
15
+ // From dist/ to dist/data/ (copied during build)
16
+ x(w, "../src/data/registry.json"),
17
+ // From dist/ to src/data/ (development)
18
+ x(w, "../data/registry.json"),
19
+ // Fallback
20
+ x(process.cwd(), "src/data/registry.json"),
21
+ // From package root (published)
22
+ x(process.cwd(), "libs/rlx-ui/mcp/src/data/registry.json")
23
+ // Development
24
+ ];
25
+ let i = null;
26
+ for (const t of s)
27
+ try {
28
+ i = _(t, "utf-8");
29
+ break;
30
+ } catch {
31
+ continue;
32
+ }
33
+ if (!i)
34
+ throw new Error("Could not find registry.json in any expected location");
35
+ return h = JSON.parse(i), h;
36
+ } catch (s) {
37
+ return console.error("Warning: Could not load component registry:", s), h = {
38
+ widgets: [],
39
+ components: [],
40
+ animates: [],
41
+ hooks: [],
42
+ utils: [],
43
+ extractedAt: (/* @__PURE__ */ new Date()).toISOString()
44
+ }, h;
45
+ }
46
+ }
47
+ function L() {
48
+ return f().widgets;
49
+ }
50
+ function $() {
51
+ return f().components;
52
+ }
53
+ function N() {
54
+ return f().animates;
55
+ }
56
+ function R() {
57
+ return f().hooks;
58
+ }
59
+ function T() {
60
+ return f().utils;
61
+ }
62
+ function y(s, i) {
63
+ const t = f();
64
+ if (i === "widget" || !i) {
65
+ const e = t.widgets.find((n) => n.slug === s);
66
+ if (e) return e;
67
+ }
68
+ if (i === "component" || !i) {
69
+ const e = t.components.find((n) => n.slug === s);
70
+ if (e) return e;
71
+ }
72
+ if (i === "animate" || !i) {
73
+ const e = t.animates.find((n) => n.slug === s);
74
+ if (e) return e;
75
+ }
76
+ if (i === "hook" || !i) {
77
+ const e = t.hooks.find((n) => n.slug === s);
78
+ if (e) return e;
79
+ }
80
+ if (i === "util" || !i) {
81
+ const e = t.utils.find((n) => n.slug === s);
82
+ if (e) return e;
83
+ }
84
+ }
85
+ function M(s) {
86
+ const i = f(), t = [
87
+ ...i.widgets,
88
+ ...i.components,
89
+ ...i.animates,
90
+ ...i.hooks,
91
+ ...i.utils
92
+ ], e = s.toLowerCase();
93
+ return t.filter(
94
+ (n) => n.name.toLowerCase().includes(e) || n.slug.toLowerCase().includes(e)
95
+ );
96
+ }
97
+ function b() {
98
+ return L();
99
+ }
100
+ function k() {
101
+ return $();
102
+ }
103
+ function v() {
104
+ return N();
105
+ }
106
+ function S() {
107
+ return R();
108
+ }
109
+ function C() {
110
+ return T();
111
+ }
112
+ function A(s) {
113
+ return M(s);
114
+ }
115
+ function G(s, i) {
116
+ return y(s, i) || null;
117
+ }
118
+ function V(s, i) {
119
+ const t = y(s, i);
120
+ if (!t)
121
+ return { found: !1 };
122
+ let e, n;
123
+ if (t.sourcePath && typeof t.sourcePath == "string") {
124
+ const o = t.sourcePath, r = o.match(
125
+ /(?:export\s+)?(?:interface|type)\s+(\w+Props?)\s*[=:]\s*\{[\s\S]*?\}/g
126
+ );
127
+ r && r.length > 0 ? e = r[0] : o.trim().startsWith("export") ? n = "Source code contains only export statements. Props definition may be in component file." : (e = o.substring(0, 1e3), n = "Full source code provided. Props interface may be defined in the component file.");
128
+ } else
129
+ n = "Source code not available in registry.";
130
+ return {
131
+ found: !0,
132
+ component: t,
133
+ props: e,
134
+ note: n
135
+ };
136
+ }
137
+ function J(s, i, t) {
138
+ var o, r;
139
+ const e = y(s, i);
140
+ if (!e)
141
+ return { found: !1 };
142
+ const n = [];
143
+ if (e.variants && e.variants.forEach((a) => {
144
+ n.push({ name: a.name, type: "variant" });
145
+ }), e.examples && e.examples.forEach((a) => {
146
+ n.push({ name: a.name, type: "example" });
147
+ }), t) {
148
+ const a = (o = e.variants) == null ? void 0 : o.find((d) => d.name === t);
149
+ if (a && a.code)
150
+ return {
151
+ found: !0,
152
+ component: e,
153
+ example: {
154
+ name: a.name,
155
+ code: a.code,
156
+ preview: a.preview
157
+ },
158
+ availableExamples: n
159
+ };
160
+ const l = (r = e.examples) == null ? void 0 : r.find((d) => d.name === t);
161
+ return l && l.code ? {
162
+ found: !0,
163
+ component: e,
164
+ example: {
165
+ name: l.name,
166
+ code: l.code,
167
+ preview: l.preview
168
+ },
169
+ availableExamples: n
170
+ } : {
171
+ found: !0,
172
+ component: e,
173
+ availableExamples: n
174
+ };
175
+ }
176
+ if (e.variants && e.variants.length > 0) {
177
+ const a = e.variants[0];
178
+ if (a.code)
179
+ return {
180
+ found: !0,
181
+ component: e,
182
+ example: {
183
+ name: a.name,
184
+ code: a.code,
185
+ preview: a.preview
186
+ },
187
+ availableExamples: n
188
+ };
189
+ }
190
+ if (e.examples && e.examples.length > 0) {
191
+ const a = e.examples[0];
192
+ if (a.code)
193
+ return {
194
+ found: !0,
195
+ component: e,
196
+ example: {
197
+ name: a.name,
198
+ code: a.code,
199
+ preview: a.preview
200
+ },
201
+ availableExamples: n
202
+ };
203
+ }
204
+ return {
205
+ found: !0,
206
+ component: e,
207
+ availableExamples: n
208
+ };
209
+ }
210
+ function j(s, i, t = "pnpm") {
211
+ const e = y(s, i);
212
+ if (!e)
213
+ return { found: !1 };
214
+ let n;
215
+ switch (e.category) {
216
+ case "widget":
217
+ n = `@rlx-widgets/${e.slug}`;
218
+ break;
219
+ case "component":
220
+ n = `@rlx-components/${e.slug}`;
221
+ break;
222
+ case "hook":
223
+ n = `@rlx-hooks/${e.slug}`;
224
+ break;
225
+ case "util":
226
+ n = `@rlx-utils/${e.slug}`;
227
+ break;
228
+ case "animate":
229
+ n = `@rlx-animates/${e.slug}`;
230
+ break;
231
+ default:
232
+ return { found: !1 };
233
+ }
234
+ let o;
235
+ switch (t) {
236
+ case "npm":
237
+ o = `npm install ${n}`;
238
+ break;
239
+ case "pnpm":
240
+ o = `pnpm add ${n}`;
241
+ break;
242
+ case "yarn":
243
+ o = `yarn add ${n}`;
244
+ break;
245
+ default:
246
+ o = `pnpm add ${n}`;
247
+ }
248
+ return {
249
+ found: !0,
250
+ command: o,
251
+ packageName: n,
252
+ category: e.category
253
+ };
254
+ }
255
+ function q(s, i, t, e) {
256
+ var d;
257
+ const n = y(s, i);
258
+ if (!n)
259
+ return { found: !1 };
260
+ const o = J(s, i);
261
+ let r;
262
+ if ((d = o.example) != null && d.code) {
263
+ if (r = o.example.code, t && Object.keys(t).length > 0)
264
+ for (const [m, c] of Object.entries(t)) {
265
+ const u = new RegExp(`${m}=\\{[^}]*\\}`, "g");
266
+ typeof c == "string" ? r = r.replace(u, `${m}="${c}"`) : r = r.replace(u, `${m}={${JSON.stringify(c)}}`);
267
+ }
268
+ } else {
269
+ const m = B(n), c = D(n);
270
+ r = `import { ${c} } from "${m}";
271
+
272
+ export const MyComponent = () => {
273
+ return (
274
+ <${c}${t ? z(t) : ""}>
275
+ {/* Your content here */}
276
+ </${c}>
277
+ );
278
+ };`;
279
+ }
280
+ const a = j(s, i, "pnpm"), l = a.found ? a.command : void 0;
281
+ return {
282
+ found: !0,
283
+ component: n,
284
+ code: r,
285
+ installation: l,
286
+ note: e ? `Generated for use case: ${e}` : void 0
287
+ };
288
+ }
289
+ function F(s) {
290
+ const i = [
291
+ ...L(),
292
+ ...$(),
293
+ ...R(),
294
+ ...T(),
295
+ ...N()
296
+ ], t = [], e = s.toLowerCase(), n = e.split(/\s+/).filter((o) => o.length >= 3);
297
+ for (const o of i) {
298
+ let r = 0;
299
+ const a = [];
300
+ o.name.toLowerCase().includes(e) && (r += 10, a.push("name matches")), o.slug.toLowerCase().includes(e) && (r += 8, a.push("slug matches"));
301
+ for (const l of n)
302
+ l.length < 3 || (o.name.toLowerCase().includes(l) && (r += 3, a.push(`name contains "${l}"`)), o.slug.toLowerCase().includes(l) && (r += 2, a.push(`slug contains "${l}"`)));
303
+ (e.includes("button") || e.includes("click")) && (o.slug === "button" || o.slug === "button-group") && (r += 15, a.push("perfect match for button use case")), (e.includes("form") || e.includes("input")) && o.category === "widget" && (o.slug.includes("input") || o.slug.includes("form") || o.slug.includes("field")) && (r += 12, a.push("form-related component")), (e.includes("dialog") || e.includes("modal")) && (o.slug.includes("dialog") || o.slug.includes("modal")) && (r += 15, a.push("perfect match for dialog/modal")), (e.includes("menu") || e.includes("dropdown")) && (o.slug.includes("menu") || o.slug.includes("dropdown")) && (r += 12, a.push("menu-related component")), (e.includes("hook") || e.includes("react hook")) && o.category === "hook" && (r += 10, a.push("React hook")), r > 0 && t.push({
304
+ component: o,
305
+ relevance: r,
306
+ reason: a.join(", ")
307
+ });
308
+ }
309
+ return t.sort((o, r) => r.relevance - o.relevance), { suggestions: t.slice(0, 5) };
310
+ }
311
+ function W(s) {
312
+ const i = [], t = [], e = [];
313
+ for (const c of s) {
314
+ const u = y(c);
315
+ i.push({
316
+ slug: c,
317
+ found: !!u,
318
+ component: u || void 0
319
+ });
320
+ }
321
+ const n = i.filter((c) => !c.found);
322
+ n.length > 0 && e.push(
323
+ `Some components not found: ${n.map((c) => c.slug).join(", ")}`
324
+ );
325
+ const o = i.filter((c) => c.found && c.component), r = o.some(
326
+ (c) => {
327
+ var u, g;
328
+ return ((u = c.component) == null ? void 0 : u.slug.includes("dialog")) || ((g = c.component) == null ? void 0 : g.slug.includes("modal"));
329
+ }
330
+ ), a = o.some((c) => {
331
+ var u;
332
+ return ((u = c.component) == null ? void 0 : u.slug) === "button";
333
+ }), l = o.some(
334
+ (c) => {
335
+ var u, g, O;
336
+ return ((u = c.component) == null ? void 0 : u.slug.includes("input")) || ((g = c.component) == null ? void 0 : g.slug.includes("form")) || ((O = c.component) == null ? void 0 : O.slug.includes("field"));
337
+ }
338
+ );
339
+ r && !a && t.push(
340
+ "Consider adding a Button component to trigger the dialog/modal"
341
+ ), l && !a && t.push("Consider adding a Button component for form submission"), o.filter(
342
+ (c) => {
343
+ var u, g;
344
+ return ((u = c.component) == null ? void 0 : u.slug.includes("dialog")) || ((g = c.component) == null ? void 0 : g.slug.includes("modal"));
345
+ }
346
+ ).length > 1 && e.push("Multiple dialog/modal components detected. Consider using one at a time.");
347
+ const m = new Set(
348
+ o.map((c) => {
349
+ var u;
350
+ return (u = c.component) == null ? void 0 : u.category;
351
+ }).filter(Boolean)
352
+ );
353
+ return m.size > 1 && t.push(
354
+ `Components span multiple categories: ${Array.from(m).join(", ")}`
355
+ ), {
356
+ compatible: e.length === 0,
357
+ components: i,
358
+ notes: t,
359
+ warnings: e
360
+ };
361
+ }
362
+ function B(s) {
363
+ switch (s.category) {
364
+ case "widget":
365
+ return `@rlx-widgets/${s.slug}`;
366
+ case "component":
367
+ return `@rlx-components/${s.slug}`;
368
+ case "hook":
369
+ return `@rlx-hooks/${s.slug}`;
370
+ case "util":
371
+ return `@rlx-utils/${s.slug}`;
372
+ case "animate":
373
+ return `@rlx-animates/${s.slug}`;
374
+ default:
375
+ return "";
376
+ }
377
+ }
378
+ function D(s) {
379
+ return s.name.split(" ")[0];
380
+ }
381
+ function z(s) {
382
+ const i = [];
383
+ for (const [t, e] of Object.entries(s))
384
+ typeof e == "string" ? i.push(`${t}="${e}"`) : typeof e == "boolean" ? i.push(e ? t : `${t}={false}`) : i.push(`${t}={${JSON.stringify(e)}}`);
385
+ return i.length > 0 ? ` ${i.join(" ")}` : "";
386
+ }
387
+ async function H() {
388
+ const s = new I(
6
389
  {
7
390
  name: "@rlx-ui/mcp",
8
- version: "0.0.1"
391
+ version: "0.0.2"
9
392
  },
10
393
  {
11
394
  capabilities: {
@@ -14,73 +397,663 @@ async function s() {
14
397
  }
15
398
  }
16
399
  );
17
- e.registerTool(
18
- "greet",
400
+ s.registerTool(
401
+ "list_widgets",
402
+ {
403
+ description: "List all available widgets in the RLX UI library"
404
+ },
405
+ async () => {
406
+ const t = b();
407
+ return {
408
+ content: [
409
+ {
410
+ type: "text",
411
+ text: JSON.stringify(
412
+ {
413
+ count: t.length,
414
+ widgets: t.map((e) => {
415
+ var n, o;
416
+ return {
417
+ name: e.name,
418
+ slug: e.slug,
419
+ path: e.path,
420
+ hasVariants: (((n = e.variants) == null ? void 0 : n.length) ?? 0) > 0,
421
+ hasExamples: (((o = e.examples) == null ? void 0 : o.length) ?? 0) > 0
422
+ };
423
+ })
424
+ },
425
+ null,
426
+ 2
427
+ )
428
+ }
429
+ ]
430
+ };
431
+ }
432
+ ), s.registerTool(
433
+ "list_components",
434
+ {
435
+ description: "List all available components in the RLX UI library"
436
+ },
437
+ async () => {
438
+ const t = k();
439
+ return {
440
+ content: [
441
+ {
442
+ type: "text",
443
+ text: JSON.stringify(
444
+ {
445
+ count: t.length,
446
+ components: t.map((e) => {
447
+ var n, o;
448
+ return {
449
+ name: e.name,
450
+ slug: e.slug,
451
+ path: e.path,
452
+ hasVariants: (((n = e.variants) == null ? void 0 : n.length) ?? 0) > 0,
453
+ hasExamples: (((o = e.examples) == null ? void 0 : o.length) ?? 0) > 0
454
+ };
455
+ })
456
+ },
457
+ null,
458
+ 2
459
+ )
460
+ }
461
+ ]
462
+ };
463
+ }
464
+ ), s.registerTool(
465
+ "list_animates",
466
+ {
467
+ description: "List all available animations in the RLX UI library"
468
+ },
469
+ async () => {
470
+ const t = v();
471
+ return {
472
+ content: [
473
+ {
474
+ type: "text",
475
+ text: JSON.stringify(
476
+ {
477
+ count: t.length,
478
+ animates: t.map((e) => {
479
+ var n;
480
+ return {
481
+ name: e.name,
482
+ slug: e.slug,
483
+ path: e.path,
484
+ hasVariants: (((n = e.variants) == null ? void 0 : n.length) ?? 0) > 0
485
+ };
486
+ })
487
+ },
488
+ null,
489
+ 2
490
+ )
491
+ }
492
+ ]
493
+ };
494
+ }
495
+ ), s.registerTool(
496
+ "list_hooks",
497
+ {
498
+ description: "List all available React hooks in the RLX UI library"
499
+ },
500
+ async () => {
501
+ const t = S();
502
+ return {
503
+ content: [
504
+ {
505
+ type: "text",
506
+ text: JSON.stringify(
507
+ {
508
+ count: t.length,
509
+ hooks: t.map((e) => {
510
+ var n, o;
511
+ return {
512
+ name: e.name,
513
+ slug: e.slug,
514
+ path: e.path,
515
+ hasVariants: (((n = e.variants) == null ? void 0 : n.length) ?? 0) > 0,
516
+ hasExamples: (((o = e.examples) == null ? void 0 : o.length) ?? 0) > 0
517
+ };
518
+ })
519
+ },
520
+ null,
521
+ 2
522
+ )
523
+ }
524
+ ]
525
+ };
526
+ }
527
+ ), s.registerTool(
528
+ "list_utils",
529
+ {
530
+ description: "List all available utility functions in the RLX UI library"
531
+ },
532
+ async () => {
533
+ const t = C();
534
+ return {
535
+ content: [
536
+ {
537
+ type: "text",
538
+ text: JSON.stringify(
539
+ {
540
+ count: t.length,
541
+ utils: t.map((e) => {
542
+ var n, o;
543
+ return {
544
+ name: e.name,
545
+ slug: e.slug,
546
+ path: e.path,
547
+ hasVariants: (((n = e.variants) == null ? void 0 : n.length) ?? 0) > 0,
548
+ hasExamples: (((o = e.examples) == null ? void 0 : o.length) ?? 0) > 0
549
+ };
550
+ })
551
+ },
552
+ null,
553
+ 2
554
+ )
555
+ }
556
+ ]
557
+ };
558
+ }
559
+ ), s.registerTool(
560
+ "search_component",
561
+ {
562
+ description: "Search for components, widgets, hooks, utils, or animates by name or slug",
563
+ inputSchema: {
564
+ query: p.string().describe("Search query to find components")
565
+ }
566
+ },
567
+ async (t) => {
568
+ const e = A(t.query);
569
+ return {
570
+ content: [
571
+ {
572
+ type: "text",
573
+ text: JSON.stringify(
574
+ {
575
+ query: t.query,
576
+ count: e.length,
577
+ results: e.map((n) => ({
578
+ name: n.name,
579
+ slug: n.slug,
580
+ category: n.category,
581
+ path: n.path
582
+ }))
583
+ },
584
+ null,
585
+ 2
586
+ )
587
+ }
588
+ ]
589
+ };
590
+ }
591
+ ), s.registerTool(
592
+ "get_component_info",
593
+ {
594
+ description: "Get detailed information about a specific component, widget, hook, util, or animate",
595
+ inputSchema: {
596
+ slug: p.string().describe("The slug/name of the component (e.g., 'button', 'use-copy-to-clipboard')"),
597
+ category: p.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search")
598
+ }
599
+ },
600
+ async (t) => {
601
+ var n, o, r, a;
602
+ const e = G(t.slug, t.category);
603
+ return e ? {
604
+ content: [
605
+ {
606
+ type: "text",
607
+ text: JSON.stringify(
608
+ {
609
+ name: e.name,
610
+ slug: e.slug,
611
+ category: e.category,
612
+ path: e.path,
613
+ hasSourceCode: !!e.sourcePath && typeof e.sourcePath == "string",
614
+ variantsCount: ((n = e.variants) == null ? void 0 : n.length) ?? 0,
615
+ examplesCount: ((o = e.examples) == null ? void 0 : o.length) ?? 0,
616
+ variants: (r = e.variants) == null ? void 0 : r.map((l) => ({
617
+ name: l.name,
618
+ hasCode: !!l.code,
619
+ hasPreview: !!l.preview
620
+ })),
621
+ examples: (a = e.examples) == null ? void 0 : a.map((l) => ({
622
+ name: l.name,
623
+ hasCode: !!l.code,
624
+ hasPreview: !!l.preview
625
+ }))
626
+ },
627
+ null,
628
+ 2
629
+ )
630
+ }
631
+ ]
632
+ } : {
633
+ content: [
634
+ {
635
+ type: "text",
636
+ text: JSON.stringify(
637
+ {
638
+ error: "Component not found",
639
+ slug: t.slug,
640
+ category: t.category
641
+ },
642
+ null,
643
+ 2
644
+ )
645
+ }
646
+ ]
647
+ };
648
+ }
649
+ ), s.registerTool(
650
+ "get_component_props",
651
+ {
652
+ description: "Get TypeScript props/interface definition for a component",
653
+ inputSchema: {
654
+ slug: p.string().describe("The slug/name of the component"),
655
+ category: p.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search")
656
+ }
657
+ },
658
+ async (t) => {
659
+ var n, o, r;
660
+ const e = V(t.slug, t.category);
661
+ return e.found ? {
662
+ content: [
663
+ {
664
+ type: "text",
665
+ text: JSON.stringify(
666
+ {
667
+ component: {
668
+ name: (n = e.component) == null ? void 0 : n.name,
669
+ slug: (o = e.component) == null ? void 0 : o.slug,
670
+ category: (r = e.component) == null ? void 0 : r.category
671
+ },
672
+ props: e.props,
673
+ note: e.note
674
+ },
675
+ null,
676
+ 2
677
+ )
678
+ }
679
+ ]
680
+ } : {
681
+ content: [
682
+ {
683
+ type: "text",
684
+ text: JSON.stringify(
685
+ {
686
+ error: "Component not found",
687
+ slug: t.slug,
688
+ category: t.category
689
+ },
690
+ null,
691
+ 2
692
+ )
693
+ }
694
+ ]
695
+ };
696
+ }
697
+ ), s.registerTool(
698
+ "get_component_example",
19
699
  {
20
- description: "A simple greeting tool that returns a welcome message",
700
+ description: "Get code examples for a component (variants or examples)",
21
701
  inputSchema: {
22
- name: i.string().describe("The name to greet")
702
+ slug: p.string().describe("The slug/name of the component"),
703
+ category: p.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search"),
704
+ exampleName: p.string().optional().describe("Optional specific example/variant name. If not provided, returns the first available example.")
23
705
  }
24
706
  },
25
- async (t) => ({
26
- content: [
27
- {
28
- type: "text",
29
- text: `Hello, ${t.name}! Welcome to RLX UI MCP Server.`
30
- }
31
- ]
32
- })
33
- ), e.registerTool(
34
- "get_info",
35
- {
36
- description: "Get information about the RLX UI MCP server"
37
- },
38
- async () => ({
39
- content: [
40
- {
41
- type: "text",
42
- text: JSON.stringify(
43
- {
44
- name: "@rlx-ui/mcp",
45
- version: "0.0.1",
46
- description: "MCP Server for RLX UI components and utilities",
47
- capabilities: ["tools", "resources"]
48
- },
49
- null,
50
- 2
51
- )
52
- }
53
- ]
54
- })
55
- ), e.registerResource(
707
+ async (t) => {
708
+ var n, o, r;
709
+ const e = J(t.slug, t.category, t.exampleName);
710
+ return e.found ? {
711
+ content: [
712
+ {
713
+ type: "text",
714
+ text: JSON.stringify(
715
+ {
716
+ component: {
717
+ name: (n = e.component) == null ? void 0 : n.name,
718
+ slug: (o = e.component) == null ? void 0 : o.slug,
719
+ category: (r = e.component) == null ? void 0 : r.category
720
+ },
721
+ example: e.example,
722
+ availableExamples: e.availableExamples
723
+ },
724
+ null,
725
+ 2
726
+ )
727
+ }
728
+ ]
729
+ } : {
730
+ content: [
731
+ {
732
+ type: "text",
733
+ text: JSON.stringify(
734
+ {
735
+ error: "Component not found",
736
+ slug: t.slug,
737
+ category: t.category
738
+ },
739
+ null,
740
+ 2
741
+ )
742
+ }
743
+ ]
744
+ };
745
+ }
746
+ ), s.registerTool(
747
+ "get_installation_command",
748
+ {
749
+ description: "Get npm/pnpm/yarn installation command for a component",
750
+ inputSchema: {
751
+ slug: p.string().describe("The slug/name of the component"),
752
+ category: p.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search"),
753
+ packageManager: p.enum(["npm", "pnpm", "yarn"]).optional().default("pnpm").describe("Package manager to use (default: pnpm)")
754
+ }
755
+ },
756
+ async (t) => {
757
+ const e = j(
758
+ t.slug,
759
+ t.category,
760
+ t.packageManager || "pnpm"
761
+ );
762
+ return e.found ? {
763
+ content: [
764
+ {
765
+ type: "text",
766
+ text: JSON.stringify(
767
+ {
768
+ command: e.command,
769
+ packageName: e.packageName,
770
+ category: e.category,
771
+ packageManager: t.packageManager || "pnpm"
772
+ },
773
+ null,
774
+ 2
775
+ )
776
+ }
777
+ ]
778
+ } : {
779
+ content: [
780
+ {
781
+ type: "text",
782
+ text: JSON.stringify(
783
+ {
784
+ error: "Component not found",
785
+ slug: t.slug,
786
+ category: t.category
787
+ },
788
+ null,
789
+ 2
790
+ )
791
+ }
792
+ ]
793
+ };
794
+ }
795
+ ), s.registerTool(
796
+ "generate_component_code",
797
+ {
798
+ description: "Generate component usage code with optional props and use case",
799
+ inputSchema: {
800
+ slug: p.string().describe("The slug/name of the component"),
801
+ category: p.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search"),
802
+ props: p.record(p.string(), p.unknown()).optional().describe("Optional props to customize the generated code"),
803
+ useCase: p.string().optional().describe("Optional description of the use case")
804
+ }
805
+ },
806
+ async (t) => {
807
+ var n, o, r;
808
+ const e = q(
809
+ t.slug,
810
+ t.category,
811
+ t.props,
812
+ t.useCase
813
+ );
814
+ return e.found ? {
815
+ content: [
816
+ {
817
+ type: "text",
818
+ text: JSON.stringify(
819
+ {
820
+ component: {
821
+ name: (n = e.component) == null ? void 0 : n.name,
822
+ slug: (o = e.component) == null ? void 0 : o.slug,
823
+ category: (r = e.component) == null ? void 0 : r.category
824
+ },
825
+ code: e.code,
826
+ installation: e.installation,
827
+ note: e.note
828
+ },
829
+ null,
830
+ 2
831
+ )
832
+ }
833
+ ]
834
+ } : {
835
+ content: [
836
+ {
837
+ type: "text",
838
+ text: JSON.stringify(
839
+ {
840
+ error: "Component not found",
841
+ slug: t.slug,
842
+ category: t.category
843
+ },
844
+ null,
845
+ 2
846
+ )
847
+ }
848
+ ]
849
+ };
850
+ }
851
+ ), s.registerTool(
852
+ "suggest_component",
853
+ {
854
+ description: "Suggest which component to use for a specific use case",
855
+ inputSchema: {
856
+ description: p.string().describe("Description of what you want to build or accomplish")
857
+ }
858
+ },
859
+ async (t) => {
860
+ const e = F(t.description);
861
+ return {
862
+ content: [
863
+ {
864
+ type: "text",
865
+ text: JSON.stringify(
866
+ {
867
+ description: t.description,
868
+ suggestions: e.suggestions.map((n) => ({
869
+ component: {
870
+ name: n.component.name,
871
+ slug: n.component.slug,
872
+ category: n.component.category,
873
+ path: n.component.path
874
+ },
875
+ relevance: n.relevance,
876
+ reason: n.reason
877
+ }))
878
+ },
879
+ null,
880
+ 2
881
+ )
882
+ }
883
+ ]
884
+ };
885
+ }
886
+ ), s.registerTool(
887
+ "check_component_compatibility",
888
+ {
889
+ description: "Check if multiple components work well together",
890
+ inputSchema: {
891
+ componentSlugs: p.array(p.string()).describe("Array of component slugs to check compatibility")
892
+ }
893
+ },
894
+ async (t) => {
895
+ const e = W(t.componentSlugs);
896
+ return {
897
+ content: [
898
+ {
899
+ type: "text",
900
+ text: JSON.stringify(
901
+ {
902
+ compatible: e.compatible,
903
+ components: e.components.map((n) => ({
904
+ slug: n.slug,
905
+ found: n.found,
906
+ component: n.component ? {
907
+ name: n.component.name,
908
+ slug: n.component.slug,
909
+ category: n.component.category
910
+ } : void 0
911
+ })),
912
+ notes: e.notes,
913
+ warnings: e.warnings
914
+ },
915
+ null,
916
+ 2
917
+ )
918
+ }
919
+ ]
920
+ };
921
+ }
922
+ ), s.registerResource(
923
+ "RLX UI Widgets",
924
+ "rlx-ui://widgets",
925
+ {
926
+ description: "List of all widgets in the RLX UI library",
927
+ mimeType: "application/json"
928
+ },
929
+ async () => {
930
+ const t = b();
931
+ return {
932
+ contents: [
933
+ {
934
+ uri: "rlx-ui://widgets",
935
+ mimeType: "application/json",
936
+ text: JSON.stringify(t, null, 2)
937
+ }
938
+ ]
939
+ };
940
+ }
941
+ ), s.registerResource(
942
+ "RLX UI Components",
943
+ "rlx-ui://components",
944
+ {
945
+ description: "List of all components in the RLX UI library",
946
+ mimeType: "application/json"
947
+ },
948
+ async () => {
949
+ const t = k();
950
+ return {
951
+ contents: [
952
+ {
953
+ uri: "rlx-ui://components",
954
+ mimeType: "application/json",
955
+ text: JSON.stringify(t, null, 2)
956
+ }
957
+ ]
958
+ };
959
+ }
960
+ ), s.registerResource(
961
+ "RLX UI Animates",
962
+ "rlx-ui://animates",
963
+ {
964
+ description: "List of all animations in the RLX UI library",
965
+ mimeType: "application/json"
966
+ },
967
+ async () => {
968
+ const t = v();
969
+ return {
970
+ contents: [
971
+ {
972
+ uri: "rlx-ui://animates",
973
+ mimeType: "application/json",
974
+ text: JSON.stringify(t, null, 2)
975
+ }
976
+ ]
977
+ };
978
+ }
979
+ ), s.registerResource(
980
+ "RLX UI Hooks",
981
+ "rlx-ui://hooks",
982
+ {
983
+ description: "List of all React hooks in the RLX UI library",
984
+ mimeType: "application/json"
985
+ },
986
+ async () => {
987
+ const t = S();
988
+ return {
989
+ contents: [
990
+ {
991
+ uri: "rlx-ui://hooks",
992
+ mimeType: "application/json",
993
+ text: JSON.stringify(t, null, 2)
994
+ }
995
+ ]
996
+ };
997
+ }
998
+ ), s.registerResource(
999
+ "RLX UI Utils",
1000
+ "rlx-ui://utils",
1001
+ {
1002
+ description: "List of all utility functions in the RLX UI library",
1003
+ mimeType: "application/json"
1004
+ },
1005
+ async () => {
1006
+ const t = C();
1007
+ return {
1008
+ contents: [
1009
+ {
1010
+ uri: "rlx-ui://utils",
1011
+ mimeType: "application/json",
1012
+ text: JSON.stringify(t, null, 2)
1013
+ }
1014
+ ]
1015
+ };
1016
+ }
1017
+ ), s.registerResource(
56
1018
  "RLX UI Information",
57
1019
  "rlx-ui://info",
58
1020
  {
59
1021
  description: "General information about RLX UI",
60
1022
  mimeType: "application/json"
61
1023
  },
62
- async () => ({
63
- contents: [
64
- {
65
- uri: "rlx-ui://info",
66
- mimeType: "application/json",
67
- text: JSON.stringify(
68
- {
69
- name: "RLX UI",
70
- description: "A UI component library",
71
- version: "0.0.1",
72
- mcpServer: "@rlx-ui/mcp"
73
- },
74
- null,
75
- 2
76
- )
77
- }
78
- ]
79
- })
1024
+ async () => {
1025
+ const t = b(), e = k(), n = v(), o = S(), r = C();
1026
+ return {
1027
+ contents: [
1028
+ {
1029
+ uri: "rlx-ui://info",
1030
+ mimeType: "application/json",
1031
+ text: JSON.stringify(
1032
+ {
1033
+ name: "RLX UI",
1034
+ description: "A comprehensive UI component library",
1035
+ version: "0.0.2",
1036
+ mcpServer: "@rlx-ui/mcp",
1037
+ stats: {
1038
+ widgets: t.length,
1039
+ components: e.length,
1040
+ animates: n.length,
1041
+ hooks: o.length,
1042
+ utils: r.length,
1043
+ total: t.length + e.length + n.length + o.length + r.length
1044
+ }
1045
+ },
1046
+ null,
1047
+ 2
1048
+ )
1049
+ }
1050
+ ]
1051
+ };
1052
+ }
80
1053
  );
81
- const r = new o();
82
- await e.connect(r), console.error("RLX UI MCP Server running on stdio");
1054
+ const i = new U();
1055
+ await s.connect(i), console.error("RLX UI MCP Server running on stdio");
83
1056
  }
84
- s().catch((e) => {
85
- console.error("Fatal error in main():", e), process.exit(1);
1057
+ H().catch((s) => {
1058
+ console.error("Fatal error in main():", s), process.exit(1);
86
1059
  });