@rlx-ui/mcp 0.0.3 → 0.0.5

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,270 +1,253 @@
1
- import { McpServer as x } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { StdioServerTransport as C } from "@modelcontextprotocol/sdk/server/stdio.js";
3
- import { z as a } from "zod";
4
- import { readFileSync as T } from "fs";
5
- import { fileURLToPath as L } from "url";
6
- import { join as m, dirname as R } from "path";
7
- const S = L(import.meta.url), f = R(S);
8
- let u = null;
9
- function l() {
10
- if (u)
11
- return u;
1
+ import { McpServer as L } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { StdioServerTransport as R } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import { z as c } from "zod";
4
+ import { promises as T, readFileSync as j } from "node:fs";
5
+ import { fileURLToPath as C } from "node:url";
6
+ import x, { join as p, dirname as S } from "node:path";
7
+ function l(s) {
8
+ return {
9
+ content: [
10
+ {
11
+ type: "text",
12
+ text: JSON.stringify(s, null, 2)
13
+ }
14
+ ]
15
+ };
16
+ }
17
+ function U(s, t, i) {
18
+ return l({
19
+ error: s,
20
+ ...t && { slug: t },
21
+ ...i && { category: i }
22
+ });
23
+ }
24
+ function d(s, t) {
25
+ return U("Component not found", s, t);
26
+ }
27
+ async function I(s) {
28
+ try {
29
+ return await T.readFile(s, "utf-8");
30
+ } catch {
31
+ return null;
32
+ }
33
+ }
34
+ const v = C(import.meta.url), f = S(v);
35
+ let m = null;
36
+ function u() {
37
+ if (m)
38
+ return m;
12
39
  try {
13
- const o = [
14
- m(f, "data/registry.json"),
40
+ const s = [
41
+ p(f, "data/registry.json"),
15
42
  // From dist/ to dist/data/ (copied during build)
16
- m(f, "../src/data/registry.json"),
43
+ p(f, "../src/data/registry.json"),
17
44
  // From dist/ to src/data/ (development)
18
- m(f, "../data/registry.json"),
45
+ p(f, "../data/registry.json"),
19
46
  // Fallback
20
- m(process.cwd(), "src/data/registry.json"),
47
+ p(process.cwd(), "src/data/registry.json"),
21
48
  // From package root (published)
22
- m(process.cwd(), "libs/rlx-ui/mcp/src/data/registry.json")
49
+ p(process.cwd(), "libs/rlx-ui/mcp/src/data/registry.json")
23
50
  // Development
24
51
  ];
25
- let s = null;
26
- for (const n of o)
52
+ let t = null;
53
+ for (const i of s)
27
54
  try {
28
- s = T(n, "utf-8");
55
+ t = j(i, "utf-8");
29
56
  break;
30
57
  } catch {
31
58
  continue;
32
59
  }
33
- if (!s)
60
+ if (!t)
34
61
  throw new Error("Could not find registry.json in any expected location");
35
- return u = JSON.parse(s), u;
36
- } catch (o) {
37
- return console.error("Warning: Could not load component registry:", o), u = {
62
+ return m = JSON.parse(t), m;
63
+ } catch (s) {
64
+ return console.error("Warning: Could not load component registry:", s), m = {
38
65
  widgets: [],
39
66
  components: [],
40
67
  animates: [],
41
68
  hooks: [],
42
69
  utils: [],
43
70
  extractedAt: (/* @__PURE__ */ new Date()).toISOString()
44
- }, u;
71
+ }, m;
45
72
  }
46
73
  }
47
- function j() {
48
- return l().widgets;
74
+ function _() {
75
+ return u().widgets;
49
76
  }
50
- function I() {
51
- return l().components;
77
+ function O() {
78
+ return u().components;
52
79
  }
53
- function U() {
54
- return l().animates;
80
+ function X() {
81
+ return u().animates;
55
82
  }
56
- function v() {
57
- return l().hooks;
83
+ function F() {
84
+ return u().hooks;
58
85
  }
59
- function _() {
60
- return l().utils;
86
+ function N() {
87
+ return u().utils;
61
88
  }
62
- function d(o, s) {
63
- const n = l();
64
- if (s === "widget" || !s) {
65
- const e = n.widgets.find((t) => t.slug === o);
89
+ function g(s, t) {
90
+ const i = u();
91
+ if (t === "widget" || !t) {
92
+ const e = i.widgets.find((n) => n.slug === s);
66
93
  if (e) return e;
67
94
  }
68
- if (s === "component" || !s) {
69
- const e = n.components.find((t) => t.slug === o);
95
+ if (t === "component" || !t) {
96
+ const e = i.components.find((n) => n.slug === s);
70
97
  if (e) return e;
71
98
  }
72
- if (s === "animate" || !s) {
73
- const e = n.animates.find((t) => t.slug === o);
99
+ if (t === "animate" || !t) {
100
+ const e = i.animates.find((n) => n.slug === s);
74
101
  if (e) return e;
75
102
  }
76
- if (s === "hook" || !s) {
77
- const e = n.hooks.find((t) => t.slug === o);
103
+ if (t === "hook" || !t) {
104
+ const e = i.hooks.find((n) => n.slug === s);
78
105
  if (e) return e;
79
106
  }
80
- if (s === "util" || !s) {
81
- const e = n.utils.find((t) => t.slug === o);
107
+ if (t === "util" || !t) {
108
+ const e = i.utils.find((n) => n.slug === s);
82
109
  if (e) return e;
83
110
  }
84
111
  }
85
- function O(o) {
86
- const s = l(), n = [
87
- ...s.widgets,
88
- ...s.components,
89
- ...s.animates,
90
- ...s.hooks,
91
- ...s.utils
92
- ], e = o.toLowerCase();
93
- return n.filter(
94
- (t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e)
112
+ function J(s) {
113
+ const t = u(), i = [
114
+ ...t.widgets,
115
+ ...t.components,
116
+ ...t.animates,
117
+ ...t.hooks,
118
+ ...t.utils
119
+ ], e = s.toLowerCase();
120
+ return i.filter(
121
+ (n) => n.name.toLowerCase().includes(e) || n.slug.toLowerCase().includes(e)
95
122
  );
96
123
  }
97
124
  function h() {
98
- return j();
125
+ return _();
99
126
  }
100
127
  function y() {
101
- return I();
128
+ return O();
102
129
  }
103
130
  function b() {
104
- return U();
131
+ return X();
105
132
  }
106
133
  function k() {
107
- return v();
134
+ return F();
108
135
  }
109
136
  function w() {
110
- return _();
137
+ return N();
111
138
  }
112
- function X(o) {
113
- return O(o);
139
+ function $(s) {
140
+ return J(s);
114
141
  }
115
- function F(o, s) {
116
- return d(o, s) || null;
142
+ function M(s, t) {
143
+ return g(s, t) || null;
117
144
  }
118
- function N(o, s) {
119
- const n = d(o, s);
120
- if (!n)
121
- return { found: !1 };
122
- let e, t;
123
- if (n.sourceCode && typeof n.sourceCode == "string") {
124
- const r = n.sourceCode;
125
- if (n.sourceFiles && Object.keys(n.sourceFiles).length > 0) {
126
- const g = Object.keys(n.sourceFiles).join(", ");
127
- t = `This component has ${Object.keys(n.sourceFiles).length} related file(s): ${g}. Use get_component_source to get the complete codebase.`;
128
- }
129
- const i = r.match(
130
- /(?:export\s+)?(?:interface|type)\s+(\w+Props?)\s*[=:]\s*\{[\s\S]*?\}/g
131
- );
132
- i && i.length > 0 ? e = i[0] : r.trim().startsWith("export") ? t = "Source code contains only export statements. Props definition may be in component file." : (e = r.substring(0, 1e3), t = "Full source code provided. Props interface may be defined in the component file.");
133
- } else
134
- t = "Source code not available in registry.";
135
- return {
136
- found: !0,
137
- component: n,
138
- props: e,
139
- note: t
140
- };
141
- }
142
- function $(o, s, n) {
143
- var r;
144
- const e = d(o, s);
145
+ function q(s, t, i) {
146
+ var o;
147
+ const e = g(s, t);
145
148
  if (!e)
146
149
  return { found: !1 };
147
- const t = [];
148
- if (e.demos && e.demos.forEach((i) => {
149
- t.push({ name: i.name });
150
- }), n) {
151
- const i = (r = e.demos) == null ? void 0 : r.find((g) => g.name === n);
152
- return i && i.code ? {
150
+ const n = [];
151
+ if (e.demos && e.demos.forEach((r) => {
152
+ n.push({ name: r.name });
153
+ }), i) {
154
+ const r = (o = e.demos) == null ? void 0 : o.find((a) => a.name === i);
155
+ return r && r.code ? {
153
156
  found: !0,
154
157
  component: e,
155
158
  example: {
156
- name: i.name,
157
- code: i.code
159
+ name: r.name,
160
+ code: r.code
158
161
  },
159
- availableDemos: t
162
+ availableDemos: n
160
163
  } : {
161
164
  found: !0,
162
165
  component: e,
163
- availableDemos: t
166
+ availableDemos: n
164
167
  };
165
168
  }
166
169
  if (e.demos && e.demos.length > 0) {
167
- const i = e.demos[0];
168
- if (i.code)
170
+ const r = e.demos[0];
171
+ if (r.code)
169
172
  return {
170
173
  found: !0,
171
174
  component: e,
172
175
  example: {
173
- name: i.name,
174
- code: i.code
176
+ name: r.name,
177
+ code: r.code
175
178
  },
176
- availableDemos: t
179
+ availableDemos: n
177
180
  };
178
181
  }
179
182
  return {
180
183
  found: !0,
181
184
  component: e,
182
- availableDemos: t
185
+ availableDemos: n
183
186
  };
184
187
  }
185
- function P(o, s, n = "pnpm") {
186
- const e = d(o, s);
188
+ function A(s, t, i = "pnpm") {
189
+ const e = g(s, t);
187
190
  if (!e)
188
191
  return { found: !1 };
189
- let t;
192
+ let n;
190
193
  switch (e.category) {
191
194
  case "widget":
192
- t = `@rlx-widgets/${e.slug}`;
195
+ n = `@rlx-widgets/${e.slug}`;
193
196
  break;
194
197
  case "component":
195
- t = `@rlx-components/${e.slug}`;
198
+ n = `@rlx-components/${e.slug}`;
196
199
  break;
197
200
  case "hook":
198
- t = `@rlx-hooks/${e.slug}`;
201
+ n = `@rlx-hooks/${e.slug}`;
199
202
  break;
200
203
  case "util":
201
- t = `@rlx-utils/${e.slug}`;
204
+ n = `@rlx-utils/${e.slug}`;
202
205
  break;
203
206
  case "animate":
204
- t = `@rlx-animates/${e.slug}`;
207
+ n = `@rlx-animates/${e.slug}`;
205
208
  break;
206
209
  default:
207
210
  return { found: !1 };
208
211
  }
209
- let r;
210
- switch (n) {
212
+ let o;
213
+ switch (i) {
211
214
  case "npm":
212
- r = `npm install ${t}`;
215
+ o = `npm install ${n}`;
213
216
  break;
214
217
  case "pnpm":
215
- r = `pnpm add ${t}`;
218
+ o = `pnpm add ${n}`;
216
219
  break;
217
220
  case "yarn":
218
- r = `yarn add ${t}`;
221
+ o = `yarn add ${n}`;
219
222
  break;
220
223
  default:
221
- r = `pnpm add ${t}`;
224
+ o = `pnpm add ${n}`;
222
225
  }
223
226
  return {
224
227
  found: !0,
225
- command: r,
226
- packageName: t,
228
+ command: o,
229
+ packageName: n,
227
230
  category: e.category
228
231
  };
229
232
  }
230
- function J(o, s) {
231
- const n = d(o, s);
232
- return n ? n.sourceCode && typeof n.sourceCode == "string" ? {
233
+ function D(s, t) {
234
+ const i = g(s, t);
235
+ return i ? i.sourceCode && typeof i.sourceCode == "string" ? {
233
236
  found: !0,
234
- component: n,
235
- sourceCode: n.sourceCode,
236
- sourceFiles: n.sourceFiles || {}
237
+ component: i,
238
+ sourceCode: i.sourceCode,
239
+ sourceFiles: i.sourceFiles || {}
237
240
  } : {
238
241
  found: !0,
239
- component: n,
240
- sourceFiles: n.sourceFiles || {}
242
+ component: i,
243
+ sourceFiles: i.sourceFiles || {}
241
244
  } : { found: !1 };
242
245
  }
243
- function c(o) {
244
- return {
245
- content: [
246
- {
247
- type: "text",
248
- text: JSON.stringify(o, null, 2)
249
- }
250
- ]
251
- };
252
- }
253
- function M(o, s, n) {
254
- return c({
255
- error: o,
256
- ...s && { slug: s },
257
- ...n && { category: n }
258
- });
259
- }
260
- function p(o, s) {
261
- return M("Component not found", o, s);
262
- }
263
- async function G() {
264
- const o = new x(
246
+ async function E() {
247
+ const s = await G(), t = new L(
265
248
  {
266
249
  name: "@rlx-ui/mcp",
267
- version: "0.0.3"
250
+ version: s
268
251
  },
269
252
  {
270
253
  capabilities: {
@@ -273,237 +256,223 @@ async function G() {
273
256
  }
274
257
  }
275
258
  );
276
- o.registerTool(
259
+ t.registerTool(
277
260
  "list_widgets",
278
261
  {
279
262
  description: "List all available widgets in the RLX UI library"
280
263
  },
281
264
  async () => {
282
- const n = h();
283
- return c({
284
- count: n.length,
285
- widgets: n.map((e) => {
286
- var t;
265
+ const e = h();
266
+ return l({
267
+ count: e.length,
268
+ widgets: e.map((n) => {
269
+ var o;
287
270
  return {
288
- name: e.name,
289
- slug: e.slug,
290
- demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0
271
+ name: n.name,
272
+ slug: n.slug,
273
+ demosCount: ((o = n.demos) == null ? void 0 : o.length) ?? 0
291
274
  };
292
275
  })
293
276
  });
294
277
  }
295
- ), o.registerTool(
278
+ ), t.registerTool(
296
279
  "list_components",
297
280
  {
298
281
  description: "List all available components in the RLX UI library"
299
282
  },
300
283
  async () => {
301
- const n = y();
302
- return c({
303
- count: n.length,
304
- components: n.map((e) => {
305
- var t;
284
+ const e = y();
285
+ return l({
286
+ count: e.length,
287
+ components: e.map((n) => {
288
+ var o;
306
289
  return {
307
- name: e.name,
308
- slug: e.slug,
309
- demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0
290
+ name: n.name,
291
+ slug: n.slug,
292
+ demosCount: ((o = n.demos) == null ? void 0 : o.length) ?? 0
310
293
  };
311
294
  })
312
295
  });
313
296
  }
314
- ), o.registerTool(
297
+ ), t.registerTool(
315
298
  "list_animates",
316
299
  {
317
300
  description: "List all available animations in the RLX UI library"
318
301
  },
319
302
  async () => {
320
- const n = b();
321
- return c({
322
- count: n.length,
323
- animates: n.map((e) => {
324
- var t;
303
+ const e = b();
304
+ return l({
305
+ count: e.length,
306
+ animates: e.map((n) => {
307
+ var o;
325
308
  return {
326
- name: e.name,
327
- slug: e.slug,
328
- demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0
309
+ name: n.name,
310
+ slug: n.slug,
311
+ demosCount: ((o = n.demos) == null ? void 0 : o.length) ?? 0
329
312
  };
330
313
  })
331
314
  });
332
315
  }
333
- ), o.registerTool(
316
+ ), t.registerTool(
334
317
  "list_hooks",
335
318
  {
336
319
  description: "List all available React hooks in the RLX UI library"
337
320
  },
338
321
  async () => {
339
- const n = k();
340
- return c({
341
- count: n.length,
342
- hooks: n.map((e) => {
343
- var t;
322
+ const e = k();
323
+ return l({
324
+ count: e.length,
325
+ hooks: e.map((n) => {
326
+ var o;
344
327
  return {
345
- name: e.name,
346
- slug: e.slug,
347
- demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0
328
+ name: n.name,
329
+ slug: n.slug,
330
+ demosCount: ((o = n.demos) == null ? void 0 : o.length) ?? 0
348
331
  };
349
332
  })
350
333
  });
351
334
  }
352
- ), o.registerTool(
335
+ ), t.registerTool(
353
336
  "list_utils",
354
337
  {
355
338
  description: "List all available utility functions in the RLX UI library"
356
339
  },
357
340
  async () => {
358
- const n = w();
359
- return c({
360
- count: n.length,
361
- utils: n.map((e) => {
362
- var t;
341
+ const e = w();
342
+ return l({
343
+ count: e.length,
344
+ utils: e.map((n) => {
345
+ var o;
363
346
  return {
364
- name: e.name,
365
- slug: e.slug,
366
- demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0
347
+ name: n.name,
348
+ slug: n.slug,
349
+ demosCount: ((o = n.demos) == null ? void 0 : o.length) ?? 0
367
350
  };
368
351
  })
369
352
  });
370
353
  }
371
- ), o.registerTool(
354
+ ), t.registerTool(
372
355
  "search_component",
373
356
  {
374
357
  description: "Search for components, widgets, hooks, utils, or animates by name or slug",
375
358
  inputSchema: {
376
- query: a.string().describe("Search query to find components")
359
+ query: c.string().describe("Search query to find components")
377
360
  }
378
361
  },
379
- async (n) => {
380
- const e = X(n.query);
381
- return c({
382
- query: n.query,
383
- count: e.length,
384
- results: e.map((t) => ({
385
- name: t.name,
386
- slug: t.slug,
387
- category: t.category
362
+ async (e) => {
363
+ const n = $(e.query);
364
+ return l({
365
+ query: e.query,
366
+ count: n.length,
367
+ results: n.map((o) => ({
368
+ name: o.name,
369
+ slug: o.slug,
370
+ category: o.category
388
371
  }))
389
372
  });
390
373
  }
391
- ), o.registerTool(
374
+ ), t.registerTool(
392
375
  "get_component_info",
393
376
  {
394
377
  description: "Get detailed information about a specific component, widget, hook, util, or animate",
395
378
  inputSchema: {
396
- slug: a.string().describe("The slug/name of the component (e.g., 'button', 'use-copy-to-clipboard')"),
397
- category: a.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search")
379
+ slug: c.string().describe(
380
+ "The slug/name of the component (e.g., 'button', 'use-copy-to-clipboard')"
381
+ ),
382
+ category: c.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search")
398
383
  }
399
384
  },
400
- async (n) => {
401
- var t, r;
402
- const e = F(n.slug, n.category);
403
- return e ? c({
404
- name: e.name,
405
- slug: e.slug,
406
- category: e.category,
407
- hasSourceCode: !!e.sourceCode && typeof e.sourceCode == "string",
408
- demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0,
409
- demos: (r = e.demos) == null ? void 0 : r.map((i) => ({
410
- name: i.name,
411
- hasCode: !!i.code
385
+ async (e) => {
386
+ var o, r;
387
+ const n = M(e.slug, e.category);
388
+ return n ? l({
389
+ name: n.name,
390
+ slug: n.slug,
391
+ category: n.category,
392
+ hasSourceCode: !!n.sourceCode && typeof n.sourceCode == "string",
393
+ demosCount: ((o = n.demos) == null ? void 0 : o.length) ?? 0,
394
+ demos: (r = n.demos) == null ? void 0 : r.map((a) => ({
395
+ name: a.name,
396
+ hasCode: !!a.code
412
397
  }))
413
- }) : p(n.slug, n.category);
398
+ }) : d(e.slug, e.category);
414
399
  }
415
- ), o.registerTool(
416
- "get_component_props",
417
- {
418
- description: "Get TypeScript props/interface definition for a component",
419
- inputSchema: {
420
- slug: a.string().describe("The slug/name of the component"),
421
- category: a.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search")
422
- }
423
- },
424
- async (n) => {
425
- var t, r, i;
426
- const e = N(n.slug, n.category);
427
- return e.found ? c({
428
- component: {
429
- name: (t = e.component) == null ? void 0 : t.name,
430
- slug: (r = e.component) == null ? void 0 : r.slug,
431
- category: (i = e.component) == null ? void 0 : i.category
432
- },
433
- props: e.props,
434
- note: e.note
435
- }) : p(n.slug, n.category);
436
- }
437
- ), o.registerTool(
400
+ ), t.registerTool(
438
401
  "get_component_example",
439
402
  {
440
403
  description: "Get code examples (demos) for a component",
441
404
  inputSchema: {
442
- slug: a.string().describe("The slug/name of the component"),
443
- category: a.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search"),
444
- exampleName: a.string().optional().describe("Optional specific example/variant name. If not provided, returns the first available example.")
405
+ slug: c.string().describe("The slug/name of the component"),
406
+ category: c.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search"),
407
+ exampleName: c.string().optional().describe(
408
+ "Optional specific example/variant name. If not provided, returns the first available example."
409
+ )
445
410
  }
446
411
  },
447
- async (n) => {
448
- var t, r, i;
449
- const e = $(n.slug, n.category, n.exampleName);
450
- return e.found ? c({
412
+ async (e) => {
413
+ var o, r, a;
414
+ const n = q(
415
+ e.slug,
416
+ e.category,
417
+ e.exampleName
418
+ );
419
+ return n.found ? l({
451
420
  component: {
452
- name: (t = e.component) == null ? void 0 : t.name,
453
- slug: (r = e.component) == null ? void 0 : r.slug,
454
- category: (i = e.component) == null ? void 0 : i.category
421
+ name: (o = n.component) == null ? void 0 : o.name,
422
+ slug: (r = n.component) == null ? void 0 : r.slug,
423
+ category: (a = n.component) == null ? void 0 : a.category
455
424
  },
456
- example: e.example,
457
- availableDemos: e.availableDemos
458
- }) : p(n.slug, n.category);
425
+ example: n.example,
426
+ availableDemos: n.availableDemos
427
+ }) : d(e.slug, e.category);
459
428
  }
460
- ), o.registerTool(
429
+ ), t.registerTool(
461
430
  "get_component_source",
462
431
  {
463
432
  description: "Get the complete source code for a component, including main file and all related files (utils, types, etc.)",
464
433
  inputSchema: {
465
- slug: a.string().describe("The slug/name of the component"),
466
- category: a.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search")
434
+ slug: c.string().describe("The slug/name of the component"),
435
+ category: c.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search")
467
436
  }
468
437
  },
469
- async (n) => {
470
- var t, r, i;
471
- const e = J(n.slug, n.category);
472
- return e.found ? c({
438
+ async (e) => {
439
+ var o, r, a;
440
+ const n = D(e.slug, e.category);
441
+ return n.found ? l({
473
442
  component: {
474
- name: (t = e.component) == null ? void 0 : t.name,
475
- slug: (r = e.component) == null ? void 0 : r.slug,
476
- category: (i = e.component) == null ? void 0 : i.category
443
+ name: (o = n.component) == null ? void 0 : o.name,
444
+ slug: (r = n.component) == null ? void 0 : r.slug,
445
+ category: (a = n.component) == null ? void 0 : a.category
477
446
  },
478
- sourceCode: e.sourceCode,
479
- sourceFiles: e.sourceFiles,
480
- note: e.sourceFiles && Object.keys(e.sourceFiles).length > 0 ? `This component has ${Object.keys(e.sourceFiles).length} related file(s). The main file is in sourceCode, and related files (utils, types, etc.) are in sourceFiles with relative paths as keys.` : "This component has no related files."
481
- }) : p(n.slug, n.category);
447
+ sourceCode: n.sourceCode,
448
+ sourceFiles: n.sourceFiles,
449
+ note: n.sourceFiles && Object.keys(n.sourceFiles).length > 0 ? `This component has ${Object.keys(n.sourceFiles).length} related file(s). The main file is in sourceCode, and related files (utils, types, etc.) are in sourceFiles with relative paths as keys.` : "This component has no related files."
450
+ }) : d(e.slug, e.category);
482
451
  }
483
- ), o.registerTool(
452
+ ), t.registerTool(
484
453
  "get_installation_command",
485
454
  {
486
455
  description: "Get npm/pnpm/yarn installation command for a component",
487
456
  inputSchema: {
488
- slug: a.string().describe("The slug/name of the component"),
489
- category: a.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search"),
490
- packageManager: a.enum(["npm", "pnpm", "yarn"]).optional().default("pnpm").describe("Package manager to use (default: pnpm)")
457
+ slug: c.string().describe("The slug/name of the component"),
458
+ category: c.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search"),
459
+ packageManager: c.enum(["npm", "pnpm", "yarn"]).optional().default("pnpm").describe("Package manager to use (default: pnpm)")
491
460
  }
492
461
  },
493
- async (n) => {
494
- const e = P(
495
- n.slug,
496
- n.category,
497
- n.packageManager || "pnpm"
462
+ async (e) => {
463
+ const n = A(
464
+ e.slug,
465
+ e.category,
466
+ e.packageManager || "pnpm"
498
467
  );
499
- return e.found ? c({
500
- command: e.command,
501
- packageName: e.packageName,
502
- category: e.category,
503
- packageManager: n.packageManager || "pnpm"
504
- }) : p(n.slug, n.category);
468
+ return n.found ? l({
469
+ command: n.command,
470
+ packageName: n.packageName,
471
+ category: n.category,
472
+ packageManager: e.packageManager || "pnpm"
473
+ }) : d(e.slug, e.category);
505
474
  }
506
- ), o.registerResource(
475
+ ), t.registerResource(
507
476
  "RLX UI Widgets",
508
477
  "rlx-ui://widgets",
509
478
  {
@@ -511,18 +480,18 @@ async function G() {
511
480
  mimeType: "application/json"
512
481
  },
513
482
  async () => {
514
- const n = h();
483
+ const e = h();
515
484
  return {
516
485
  contents: [
517
486
  {
518
487
  uri: "rlx-ui://widgets",
519
488
  mimeType: "application/json",
520
- text: JSON.stringify(n, null, 2)
489
+ text: JSON.stringify(e, null, 2)
521
490
  }
522
491
  ]
523
492
  };
524
493
  }
525
- ), o.registerResource(
494
+ ), t.registerResource(
526
495
  "RLX UI Components",
527
496
  "rlx-ui://components",
528
497
  {
@@ -530,18 +499,18 @@ async function G() {
530
499
  mimeType: "application/json"
531
500
  },
532
501
  async () => {
533
- const n = y();
502
+ const e = y();
534
503
  return {
535
504
  contents: [
536
505
  {
537
506
  uri: "rlx-ui://components",
538
507
  mimeType: "application/json",
539
- text: JSON.stringify(n, null, 2)
508
+ text: JSON.stringify(e, null, 2)
540
509
  }
541
510
  ]
542
511
  };
543
512
  }
544
- ), o.registerResource(
513
+ ), t.registerResource(
545
514
  "RLX UI Animates",
546
515
  "rlx-ui://animates",
547
516
  {
@@ -549,18 +518,18 @@ async function G() {
549
518
  mimeType: "application/json"
550
519
  },
551
520
  async () => {
552
- const n = b();
521
+ const e = b();
553
522
  return {
554
523
  contents: [
555
524
  {
556
525
  uri: "rlx-ui://animates",
557
526
  mimeType: "application/json",
558
- text: JSON.stringify(n, null, 2)
527
+ text: JSON.stringify(e, null, 2)
559
528
  }
560
529
  ]
561
530
  };
562
531
  }
563
- ), o.registerResource(
532
+ ), t.registerResource(
564
533
  "RLX UI Hooks",
565
534
  "rlx-ui://hooks",
566
535
  {
@@ -568,18 +537,18 @@ async function G() {
568
537
  mimeType: "application/json"
569
538
  },
570
539
  async () => {
571
- const n = k();
540
+ const e = k();
572
541
  return {
573
542
  contents: [
574
543
  {
575
544
  uri: "rlx-ui://hooks",
576
545
  mimeType: "application/json",
577
- text: JSON.stringify(n, null, 2)
546
+ text: JSON.stringify(e, null, 2)
578
547
  }
579
548
  ]
580
549
  };
581
550
  }
582
- ), o.registerResource(
551
+ ), t.registerResource(
583
552
  "RLX UI Utils",
584
553
  "rlx-ui://utils",
585
554
  {
@@ -587,18 +556,18 @@ async function G() {
587
556
  mimeType: "application/json"
588
557
  },
589
558
  async () => {
590
- const n = w();
559
+ const e = w();
591
560
  return {
592
561
  contents: [
593
562
  {
594
563
  uri: "rlx-ui://utils",
595
564
  mimeType: "application/json",
596
- text: JSON.stringify(n, null, 2)
565
+ text: JSON.stringify(e, null, 2)
597
566
  }
598
567
  ]
599
568
  };
600
569
  }
601
- ), o.registerResource(
570
+ ), t.registerResource(
602
571
  "RLX UI Information",
603
572
  "rlx-ui://info",
604
573
  {
@@ -606,7 +575,7 @@ async function G() {
606
575
  mimeType: "application/json"
607
576
  },
608
577
  async () => {
609
- const n = h(), e = y(), t = b(), r = k(), i = w();
578
+ const e = h(), n = y(), o = b(), r = k(), a = w();
610
579
  return {
611
580
  contents: [
612
581
  {
@@ -616,15 +585,15 @@ async function G() {
616
585
  {
617
586
  name: "RLX UI",
618
587
  description: "A comprehensive UI component library",
619
- version: "0.0.3",
588
+ version: s,
620
589
  mcpServer: "@rlx-ui/mcp",
621
590
  stats: {
622
- widgets: n.length,
623
- components: e.length,
624
- animates: t.length,
591
+ widgets: e.length,
592
+ components: n.length,
593
+ animates: o.length,
625
594
  hooks: r.length,
626
- utils: i.length,
627
- total: n.length + e.length + t.length + r.length + i.length
595
+ utils: a.length,
596
+ total: e.length + n.length + o.length + r.length + a.length
628
597
  }
629
598
  },
630
599
  null,
@@ -635,9 +604,20 @@ async function G() {
635
604
  };
636
605
  }
637
606
  );
638
- const s = new C();
639
- await o.connect(s), console.error("RLX UI MCP Server running on stdio");
607
+ const i = new R();
608
+ await t.connect(i), console.error("RLX UI MCP Server running on stdio");
609
+ }
610
+ async function G() {
611
+ const s = C(import.meta.url), t = x.dirname(s), i = await I(
612
+ x.join(t, "..", "package.json")
613
+ );
614
+ if (!i)
615
+ throw new Error("Unable to find package.json");
616
+ const n = JSON.parse(i).version;
617
+ if (!n)
618
+ throw new Error("Unable to read version from package.json");
619
+ return n;
640
620
  }
641
- G().catch((o) => {
642
- console.error("Fatal error in main():", o), process.exit(1);
621
+ E().catch((s) => {
622
+ console.error("Fatal error in main():", s), process.exit(1);
643
623
  });