@rlx-ui/mcp 0.0.11 → 0.0.13
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 +204 -137
- package/dist/data/registry.json +90 -3
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
import { McpServer as L } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { StdioServerTransport as
|
|
3
|
-
import { z as
|
|
4
|
-
import { promises as
|
|
5
|
-
import { fileURLToPath as
|
|
6
|
-
import
|
|
7
|
-
function
|
|
2
|
+
import { StdioServerTransport as S } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { z as l } from "zod";
|
|
4
|
+
import { promises as U, readFileSync as I } from "node:fs";
|
|
5
|
+
import { fileURLToPath as R } from "node:url";
|
|
6
|
+
import C, { join as p, dirname as j } from "node:path";
|
|
7
|
+
function c(o) {
|
|
8
8
|
return {
|
|
9
9
|
content: [
|
|
10
10
|
{
|
|
11
11
|
type: "text",
|
|
12
|
-
text: JSON.stringify(
|
|
12
|
+
text: JSON.stringify(o, null, 2)
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
19
|
-
error:
|
|
17
|
+
function _(o, t, i) {
|
|
18
|
+
return c({
|
|
19
|
+
error: o,
|
|
20
20
|
...t && { slug: t },
|
|
21
21
|
...i && { category: i }
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function g(o, t) {
|
|
25
|
+
return _("Component not found", o, t);
|
|
26
26
|
}
|
|
27
|
-
async function
|
|
27
|
+
async function O(o) {
|
|
28
28
|
try {
|
|
29
|
-
return await
|
|
29
|
+
return await U.readFile(o, "utf-8");
|
|
30
30
|
} catch {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const X = R(import.meta.url), h = j(X);
|
|
35
35
|
let m = null;
|
|
36
36
|
function u() {
|
|
37
37
|
if (m)
|
|
38
38
|
return m;
|
|
39
39
|
try {
|
|
40
|
-
const
|
|
41
|
-
p(
|
|
40
|
+
const o = [
|
|
41
|
+
p(h, "data/registry.json"),
|
|
42
42
|
// From dist/ to dist/data/ (copied during build)
|
|
43
|
-
p(
|
|
43
|
+
p(h, "../src/data/registry.json"),
|
|
44
44
|
// From dist/ to src/data/ (development)
|
|
45
|
-
p(
|
|
45
|
+
p(h, "../data/registry.json"),
|
|
46
46
|
// Fallback
|
|
47
47
|
p(process.cwd(), "src/data/registry.json"),
|
|
48
48
|
// From package root (published)
|
|
@@ -50,9 +50,9 @@ function u() {
|
|
|
50
50
|
// Development
|
|
51
51
|
];
|
|
52
52
|
let t = null;
|
|
53
|
-
for (const i of
|
|
53
|
+
for (const i of o)
|
|
54
54
|
try {
|
|
55
|
-
t =
|
|
55
|
+
t = I(i, "utf-8");
|
|
56
56
|
break;
|
|
57
57
|
} catch {
|
|
58
58
|
continue;
|
|
@@ -60,8 +60,8 @@ function u() {
|
|
|
60
60
|
if (!t)
|
|
61
61
|
throw new Error("Could not find registry.json in any expected location");
|
|
62
62
|
return m = JSON.parse(t), m;
|
|
63
|
-
} catch (
|
|
64
|
-
return console.error("Warning: Could not load component registry:",
|
|
63
|
+
} catch (o) {
|
|
64
|
+
return console.error("Warning: Could not load component registry:", o), m = {
|
|
65
65
|
widgets: [],
|
|
66
66
|
components: [],
|
|
67
67
|
animates: [],
|
|
@@ -71,87 +71,111 @@ function u() {
|
|
|
71
71
|
}, m;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function F() {
|
|
75
75
|
return u().widgets;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function N() {
|
|
78
78
|
return u().components;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function J() {
|
|
81
81
|
return u().animates;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function V() {
|
|
84
84
|
return u().hooks;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function $() {
|
|
87
87
|
return u().utils;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function f(o, t) {
|
|
90
90
|
const i = u();
|
|
91
91
|
if (t === "widget" || !t) {
|
|
92
|
-
const e = i.widgets.find((n) => n.slug ===
|
|
92
|
+
const e = i.widgets.find((n) => n.slug === o);
|
|
93
93
|
if (e) return e;
|
|
94
94
|
}
|
|
95
95
|
if (t === "component" || !t) {
|
|
96
|
-
const e = i.components.find((n) => n.slug ===
|
|
96
|
+
const e = i.components.find((n) => n.slug === o);
|
|
97
97
|
if (e) return e;
|
|
98
98
|
}
|
|
99
99
|
if (t === "animate" || !t) {
|
|
100
|
-
const e = i.animates.find((n) => n.slug ===
|
|
100
|
+
const e = i.animates.find((n) => n.slug === o);
|
|
101
101
|
if (e) return e;
|
|
102
102
|
}
|
|
103
103
|
if (t === "hook" || !t) {
|
|
104
|
-
const e = i.hooks.find((n) => n.slug ===
|
|
104
|
+
const e = i.hooks.find((n) => n.slug === o);
|
|
105
105
|
if (e) return e;
|
|
106
106
|
}
|
|
107
107
|
if (t === "util" || !t) {
|
|
108
|
-
const e = i.utils.find((n) => n.slug ===
|
|
108
|
+
const e = i.utils.find((n) => n.slug === o);
|
|
109
109
|
if (e) return e;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function M(o) {
|
|
113
113
|
const t = u(), i = [
|
|
114
114
|
...t.widgets,
|
|
115
115
|
...t.components,
|
|
116
116
|
...t.animates,
|
|
117
117
|
...t.hooks,
|
|
118
118
|
...t.utils
|
|
119
|
-
], e =
|
|
119
|
+
], e = o.toLowerCase();
|
|
120
120
|
return i.filter(
|
|
121
121
|
(n) => n.name.toLowerCase().includes(e) || n.slug.toLowerCase().includes(e)
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
async function A() {
|
|
125
|
+
try {
|
|
126
|
+
const o = await fetch("https://registry.npmjs.org/@rlx-ui/mcp/latest");
|
|
127
|
+
return o.ok && (await o.json()).version || null;
|
|
128
|
+
} catch {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
129
131
|
}
|
|
130
|
-
function
|
|
131
|
-
|
|
132
|
+
async function y(o) {
|
|
133
|
+
const t = await A();
|
|
134
|
+
if (!t)
|
|
135
|
+
return {
|
|
136
|
+
installedVersion: o,
|
|
137
|
+
latestVersion: null,
|
|
138
|
+
needsUpdate: !1
|
|
139
|
+
};
|
|
140
|
+
const i = o !== t;
|
|
141
|
+
return {
|
|
142
|
+
installedVersion: o,
|
|
143
|
+
latestVersion: t,
|
|
144
|
+
needsUpdate: i,
|
|
145
|
+
warning: i ? `⚠️ WARNING: You are using @rlx-ui/mcp version ${o}, but version ${t} is available. Please update by running: npm update -g @rlx-ui/mcp or npx @rlx-ui/mcp@latest` : void 0
|
|
146
|
+
};
|
|
132
147
|
}
|
|
133
|
-
function
|
|
148
|
+
function w() {
|
|
134
149
|
return F();
|
|
135
150
|
}
|
|
136
|
-
function
|
|
151
|
+
function k() {
|
|
137
152
|
return N();
|
|
138
153
|
}
|
|
139
|
-
function
|
|
140
|
-
return J(
|
|
154
|
+
function b() {
|
|
155
|
+
return J();
|
|
156
|
+
}
|
|
157
|
+
function x() {
|
|
158
|
+
return V();
|
|
159
|
+
}
|
|
160
|
+
function v() {
|
|
161
|
+
return $();
|
|
162
|
+
}
|
|
163
|
+
function P(o) {
|
|
164
|
+
return M(o);
|
|
141
165
|
}
|
|
142
|
-
function
|
|
143
|
-
return
|
|
166
|
+
function W(o, t) {
|
|
167
|
+
return f(o, t) || null;
|
|
144
168
|
}
|
|
145
|
-
function
|
|
146
|
-
var
|
|
147
|
-
const e =
|
|
169
|
+
function G(o, t, i) {
|
|
170
|
+
var s;
|
|
171
|
+
const e = f(o, t);
|
|
148
172
|
if (!e)
|
|
149
173
|
return { found: !1 };
|
|
150
174
|
const n = [];
|
|
151
175
|
if (e.demos && e.demos.forEach((r) => {
|
|
152
176
|
n.push({ name: r.name });
|
|
153
177
|
}), i) {
|
|
154
|
-
const r = (
|
|
178
|
+
const r = (s = e.demos) == null ? void 0 : s.find((a) => a.name === i);
|
|
155
179
|
return r && r.code ? {
|
|
156
180
|
found: !0,
|
|
157
181
|
component: e,
|
|
@@ -185,8 +209,8 @@ function q(s, t, i) {
|
|
|
185
209
|
availableDemos: n
|
|
186
210
|
};
|
|
187
211
|
}
|
|
188
|
-
function
|
|
189
|
-
const e =
|
|
212
|
+
function q(o, t, i = "pnpm") {
|
|
213
|
+
const e = f(o, t);
|
|
190
214
|
if (!e)
|
|
191
215
|
return { found: !1 };
|
|
192
216
|
let n;
|
|
@@ -209,29 +233,29 @@ function A(s, t, i = "pnpm") {
|
|
|
209
233
|
default:
|
|
210
234
|
return { found: !1 };
|
|
211
235
|
}
|
|
212
|
-
let
|
|
236
|
+
let s;
|
|
213
237
|
switch (i) {
|
|
214
238
|
case "npm":
|
|
215
|
-
|
|
239
|
+
s = `npm install ${n}`;
|
|
216
240
|
break;
|
|
217
241
|
case "pnpm":
|
|
218
|
-
|
|
242
|
+
s = `pnpm add ${n}`;
|
|
219
243
|
break;
|
|
220
244
|
case "yarn":
|
|
221
|
-
|
|
245
|
+
s = `yarn add ${n}`;
|
|
222
246
|
break;
|
|
223
247
|
default:
|
|
224
|
-
|
|
248
|
+
s = `pnpm add ${n}`;
|
|
225
249
|
}
|
|
226
250
|
return {
|
|
227
251
|
found: !0,
|
|
228
|
-
command:
|
|
252
|
+
command: s,
|
|
229
253
|
packageName: n,
|
|
230
254
|
category: e.category
|
|
231
255
|
};
|
|
232
256
|
}
|
|
233
|
-
function D(
|
|
234
|
-
const i =
|
|
257
|
+
function D(o, t) {
|
|
258
|
+
const i = f(o, t);
|
|
235
259
|
return i ? i.sourceCode && typeof i.sourceCode == "string" ? {
|
|
236
260
|
found: !0,
|
|
237
261
|
component: i,
|
|
@@ -244,10 +268,10 @@ function D(s, t) {
|
|
|
244
268
|
} : { found: !1 };
|
|
245
269
|
}
|
|
246
270
|
async function E() {
|
|
247
|
-
const
|
|
271
|
+
const o = await T(), t = new L(
|
|
248
272
|
{
|
|
249
273
|
name: "@rlx-ui/mcp",
|
|
250
|
-
version:
|
|
274
|
+
version: o
|
|
251
275
|
},
|
|
252
276
|
{
|
|
253
277
|
capabilities: {
|
|
@@ -262,15 +286,15 @@ async function E() {
|
|
|
262
286
|
description: "List all available widgets in the RLX UI library"
|
|
263
287
|
},
|
|
264
288
|
async () => {
|
|
265
|
-
const e =
|
|
266
|
-
return
|
|
289
|
+
const e = w();
|
|
290
|
+
return c({
|
|
267
291
|
count: e.length,
|
|
268
292
|
widgets: e.map((n) => {
|
|
269
|
-
var
|
|
293
|
+
var s;
|
|
270
294
|
return {
|
|
271
295
|
name: n.name,
|
|
272
296
|
slug: n.slug,
|
|
273
|
-
demosCount: ((
|
|
297
|
+
demosCount: ((s = n.demos) == null ? void 0 : s.length) ?? 0
|
|
274
298
|
};
|
|
275
299
|
})
|
|
276
300
|
});
|
|
@@ -281,15 +305,15 @@ async function E() {
|
|
|
281
305
|
description: "List all available components in the RLX UI library"
|
|
282
306
|
},
|
|
283
307
|
async () => {
|
|
284
|
-
const e =
|
|
285
|
-
return
|
|
308
|
+
const e = k();
|
|
309
|
+
return c({
|
|
286
310
|
count: e.length,
|
|
287
311
|
components: e.map((n) => {
|
|
288
|
-
var
|
|
312
|
+
var s;
|
|
289
313
|
return {
|
|
290
314
|
name: n.name,
|
|
291
315
|
slug: n.slug,
|
|
292
|
-
demosCount: ((
|
|
316
|
+
demosCount: ((s = n.demos) == null ? void 0 : s.length) ?? 0
|
|
293
317
|
};
|
|
294
318
|
})
|
|
295
319
|
});
|
|
@@ -301,14 +325,14 @@ async function E() {
|
|
|
301
325
|
},
|
|
302
326
|
async () => {
|
|
303
327
|
const e = b();
|
|
304
|
-
return
|
|
328
|
+
return c({
|
|
305
329
|
count: e.length,
|
|
306
330
|
animates: e.map((n) => {
|
|
307
|
-
var
|
|
331
|
+
var s;
|
|
308
332
|
return {
|
|
309
333
|
name: n.name,
|
|
310
334
|
slug: n.slug,
|
|
311
|
-
demosCount: ((
|
|
335
|
+
demosCount: ((s = n.demos) == null ? void 0 : s.length) ?? 0
|
|
312
336
|
};
|
|
313
337
|
})
|
|
314
338
|
});
|
|
@@ -319,15 +343,15 @@ async function E() {
|
|
|
319
343
|
description: "List all available React hooks in the RLX UI library"
|
|
320
344
|
},
|
|
321
345
|
async () => {
|
|
322
|
-
const e =
|
|
323
|
-
return
|
|
346
|
+
const e = x();
|
|
347
|
+
return c({
|
|
324
348
|
count: e.length,
|
|
325
349
|
hooks: e.map((n) => {
|
|
326
|
-
var
|
|
350
|
+
var s;
|
|
327
351
|
return {
|
|
328
352
|
name: n.name,
|
|
329
353
|
slug: n.slug,
|
|
330
|
-
demosCount: ((
|
|
354
|
+
demosCount: ((s = n.demos) == null ? void 0 : s.length) ?? 0
|
|
331
355
|
};
|
|
332
356
|
})
|
|
333
357
|
});
|
|
@@ -338,15 +362,15 @@ async function E() {
|
|
|
338
362
|
description: "List all available utility functions in the RLX UI library"
|
|
339
363
|
},
|
|
340
364
|
async () => {
|
|
341
|
-
const e =
|
|
342
|
-
return
|
|
365
|
+
const e = v();
|
|
366
|
+
return c({
|
|
343
367
|
count: e.length,
|
|
344
368
|
utils: e.map((n) => {
|
|
345
|
-
var
|
|
369
|
+
var s;
|
|
346
370
|
return {
|
|
347
371
|
name: n.name,
|
|
348
372
|
slug: n.slug,
|
|
349
|
-
demosCount: ((
|
|
373
|
+
demosCount: ((s = n.demos) == null ? void 0 : s.length) ?? 0
|
|
350
374
|
};
|
|
351
375
|
})
|
|
352
376
|
});
|
|
@@ -356,18 +380,18 @@ async function E() {
|
|
|
356
380
|
{
|
|
357
381
|
description: "Search for components, widgets, hooks, utils, or animates by name or slug",
|
|
358
382
|
inputSchema: {
|
|
359
|
-
query:
|
|
383
|
+
query: l.string().describe("Search query to find components")
|
|
360
384
|
}
|
|
361
385
|
},
|
|
362
386
|
async (e) => {
|
|
363
|
-
const n =
|
|
364
|
-
return
|
|
387
|
+
const n = P(e.query);
|
|
388
|
+
return c({
|
|
365
389
|
query: e.query,
|
|
366
390
|
count: n.length,
|
|
367
|
-
results: n.map((
|
|
368
|
-
name:
|
|
369
|
-
slug:
|
|
370
|
-
category:
|
|
391
|
+
results: n.map((s) => ({
|
|
392
|
+
name: s.name,
|
|
393
|
+
slug: s.slug,
|
|
394
|
+
category: s.category
|
|
371
395
|
}))
|
|
372
396
|
});
|
|
373
397
|
}
|
|
@@ -376,101 +400,138 @@ async function E() {
|
|
|
376
400
|
{
|
|
377
401
|
description: "Get detailed information about a specific component, widget, hook, util, or animate",
|
|
378
402
|
inputSchema: {
|
|
379
|
-
slug:
|
|
403
|
+
slug: l.string().describe(
|
|
380
404
|
"The slug/name of the component (e.g., 'button', 'use-copy-to-clipboard')"
|
|
381
405
|
),
|
|
382
|
-
category:
|
|
406
|
+
category: l.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search")
|
|
383
407
|
}
|
|
384
408
|
},
|
|
385
409
|
async (e) => {
|
|
386
|
-
var
|
|
387
|
-
const n =
|
|
388
|
-
return n ?
|
|
410
|
+
var s, r;
|
|
411
|
+
const n = W(e.slug, e.category);
|
|
412
|
+
return n ? c({
|
|
389
413
|
name: n.name,
|
|
390
414
|
slug: n.slug,
|
|
391
415
|
category: n.category,
|
|
392
416
|
hasSourceCode: !!n.sourceCode && typeof n.sourceCode == "string",
|
|
393
|
-
demosCount: ((
|
|
417
|
+
demosCount: ((s = n.demos) == null ? void 0 : s.length) ?? 0,
|
|
394
418
|
demos: (r = n.demos) == null ? void 0 : r.map((a) => ({
|
|
395
419
|
name: a.name,
|
|
396
420
|
hasCode: !!a.code
|
|
397
421
|
}))
|
|
398
|
-
}) :
|
|
422
|
+
}) : g(e.slug, e.category);
|
|
399
423
|
}
|
|
400
424
|
), t.registerTool(
|
|
401
425
|
"get_component_example",
|
|
402
426
|
{
|
|
403
427
|
description: "Get code examples (demos) for a component",
|
|
404
428
|
inputSchema: {
|
|
405
|
-
slug:
|
|
406
|
-
category:
|
|
407
|
-
exampleName:
|
|
429
|
+
slug: l.string().describe("The slug/name of the component"),
|
|
430
|
+
category: l.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search"),
|
|
431
|
+
exampleName: l.string().optional().describe(
|
|
408
432
|
"Optional specific example/variant name. If not provided, returns the first available example."
|
|
409
433
|
)
|
|
410
434
|
}
|
|
411
435
|
},
|
|
412
436
|
async (e) => {
|
|
413
|
-
var
|
|
414
|
-
const n =
|
|
437
|
+
var s, r, a;
|
|
438
|
+
const n = G(
|
|
415
439
|
e.slug,
|
|
416
440
|
e.category,
|
|
417
441
|
e.exampleName
|
|
418
442
|
);
|
|
419
|
-
return n.found ?
|
|
443
|
+
return n.found ? c({
|
|
420
444
|
component: {
|
|
421
|
-
name: (
|
|
445
|
+
name: (s = n.component) == null ? void 0 : s.name,
|
|
422
446
|
slug: (r = n.component) == null ? void 0 : r.slug,
|
|
423
447
|
category: (a = n.component) == null ? void 0 : a.category
|
|
424
448
|
},
|
|
425
449
|
example: n.example,
|
|
426
450
|
availableDemos: n.availableDemos
|
|
427
|
-
}) :
|
|
451
|
+
}) : g(e.slug, e.category);
|
|
428
452
|
}
|
|
429
453
|
), t.registerTool(
|
|
430
454
|
"get_component_source",
|
|
431
455
|
{
|
|
432
456
|
description: "Get the complete source code for a component, including main file and all related files (utils, types, etc.)",
|
|
433
457
|
inputSchema: {
|
|
434
|
-
slug:
|
|
435
|
-
category:
|
|
458
|
+
slug: l.string().describe("The slug/name of the component"),
|
|
459
|
+
category: l.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search")
|
|
436
460
|
}
|
|
437
461
|
},
|
|
438
462
|
async (e) => {
|
|
439
|
-
var
|
|
463
|
+
var s, r, a;
|
|
440
464
|
const n = D(e.slug, e.category);
|
|
441
|
-
return n.found ?
|
|
465
|
+
return n.found ? c({
|
|
442
466
|
component: {
|
|
443
|
-
name: (
|
|
467
|
+
name: (s = n.component) == null ? void 0 : s.name,
|
|
444
468
|
slug: (r = n.component) == null ? void 0 : r.slug,
|
|
445
469
|
category: (a = n.component) == null ? void 0 : a.category
|
|
446
470
|
},
|
|
447
471
|
sourceCode: n.sourceCode,
|
|
448
472
|
sourceFiles: n.sourceFiles,
|
|
449
473
|
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
|
-
}) :
|
|
474
|
+
}) : g(e.slug, e.category);
|
|
475
|
+
}
|
|
476
|
+
), t.registerTool(
|
|
477
|
+
"check_mcp_version",
|
|
478
|
+
{
|
|
479
|
+
description: `Check if the installed version of @rlx-ui/mcp is up to date with the latest version from npm.
|
|
480
|
+
|
|
481
|
+
IMPORTANT: Always check the version before providing installation commands or component information.
|
|
482
|
+
If the version is outdated, warn the user and suggest updating.`
|
|
483
|
+
},
|
|
484
|
+
async () => {
|
|
485
|
+
const e = await T(), n = await y(e);
|
|
486
|
+
return c({
|
|
487
|
+
installedVersion: n.installedVersion,
|
|
488
|
+
latestVersion: n.latestVersion,
|
|
489
|
+
needsUpdate: n.needsUpdate,
|
|
490
|
+
warning: n.warning
|
|
491
|
+
});
|
|
451
492
|
}
|
|
452
493
|
), t.registerTool(
|
|
453
494
|
"get_installation_command",
|
|
454
495
|
{
|
|
455
|
-
description:
|
|
496
|
+
description: `Get npm/pnpm/yarn installation command for a component.
|
|
497
|
+
|
|
498
|
+
IMPORTANT:
|
|
499
|
+
1. First check the @rlx-ui/mcp version using \`check_mcp_version\` tool. If outdated, warn the user.
|
|
500
|
+
2. When installing any @rlx-components/*, @rlx-widgets/*, or @rlx-animates/* package,
|
|
501
|
+
you MUST also install all peer dependencies from these namespaces to ensure Tailwind CSS
|
|
502
|
+
can properly detect and include all className utilities.
|
|
503
|
+
|
|
504
|
+
For example, when installing @rlx-components/code-preview-tabs, you also need:
|
|
505
|
+
- @rlx-widgets/base
|
|
506
|
+
- @rlx-components/shiki-code-block
|
|
507
|
+
- @rlx-widgets/tabs
|
|
508
|
+
- @rlx-widgets/select
|
|
509
|
+
- @rlx-widgets/button (peer dependency from shiki-code-block)
|
|
510
|
+
|
|
511
|
+
To find peer dependencies:
|
|
512
|
+
1. Use \`get_component_source\` tool to get the \`sourceCode\` and \`sourceFiles\` properties
|
|
513
|
+
2. Parse import statements (e.g., \`from "@rlx-widgets/base"\`) to find @rlx-* dependencies
|
|
514
|
+
3. Recursively check peer dependencies of peer dependencies (e.g., if shiki-code-block depends on button, include button too)
|
|
515
|
+
4. Include all found @rlx-widgets/*, @rlx-components/*, and @rlx-animates/* packages in the installation command`,
|
|
456
516
|
inputSchema: {
|
|
457
|
-
slug:
|
|
458
|
-
category:
|
|
459
|
-
packageManager:
|
|
517
|
+
slug: l.string().describe("The slug/name of the component"),
|
|
518
|
+
category: l.enum(["widget", "component", "hook", "util", "animate"]).optional().describe("Optional category to narrow the search"),
|
|
519
|
+
packageManager: l.enum(["npm", "pnpm", "yarn"]).optional().default("pnpm").describe("Package manager to use (default: pnpm)")
|
|
460
520
|
}
|
|
461
521
|
},
|
|
462
522
|
async (e) => {
|
|
463
|
-
const n =
|
|
523
|
+
const n = await T(), s = await y(n), r = q(
|
|
464
524
|
e.slug,
|
|
465
525
|
e.category,
|
|
466
526
|
e.packageManager || "pnpm"
|
|
467
527
|
);
|
|
468
|
-
return
|
|
469
|
-
command:
|
|
470
|
-
packageName:
|
|
471
|
-
category:
|
|
472
|
-
packageManager: e.packageManager || "pnpm"
|
|
473
|
-
|
|
528
|
+
return r.found ? c({
|
|
529
|
+
command: r.command,
|
|
530
|
+
packageName: r.packageName,
|
|
531
|
+
category: r.category,
|
|
532
|
+
packageManager: e.packageManager || "pnpm",
|
|
533
|
+
versionWarning: s.warning
|
|
534
|
+
}) : g(e.slug, e.category);
|
|
474
535
|
}
|
|
475
536
|
), t.registerResource(
|
|
476
537
|
"RLX UI Widgets",
|
|
@@ -480,7 +541,7 @@ async function E() {
|
|
|
480
541
|
mimeType: "application/json"
|
|
481
542
|
},
|
|
482
543
|
async () => {
|
|
483
|
-
const e =
|
|
544
|
+
const e = w();
|
|
484
545
|
return {
|
|
485
546
|
contents: [
|
|
486
547
|
{
|
|
@@ -499,7 +560,7 @@ async function E() {
|
|
|
499
560
|
mimeType: "application/json"
|
|
500
561
|
},
|
|
501
562
|
async () => {
|
|
502
|
-
const e =
|
|
563
|
+
const e = k();
|
|
503
564
|
return {
|
|
504
565
|
contents: [
|
|
505
566
|
{
|
|
@@ -537,7 +598,7 @@ async function E() {
|
|
|
537
598
|
mimeType: "application/json"
|
|
538
599
|
},
|
|
539
600
|
async () => {
|
|
540
|
-
const e =
|
|
601
|
+
const e = x();
|
|
541
602
|
return {
|
|
542
603
|
contents: [
|
|
543
604
|
{
|
|
@@ -556,7 +617,7 @@ async function E() {
|
|
|
556
617
|
mimeType: "application/json"
|
|
557
618
|
},
|
|
558
619
|
async () => {
|
|
559
|
-
const e =
|
|
620
|
+
const e = v();
|
|
560
621
|
return {
|
|
561
622
|
contents: [
|
|
562
623
|
{
|
|
@@ -575,7 +636,7 @@ async function E() {
|
|
|
575
636
|
mimeType: "application/json"
|
|
576
637
|
},
|
|
577
638
|
async () => {
|
|
578
|
-
const e =
|
|
639
|
+
const e = w(), n = k(), s = b(), r = x(), a = v(), d = await y(o);
|
|
579
640
|
return {
|
|
580
641
|
contents: [
|
|
581
642
|
{
|
|
@@ -585,15 +646,21 @@ async function E() {
|
|
|
585
646
|
{
|
|
586
647
|
name: "RLX UI",
|
|
587
648
|
description: "A comprehensive UI component library",
|
|
588
|
-
version:
|
|
649
|
+
version: o,
|
|
589
650
|
mcpServer: "@rlx-ui/mcp",
|
|
651
|
+
versionStatus: {
|
|
652
|
+
installedVersion: d.installedVersion,
|
|
653
|
+
latestVersion: d.latestVersion,
|
|
654
|
+
needsUpdate: d.needsUpdate,
|
|
655
|
+
warning: d.warning
|
|
656
|
+
},
|
|
590
657
|
stats: {
|
|
591
658
|
widgets: e.length,
|
|
592
659
|
components: n.length,
|
|
593
|
-
animates:
|
|
660
|
+
animates: s.length,
|
|
594
661
|
hooks: r.length,
|
|
595
662
|
utils: a.length,
|
|
596
|
-
total: e.length + n.length +
|
|
663
|
+
total: e.length + n.length + s.length + r.length + a.length
|
|
597
664
|
}
|
|
598
665
|
},
|
|
599
666
|
null,
|
|
@@ -604,12 +671,12 @@ async function E() {
|
|
|
604
671
|
};
|
|
605
672
|
}
|
|
606
673
|
);
|
|
607
|
-
const i = new
|
|
674
|
+
const i = new S();
|
|
608
675
|
await t.connect(i), console.error("RLX UI MCP Server running on stdio");
|
|
609
676
|
}
|
|
610
|
-
async function
|
|
611
|
-
const
|
|
612
|
-
|
|
677
|
+
async function T() {
|
|
678
|
+
const o = R(import.meta.url), t = C.dirname(o), i = await O(
|
|
679
|
+
C.join(t, "..", "package.json")
|
|
613
680
|
);
|
|
614
681
|
if (!i)
|
|
615
682
|
throw new Error("Unable to find package.json");
|
|
@@ -618,6 +685,6 @@ async function G() {
|
|
|
618
685
|
throw new Error("Unable to read version from package.json");
|
|
619
686
|
return n;
|
|
620
687
|
}
|
|
621
|
-
E().catch((
|
|
622
|
-
console.error("Fatal error in main():",
|
|
688
|
+
E().catch((o) => {
|
|
689
|
+
console.error("Fatal error in main():", o), process.exit(1);
|
|
623
690
|
});
|