@rlx-ui/mcp 0.0.2 → 0.0.3
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 +340 -756
- package/dist/data/registry.json +349 -607
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,394 +1,270 @@
|
|
|
1
|
-
import { McpServer as
|
|
2
|
-
import { StdioServerTransport as
|
|
3
|
-
import { z as
|
|
4
|
-
import { readFileSync as
|
|
5
|
-
import { fileURLToPath as
|
|
6
|
-
import { join as
|
|
7
|
-
const
|
|
8
|
-
let
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
11
|
-
return
|
|
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;
|
|
12
12
|
try {
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
const o = [
|
|
14
|
+
m(f, "data/registry.json"),
|
|
15
15
|
// From dist/ to dist/data/ (copied during build)
|
|
16
|
-
|
|
16
|
+
m(f, "../src/data/registry.json"),
|
|
17
17
|
// From dist/ to src/data/ (development)
|
|
18
|
-
|
|
18
|
+
m(f, "../data/registry.json"),
|
|
19
19
|
// Fallback
|
|
20
|
-
|
|
20
|
+
m(process.cwd(), "src/data/registry.json"),
|
|
21
21
|
// From package root (published)
|
|
22
|
-
|
|
22
|
+
m(process.cwd(), "libs/rlx-ui/mcp/src/data/registry.json")
|
|
23
23
|
// Development
|
|
24
24
|
];
|
|
25
|
-
let
|
|
26
|
-
for (const
|
|
25
|
+
let s = null;
|
|
26
|
+
for (const n of o)
|
|
27
27
|
try {
|
|
28
|
-
|
|
28
|
+
s = T(n, "utf-8");
|
|
29
29
|
break;
|
|
30
30
|
} catch {
|
|
31
31
|
continue;
|
|
32
32
|
}
|
|
33
|
-
if (!
|
|
33
|
+
if (!s)
|
|
34
34
|
throw new Error("Could not find registry.json in any expected location");
|
|
35
|
-
return
|
|
36
|
-
} catch (
|
|
37
|
-
return console.error("Warning: Could not load component registry:",
|
|
35
|
+
return u = JSON.parse(s), u;
|
|
36
|
+
} catch (o) {
|
|
37
|
+
return console.error("Warning: Could not load component registry:", o), u = {
|
|
38
38
|
widgets: [],
|
|
39
39
|
components: [],
|
|
40
40
|
animates: [],
|
|
41
41
|
hooks: [],
|
|
42
42
|
utils: [],
|
|
43
43
|
extractedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
44
|
-
},
|
|
44
|
+
}, u;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
47
|
+
function j() {
|
|
48
|
+
return l().widgets;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
return
|
|
50
|
+
function I() {
|
|
51
|
+
return l().components;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
return
|
|
53
|
+
function U() {
|
|
54
|
+
return l().animates;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
return
|
|
56
|
+
function v() {
|
|
57
|
+
return l().hooks;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
return
|
|
59
|
+
function _() {
|
|
60
|
+
return l().utils;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
const e =
|
|
62
|
+
function d(o, s) {
|
|
63
|
+
const n = l();
|
|
64
|
+
if (s === "widget" || !s) {
|
|
65
|
+
const e = n.widgets.find((t) => t.slug === o);
|
|
66
66
|
if (e) return e;
|
|
67
67
|
}
|
|
68
|
-
if (
|
|
69
|
-
const e =
|
|
68
|
+
if (s === "component" || !s) {
|
|
69
|
+
const e = n.components.find((t) => t.slug === o);
|
|
70
70
|
if (e) return e;
|
|
71
71
|
}
|
|
72
|
-
if (
|
|
73
|
-
const e =
|
|
72
|
+
if (s === "animate" || !s) {
|
|
73
|
+
const e = n.animates.find((t) => t.slug === o);
|
|
74
74
|
if (e) return e;
|
|
75
75
|
}
|
|
76
|
-
if (
|
|
77
|
-
const e =
|
|
76
|
+
if (s === "hook" || !s) {
|
|
77
|
+
const e = n.hooks.find((t) => t.slug === o);
|
|
78
78
|
if (e) return e;
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
81
|
-
const e =
|
|
80
|
+
if (s === "util" || !s) {
|
|
81
|
+
const e = n.utils.find((t) => t.slug === o);
|
|
82
82
|
if (e) return e;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const
|
|
87
|
-
...
|
|
88
|
-
...
|
|
89
|
-
...
|
|
90
|
-
...
|
|
91
|
-
...
|
|
92
|
-
], e =
|
|
93
|
-
return
|
|
94
|
-
(
|
|
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)
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
97
|
+
function h() {
|
|
98
|
+
return j();
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
return
|
|
100
|
+
function y() {
|
|
101
|
+
return I();
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
103
|
+
function b() {
|
|
104
|
+
return U();
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
return
|
|
106
|
+
function k() {
|
|
107
|
+
return v();
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
return
|
|
109
|
+
function w() {
|
|
110
|
+
return _();
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
return
|
|
112
|
+
function X(o) {
|
|
113
|
+
return O(o);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
return
|
|
115
|
+
function F(o, s) {
|
|
116
|
+
return d(o, s) || null;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
118
|
+
function N(o, s) {
|
|
119
|
+
const n = d(o, s);
|
|
120
|
+
if (!n)
|
|
121
121
|
return { found: !1 };
|
|
122
|
-
let e,
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
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(
|
|
125
130
|
/(?:export\s+)?(?:interface|type)\s+(\w+Props?)\s*[=:]\s*\{[\s\S]*?\}/g
|
|
126
131
|
);
|
|
127
|
-
|
|
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.");
|
|
128
133
|
} else
|
|
129
|
-
|
|
134
|
+
t = "Source code not available in registry.";
|
|
130
135
|
return {
|
|
131
136
|
found: !0,
|
|
132
|
-
component:
|
|
137
|
+
component: n,
|
|
133
138
|
props: e,
|
|
134
|
-
note:
|
|
139
|
+
note: t
|
|
135
140
|
};
|
|
136
141
|
}
|
|
137
|
-
function
|
|
138
|
-
var
|
|
139
|
-
const e =
|
|
142
|
+
function $(o, s, n) {
|
|
143
|
+
var r;
|
|
144
|
+
const e = d(o, s);
|
|
140
145
|
if (!e)
|
|
141
146
|
return { found: !1 };
|
|
142
|
-
const
|
|
143
|
-
if (e.
|
|
144
|
-
|
|
145
|
-
}),
|
|
146
|
-
|
|
147
|
-
|
|
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 ? {
|
|
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 ? {
|
|
162
153
|
found: !0,
|
|
163
154
|
component: e,
|
|
164
155
|
example: {
|
|
165
|
-
name:
|
|
166
|
-
code:
|
|
167
|
-
preview: l.preview
|
|
156
|
+
name: i.name,
|
|
157
|
+
code: i.code
|
|
168
158
|
},
|
|
169
|
-
|
|
159
|
+
availableDemos: t
|
|
170
160
|
} : {
|
|
171
161
|
found: !0,
|
|
172
162
|
component: e,
|
|
173
|
-
|
|
163
|
+
availableDemos: t
|
|
174
164
|
};
|
|
175
165
|
}
|
|
176
|
-
if (e.
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
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)
|
|
166
|
+
if (e.demos && e.demos.length > 0) {
|
|
167
|
+
const i = e.demos[0];
|
|
168
|
+
if (i.code)
|
|
193
169
|
return {
|
|
194
170
|
found: !0,
|
|
195
171
|
component: e,
|
|
196
172
|
example: {
|
|
197
|
-
name:
|
|
198
|
-
code:
|
|
199
|
-
preview: a.preview
|
|
173
|
+
name: i.name,
|
|
174
|
+
code: i.code
|
|
200
175
|
},
|
|
201
|
-
|
|
176
|
+
availableDemos: t
|
|
202
177
|
};
|
|
203
178
|
}
|
|
204
179
|
return {
|
|
205
180
|
found: !0,
|
|
206
181
|
component: e,
|
|
207
|
-
|
|
182
|
+
availableDemos: t
|
|
208
183
|
};
|
|
209
184
|
}
|
|
210
|
-
function
|
|
211
|
-
const e =
|
|
185
|
+
function P(o, s, n = "pnpm") {
|
|
186
|
+
const e = d(o, s);
|
|
212
187
|
if (!e)
|
|
213
188
|
return { found: !1 };
|
|
214
|
-
let
|
|
189
|
+
let t;
|
|
215
190
|
switch (e.category) {
|
|
216
191
|
case "widget":
|
|
217
|
-
|
|
192
|
+
t = `@rlx-widgets/${e.slug}`;
|
|
218
193
|
break;
|
|
219
194
|
case "component":
|
|
220
|
-
|
|
195
|
+
t = `@rlx-components/${e.slug}`;
|
|
221
196
|
break;
|
|
222
197
|
case "hook":
|
|
223
|
-
|
|
198
|
+
t = `@rlx-hooks/${e.slug}`;
|
|
224
199
|
break;
|
|
225
200
|
case "util":
|
|
226
|
-
|
|
201
|
+
t = `@rlx-utils/${e.slug}`;
|
|
227
202
|
break;
|
|
228
203
|
case "animate":
|
|
229
|
-
|
|
204
|
+
t = `@rlx-animates/${e.slug}`;
|
|
230
205
|
break;
|
|
231
206
|
default:
|
|
232
207
|
return { found: !1 };
|
|
233
208
|
}
|
|
234
|
-
let
|
|
235
|
-
switch (
|
|
209
|
+
let r;
|
|
210
|
+
switch (n) {
|
|
236
211
|
case "npm":
|
|
237
|
-
|
|
212
|
+
r = `npm install ${t}`;
|
|
238
213
|
break;
|
|
239
214
|
case "pnpm":
|
|
240
|
-
|
|
215
|
+
r = `pnpm add ${t}`;
|
|
241
216
|
break;
|
|
242
217
|
case "yarn":
|
|
243
|
-
|
|
218
|
+
r = `yarn add ${t}`;
|
|
244
219
|
break;
|
|
245
220
|
default:
|
|
246
|
-
|
|
221
|
+
r = `pnpm add ${t}`;
|
|
247
222
|
}
|
|
248
223
|
return {
|
|
249
224
|
found: !0,
|
|
250
|
-
command:
|
|
251
|
-
packageName:
|
|
225
|
+
command: r,
|
|
226
|
+
packageName: t,
|
|
252
227
|
category: e.category
|
|
253
228
|
};
|
|
254
229
|
}
|
|
255
|
-
function
|
|
256
|
-
|
|
257
|
-
|
|
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 {
|
|
230
|
+
function J(o, s) {
|
|
231
|
+
const n = d(o, s);
|
|
232
|
+
return n ? n.sourceCode && typeof n.sourceCode == "string" ? {
|
|
282
233
|
found: !0,
|
|
283
234
|
component: n,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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) };
|
|
235
|
+
sourceCode: n.sourceCode,
|
|
236
|
+
sourceFiles: n.sourceFiles || {}
|
|
237
|
+
} : {
|
|
238
|
+
found: !0,
|
|
239
|
+
component: n,
|
|
240
|
+
sourceFiles: n.sourceFiles || {}
|
|
241
|
+
} : { found: !1 };
|
|
310
242
|
}
|
|
311
|
-
function
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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
|
|
243
|
+
function c(o) {
|
|
244
|
+
return {
|
|
245
|
+
content: [
|
|
246
|
+
{
|
|
247
|
+
type: "text",
|
|
248
|
+
text: JSON.stringify(o, null, 2)
|
|
249
|
+
}
|
|
250
|
+
]
|
|
360
251
|
};
|
|
361
252
|
}
|
|
362
|
-
function
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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];
|
|
253
|
+
function M(o, s, n) {
|
|
254
|
+
return c({
|
|
255
|
+
error: o,
|
|
256
|
+
...s && { slug: s },
|
|
257
|
+
...n && { category: n }
|
|
258
|
+
});
|
|
380
259
|
}
|
|
381
|
-
function
|
|
382
|
-
|
|
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(" ")}` : "";
|
|
260
|
+
function p(o, s) {
|
|
261
|
+
return M("Component not found", o, s);
|
|
386
262
|
}
|
|
387
|
-
async function
|
|
388
|
-
const
|
|
263
|
+
async function G() {
|
|
264
|
+
const o = new x(
|
|
389
265
|
{
|
|
390
266
|
name: "@rlx-ui/mcp",
|
|
391
|
-
version: "0.0.
|
|
267
|
+
version: "0.0.3"
|
|
392
268
|
},
|
|
393
269
|
{
|
|
394
270
|
capabilities: {
|
|
@@ -397,529 +273,237 @@ async function H() {
|
|
|
397
273
|
}
|
|
398
274
|
}
|
|
399
275
|
);
|
|
400
|
-
|
|
276
|
+
o.registerTool(
|
|
401
277
|
"list_widgets",
|
|
402
278
|
{
|
|
403
279
|
description: "List all available widgets in the RLX UI library"
|
|
404
280
|
},
|
|
405
281
|
async () => {
|
|
406
|
-
const
|
|
407
|
-
return {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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
|
-
};
|
|
282
|
+
const n = h();
|
|
283
|
+
return c({
|
|
284
|
+
count: n.length,
|
|
285
|
+
widgets: n.map((e) => {
|
|
286
|
+
var t;
|
|
287
|
+
return {
|
|
288
|
+
name: e.name,
|
|
289
|
+
slug: e.slug,
|
|
290
|
+
demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0
|
|
291
|
+
};
|
|
292
|
+
})
|
|
293
|
+
});
|
|
431
294
|
}
|
|
432
|
-
),
|
|
295
|
+
), o.registerTool(
|
|
433
296
|
"list_components",
|
|
434
297
|
{
|
|
435
298
|
description: "List all available components in the RLX UI library"
|
|
436
299
|
},
|
|
437
300
|
async () => {
|
|
438
|
-
const
|
|
439
|
-
return {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
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
|
-
};
|
|
301
|
+
const n = y();
|
|
302
|
+
return c({
|
|
303
|
+
count: n.length,
|
|
304
|
+
components: n.map((e) => {
|
|
305
|
+
var t;
|
|
306
|
+
return {
|
|
307
|
+
name: e.name,
|
|
308
|
+
slug: e.slug,
|
|
309
|
+
demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0
|
|
310
|
+
};
|
|
311
|
+
})
|
|
312
|
+
});
|
|
463
313
|
}
|
|
464
|
-
),
|
|
314
|
+
), o.registerTool(
|
|
465
315
|
"list_animates",
|
|
466
316
|
{
|
|
467
317
|
description: "List all available animations in the RLX UI library"
|
|
468
318
|
},
|
|
469
319
|
async () => {
|
|
470
|
-
const
|
|
471
|
-
return {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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
|
-
};
|
|
320
|
+
const n = b();
|
|
321
|
+
return c({
|
|
322
|
+
count: n.length,
|
|
323
|
+
animates: n.map((e) => {
|
|
324
|
+
var t;
|
|
325
|
+
return {
|
|
326
|
+
name: e.name,
|
|
327
|
+
slug: e.slug,
|
|
328
|
+
demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0
|
|
329
|
+
};
|
|
330
|
+
})
|
|
331
|
+
});
|
|
494
332
|
}
|
|
495
|
-
),
|
|
333
|
+
), o.registerTool(
|
|
496
334
|
"list_hooks",
|
|
497
335
|
{
|
|
498
336
|
description: "List all available React hooks in the RLX UI library"
|
|
499
337
|
},
|
|
500
338
|
async () => {
|
|
501
|
-
const
|
|
502
|
-
return {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
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
|
-
};
|
|
339
|
+
const n = k();
|
|
340
|
+
return c({
|
|
341
|
+
count: n.length,
|
|
342
|
+
hooks: n.map((e) => {
|
|
343
|
+
var t;
|
|
344
|
+
return {
|
|
345
|
+
name: e.name,
|
|
346
|
+
slug: e.slug,
|
|
347
|
+
demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0
|
|
348
|
+
};
|
|
349
|
+
})
|
|
350
|
+
});
|
|
526
351
|
}
|
|
527
|
-
),
|
|
352
|
+
), o.registerTool(
|
|
528
353
|
"list_utils",
|
|
529
354
|
{
|
|
530
355
|
description: "List all available utility functions in the RLX UI library"
|
|
531
356
|
},
|
|
532
357
|
async () => {
|
|
533
|
-
const
|
|
534
|
-
return {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
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
|
-
};
|
|
358
|
+
const n = w();
|
|
359
|
+
return c({
|
|
360
|
+
count: n.length,
|
|
361
|
+
utils: n.map((e) => {
|
|
362
|
+
var t;
|
|
363
|
+
return {
|
|
364
|
+
name: e.name,
|
|
365
|
+
slug: e.slug,
|
|
366
|
+
demosCount: ((t = e.demos) == null ? void 0 : t.length) ?? 0
|
|
367
|
+
};
|
|
368
|
+
})
|
|
369
|
+
});
|
|
558
370
|
}
|
|
559
|
-
),
|
|
371
|
+
), o.registerTool(
|
|
560
372
|
"search_component",
|
|
561
373
|
{
|
|
562
374
|
description: "Search for components, widgets, hooks, utils, or animates by name or slug",
|
|
563
375
|
inputSchema: {
|
|
564
|
-
query:
|
|
376
|
+
query: a.string().describe("Search query to find components")
|
|
565
377
|
}
|
|
566
378
|
},
|
|
567
|
-
async (
|
|
568
|
-
const e =
|
|
569
|
-
return {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
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
|
-
};
|
|
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
|
|
388
|
+
}))
|
|
389
|
+
});
|
|
590
390
|
}
|
|
591
|
-
),
|
|
391
|
+
), o.registerTool(
|
|
592
392
|
"get_component_info",
|
|
593
393
|
{
|
|
594
394
|
description: "Get detailed information about a specific component, widget, hook, util, or animate",
|
|
595
395
|
inputSchema: {
|
|
596
|
-
slug:
|
|
597
|
-
category:
|
|
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")
|
|
598
398
|
}
|
|
599
399
|
},
|
|
600
|
-
async (
|
|
601
|
-
var
|
|
602
|
-
const e =
|
|
603
|
-
return e ? {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
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
|
-
};
|
|
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
|
|
412
|
+
}))
|
|
413
|
+
}) : p(n.slug, n.category);
|
|
648
414
|
}
|
|
649
|
-
),
|
|
415
|
+
), o.registerTool(
|
|
650
416
|
"get_component_props",
|
|
651
417
|
{
|
|
652
418
|
description: "Get TypeScript props/interface definition for a component",
|
|
653
419
|
inputSchema: {
|
|
654
|
-
slug:
|
|
655
|
-
category:
|
|
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")
|
|
656
422
|
}
|
|
657
423
|
},
|
|
658
|
-
async (
|
|
659
|
-
var
|
|
660
|
-
const e =
|
|
661
|
-
return e.found ? {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
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
|
-
};
|
|
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);
|
|
696
436
|
}
|
|
697
|
-
),
|
|
437
|
+
), o.registerTool(
|
|
698
438
|
"get_component_example",
|
|
699
439
|
{
|
|
700
|
-
description: "Get code examples for a component
|
|
440
|
+
description: "Get code examples (demos) for a component",
|
|
701
441
|
inputSchema: {
|
|
702
|
-
slug:
|
|
703
|
-
category:
|
|
704
|
-
exampleName:
|
|
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.")
|
|
705
445
|
}
|
|
706
446
|
},
|
|
707
|
-
async (
|
|
708
|
-
var
|
|
709
|
-
const e =
|
|
710
|
-
return e.found ? {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
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
|
-
};
|
|
447
|
+
async (n) => {
|
|
448
|
+
var t, r, i;
|
|
449
|
+
const e = $(n.slug, n.category, n.exampleName);
|
|
450
|
+
return e.found ? c({
|
|
451
|
+
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
|
|
455
|
+
},
|
|
456
|
+
example: e.example,
|
|
457
|
+
availableDemos: e.availableDemos
|
|
458
|
+
}) : p(n.slug, n.category);
|
|
745
459
|
}
|
|
746
|
-
),
|
|
747
|
-
"
|
|
460
|
+
), o.registerTool(
|
|
461
|
+
"get_component_source",
|
|
748
462
|
{
|
|
749
|
-
description: "Get
|
|
463
|
+
description: "Get the complete source code for a component, including main file and all related files (utils, types, etc.)",
|
|
750
464
|
inputSchema: {
|
|
751
|
-
slug:
|
|
752
|
-
category:
|
|
753
|
-
packageManager: p.enum(["npm", "pnpm", "yarn"]).optional().default("pnpm").describe("Package manager to use (default: pnpm)")
|
|
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")
|
|
754
467
|
}
|
|
755
468
|
},
|
|
756
|
-
async (
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
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
|
-
};
|
|
469
|
+
async (n) => {
|
|
470
|
+
var t, r, i;
|
|
471
|
+
const e = J(n.slug, n.category);
|
|
472
|
+
return e.found ? c({
|
|
473
|
+
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
|
|
477
|
+
},
|
|
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);
|
|
794
482
|
}
|
|
795
|
-
),
|
|
796
|
-
"
|
|
483
|
+
), o.registerTool(
|
|
484
|
+
"get_installation_command",
|
|
797
485
|
{
|
|
798
|
-
description: "
|
|
486
|
+
description: "Get npm/pnpm/yarn installation command for a component",
|
|
799
487
|
inputSchema: {
|
|
800
|
-
slug:
|
|
801
|
-
category:
|
|
802
|
-
|
|
803
|
-
useCase: p.string().optional().describe("Optional description of the use case")
|
|
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)")
|
|
804
491
|
}
|
|
805
492
|
},
|
|
806
|
-
async (
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
t.props,
|
|
812
|
-
t.useCase
|
|
493
|
+
async (n) => {
|
|
494
|
+
const e = P(
|
|
495
|
+
n.slug,
|
|
496
|
+
n.category,
|
|
497
|
+
n.packageManager || "pnpm"
|
|
813
498
|
);
|
|
814
|
-
return e.found ? {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
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
|
-
};
|
|
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);
|
|
921
505
|
}
|
|
922
|
-
),
|
|
506
|
+
), o.registerResource(
|
|
923
507
|
"RLX UI Widgets",
|
|
924
508
|
"rlx-ui://widgets",
|
|
925
509
|
{
|
|
@@ -927,18 +511,18 @@ async function H() {
|
|
|
927
511
|
mimeType: "application/json"
|
|
928
512
|
},
|
|
929
513
|
async () => {
|
|
930
|
-
const
|
|
514
|
+
const n = h();
|
|
931
515
|
return {
|
|
932
516
|
contents: [
|
|
933
517
|
{
|
|
934
518
|
uri: "rlx-ui://widgets",
|
|
935
519
|
mimeType: "application/json",
|
|
936
|
-
text: JSON.stringify(
|
|
520
|
+
text: JSON.stringify(n, null, 2)
|
|
937
521
|
}
|
|
938
522
|
]
|
|
939
523
|
};
|
|
940
524
|
}
|
|
941
|
-
),
|
|
525
|
+
), o.registerResource(
|
|
942
526
|
"RLX UI Components",
|
|
943
527
|
"rlx-ui://components",
|
|
944
528
|
{
|
|
@@ -946,18 +530,18 @@ async function H() {
|
|
|
946
530
|
mimeType: "application/json"
|
|
947
531
|
},
|
|
948
532
|
async () => {
|
|
949
|
-
const
|
|
533
|
+
const n = y();
|
|
950
534
|
return {
|
|
951
535
|
contents: [
|
|
952
536
|
{
|
|
953
537
|
uri: "rlx-ui://components",
|
|
954
538
|
mimeType: "application/json",
|
|
955
|
-
text: JSON.stringify(
|
|
539
|
+
text: JSON.stringify(n, null, 2)
|
|
956
540
|
}
|
|
957
541
|
]
|
|
958
542
|
};
|
|
959
543
|
}
|
|
960
|
-
),
|
|
544
|
+
), o.registerResource(
|
|
961
545
|
"RLX UI Animates",
|
|
962
546
|
"rlx-ui://animates",
|
|
963
547
|
{
|
|
@@ -965,18 +549,18 @@ async function H() {
|
|
|
965
549
|
mimeType: "application/json"
|
|
966
550
|
},
|
|
967
551
|
async () => {
|
|
968
|
-
const
|
|
552
|
+
const n = b();
|
|
969
553
|
return {
|
|
970
554
|
contents: [
|
|
971
555
|
{
|
|
972
556
|
uri: "rlx-ui://animates",
|
|
973
557
|
mimeType: "application/json",
|
|
974
|
-
text: JSON.stringify(
|
|
558
|
+
text: JSON.stringify(n, null, 2)
|
|
975
559
|
}
|
|
976
560
|
]
|
|
977
561
|
};
|
|
978
562
|
}
|
|
979
|
-
),
|
|
563
|
+
), o.registerResource(
|
|
980
564
|
"RLX UI Hooks",
|
|
981
565
|
"rlx-ui://hooks",
|
|
982
566
|
{
|
|
@@ -984,18 +568,18 @@ async function H() {
|
|
|
984
568
|
mimeType: "application/json"
|
|
985
569
|
},
|
|
986
570
|
async () => {
|
|
987
|
-
const
|
|
571
|
+
const n = k();
|
|
988
572
|
return {
|
|
989
573
|
contents: [
|
|
990
574
|
{
|
|
991
575
|
uri: "rlx-ui://hooks",
|
|
992
576
|
mimeType: "application/json",
|
|
993
|
-
text: JSON.stringify(
|
|
577
|
+
text: JSON.stringify(n, null, 2)
|
|
994
578
|
}
|
|
995
579
|
]
|
|
996
580
|
};
|
|
997
581
|
}
|
|
998
|
-
),
|
|
582
|
+
), o.registerResource(
|
|
999
583
|
"RLX UI Utils",
|
|
1000
584
|
"rlx-ui://utils",
|
|
1001
585
|
{
|
|
@@ -1003,18 +587,18 @@ async function H() {
|
|
|
1003
587
|
mimeType: "application/json"
|
|
1004
588
|
},
|
|
1005
589
|
async () => {
|
|
1006
|
-
const
|
|
590
|
+
const n = w();
|
|
1007
591
|
return {
|
|
1008
592
|
contents: [
|
|
1009
593
|
{
|
|
1010
594
|
uri: "rlx-ui://utils",
|
|
1011
595
|
mimeType: "application/json",
|
|
1012
|
-
text: JSON.stringify(
|
|
596
|
+
text: JSON.stringify(n, null, 2)
|
|
1013
597
|
}
|
|
1014
598
|
]
|
|
1015
599
|
};
|
|
1016
600
|
}
|
|
1017
|
-
),
|
|
601
|
+
), o.registerResource(
|
|
1018
602
|
"RLX UI Information",
|
|
1019
603
|
"rlx-ui://info",
|
|
1020
604
|
{
|
|
@@ -1022,7 +606,7 @@ async function H() {
|
|
|
1022
606
|
mimeType: "application/json"
|
|
1023
607
|
},
|
|
1024
608
|
async () => {
|
|
1025
|
-
const
|
|
609
|
+
const n = h(), e = y(), t = b(), r = k(), i = w();
|
|
1026
610
|
return {
|
|
1027
611
|
contents: [
|
|
1028
612
|
{
|
|
@@ -1032,15 +616,15 @@ async function H() {
|
|
|
1032
616
|
{
|
|
1033
617
|
name: "RLX UI",
|
|
1034
618
|
description: "A comprehensive UI component library",
|
|
1035
|
-
version: "0.0.
|
|
619
|
+
version: "0.0.3",
|
|
1036
620
|
mcpServer: "@rlx-ui/mcp",
|
|
1037
621
|
stats: {
|
|
1038
|
-
widgets:
|
|
622
|
+
widgets: n.length,
|
|
1039
623
|
components: e.length,
|
|
1040
|
-
animates:
|
|
1041
|
-
hooks:
|
|
1042
|
-
utils:
|
|
1043
|
-
total:
|
|
624
|
+
animates: t.length,
|
|
625
|
+
hooks: r.length,
|
|
626
|
+
utils: i.length,
|
|
627
|
+
total: n.length + e.length + t.length + r.length + i.length
|
|
1044
628
|
}
|
|
1045
629
|
},
|
|
1046
630
|
null,
|
|
@@ -1051,9 +635,9 @@ async function H() {
|
|
|
1051
635
|
};
|
|
1052
636
|
}
|
|
1053
637
|
);
|
|
1054
|
-
const
|
|
1055
|
-
await
|
|
638
|
+
const s = new C();
|
|
639
|
+
await o.connect(s), console.error("RLX UI MCP Server running on stdio");
|
|
1056
640
|
}
|
|
1057
|
-
|
|
1058
|
-
console.error("Fatal error in main():",
|
|
641
|
+
G().catch((o) => {
|
|
642
|
+
console.error("Fatal error in main():", o), process.exit(1);
|
|
1059
643
|
});
|