@getflip/swirl-mcp 0.2.0 → 0.4.0
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/README.md +39 -15
- package/dist/chunk-QVNIVXYL.js +564 -0
- package/dist/transports/http.js +1 -1
- package/dist/transports/stdio.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4X45IM6A.js +0 -282
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @getflip/swirl-mcp
|
|
2
2
|
|
|
3
|
-
MCP server that lets AI agents discover and use
|
|
3
|
+
MCP server that lets AI agents discover and use
|
|
4
|
+
[Swirl Design System](https://getflip.dev) components.
|
|
4
5
|
|
|
5
6
|
## Setup
|
|
6
7
|
|
|
@@ -31,35 +32,58 @@ Add to your MCP settings:
|
|
|
31
32
|
}
|
|
32
33
|
```
|
|
33
34
|
|
|
34
|
-
## Local
|
|
35
|
+
## Local development
|
|
36
|
+
|
|
37
|
+
Inspect the server with the
|
|
38
|
+
[MCP Inspector](https://github.com/modelcontextprotocol/inspector) over either
|
|
39
|
+
transport. Prepend `SWIRL_AI_LOCAL=1` to either command to load artifacts
|
|
40
|
+
from the local monorepo instead of the unpkg CDN.
|
|
35
41
|
|
|
36
42
|
### stdio
|
|
37
43
|
|
|
38
44
|
```sh
|
|
39
|
-
npx @modelcontextprotocol/inspector node dist/transports/stdio.js
|
|
45
|
+
SWIRL_AI_LOCAL=1 npx @modelcontextprotocol/inspector node dist/transports/stdio.js
|
|
40
46
|
```
|
|
41
47
|
|
|
42
48
|
### HTTP
|
|
43
49
|
|
|
44
|
-
Start the server, then open the Inspector and connect with transport type
|
|
50
|
+
Start the server, then open the Inspector and connect with transport type
|
|
51
|
+
"Streamable HTTP" and URL `http://localhost:3000/mcp`:
|
|
45
52
|
|
|
46
53
|
```sh
|
|
47
|
-
npx tsx src/transports/http.ts
|
|
54
|
+
SWIRL_AI_LOCAL=1 npx tsx src/transports/http.ts
|
|
48
55
|
npx @modelcontextprotocol/inspector
|
|
49
56
|
```
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
### `SWIRL_AI_LOCAL`
|
|
52
59
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
When set, agent artifacts are read from `packages/swirl-ai/dist/agent` and
|
|
61
|
+
component source (`get_component_source`) is read from
|
|
62
|
+
`packages/swirl-components/src/components/<tag>/<tag>.{tsx,css}`. The
|
|
63
|
+
`version` parameter is ignored for cache keying. Make sure swirl-ai has been
|
|
64
|
+
built (`pnpm --filter @getflip/swirl-ai build`).
|
|
65
|
+
|
|
66
|
+
## Tools
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
| Tool | Description |
|
|
69
|
+
| ---------------------------- | ---------------------------------------------------------------------------- |
|
|
70
|
+
| **list_components** | Lists all Swirl UI components with brief summaries and related components. |
|
|
71
|
+
| **list_icons** | Lists all Swirl icon components. |
|
|
72
|
+
| **list_symbols** | Lists all Swirl symbol components. |
|
|
73
|
+
| **get_component_details** | Full component docs: props, events, slots, examples, and accessibility info. |
|
|
74
|
+
| **get_component_source** | Versioned original TSX and CSS source for a specific component. |
|
|
75
|
+
| **list_color_tokens** | Lists Swirl color tokens (light + dark) as CSS / SCSS / Tailwind keys. |
|
|
76
|
+
| **list_typography_tokens** | Lists Swirl typography tokens as CSS / SCSS / Tailwind keys. |
|
|
77
|
+
| **list_layout_tokens** | Lists Swirl layout tokens (spacing, radius, shadow, z-index, blur). |
|
|
78
|
+
| **get_started** | Installation and setup guide for Web Components, Angular, and React. |
|
|
79
|
+
|
|
80
|
+
All tools accept a `version` parameter matching the installed
|
|
81
|
+
`@getflip/swirl-components` version.
|
|
62
82
|
|
|
63
83
|
## How it works
|
|
64
84
|
|
|
65
|
-
Component metadata and documentation are fetched at runtime from
|
|
85
|
+
Component metadata and documentation are fetched at runtime from
|
|
86
|
+
`@getflip/swirl-ai` artifacts on the unpkg CDN. Versioned component source is
|
|
87
|
+
fetched from matching `@getflip/swirl-components@<version>` tags in the Swirl
|
|
88
|
+
GitHub repository. Loaded libraries are cached in-memory to avoid redundant
|
|
89
|
+
fetches.
|
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/create-server.ts
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
|
|
6
|
+
// package.json
|
|
7
|
+
var package_default = {
|
|
8
|
+
name: "@getflip/swirl-mcp",
|
|
9
|
+
version: "0.4.0",
|
|
10
|
+
description: "MCP server for Swirl Design System \u2014 lets AI agents discover and use Swirl components",
|
|
11
|
+
author: "Flip GmbH",
|
|
12
|
+
repository: {
|
|
13
|
+
type: "git",
|
|
14
|
+
url: "https://github.com/getflip/swirl"
|
|
15
|
+
},
|
|
16
|
+
license: "SEE LICENSE IN LICENSE.md",
|
|
17
|
+
bugs: {
|
|
18
|
+
url: "https://github.com/getflip/swirl/issues"
|
|
19
|
+
},
|
|
20
|
+
type: "module",
|
|
21
|
+
bin: {
|
|
22
|
+
"swirl-mcp": "dist/transports/stdio.js"
|
|
23
|
+
},
|
|
24
|
+
files: [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
scripts: {
|
|
29
|
+
build: "tsup",
|
|
30
|
+
start: "node dist/transports/http.js",
|
|
31
|
+
dev: "tsx src/transports/stdio.ts",
|
|
32
|
+
"dev:server": "tsx src/transports/http.ts",
|
|
33
|
+
lint: "tsc --noEmit"
|
|
34
|
+
},
|
|
35
|
+
tsup: {
|
|
36
|
+
entry: {
|
|
37
|
+
"transports/stdio": "src/transports/stdio.ts",
|
|
38
|
+
"transports/http": "src/transports/http.ts"
|
|
39
|
+
},
|
|
40
|
+
format: [
|
|
41
|
+
"esm"
|
|
42
|
+
],
|
|
43
|
+
target: "node18",
|
|
44
|
+
outDir: "dist",
|
|
45
|
+
clean: true,
|
|
46
|
+
banner: {
|
|
47
|
+
js: "#!/usr/bin/env node"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
dependencies: {
|
|
51
|
+
"@modelcontextprotocol/sdk": "1.27.1",
|
|
52
|
+
zod: "3.24.0"
|
|
53
|
+
},
|
|
54
|
+
devDependencies: {
|
|
55
|
+
"@types/node": "25.3.0",
|
|
56
|
+
tsup: "^8.0.0",
|
|
57
|
+
tsx: "^4.7.0",
|
|
58
|
+
typescript: "5.9.3"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// src/data-source.ts
|
|
63
|
+
import { readFileSync } from "fs";
|
|
64
|
+
import { dirname, join, resolve } from "path";
|
|
65
|
+
import { fileURLToPath } from "url";
|
|
66
|
+
var RemoteDataSource = class {
|
|
67
|
+
constructor(version) {
|
|
68
|
+
this.version = version;
|
|
69
|
+
}
|
|
70
|
+
async readJson(relativePath) {
|
|
71
|
+
const url = `${this.baseUrl}/${relativePath}`;
|
|
72
|
+
const res = await fetch(url);
|
|
73
|
+
if (!res.ok) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
`Failed to fetch ${url}: ${res.status} ${res.statusText}`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return await res.json();
|
|
79
|
+
}
|
|
80
|
+
async readText(relativePath) {
|
|
81
|
+
const url = `${this.baseUrl}/${relativePath}`;
|
|
82
|
+
return this.readTextUrl(url);
|
|
83
|
+
}
|
|
84
|
+
async readComponentSource(tag) {
|
|
85
|
+
const componentPath = `packages/swirl-components/src/components/${tag}/${tag}`;
|
|
86
|
+
const [tsx, css] = await Promise.all([
|
|
87
|
+
this.readTextUrl(`${this.sourceBaseUrl}/${componentPath}.tsx`),
|
|
88
|
+
this.readTextUrl(`${this.sourceBaseUrl}/${componentPath}.css`)
|
|
89
|
+
]);
|
|
90
|
+
return { tsx, css };
|
|
91
|
+
}
|
|
92
|
+
async readTextUrl(url) {
|
|
93
|
+
try {
|
|
94
|
+
const res = await fetch(url);
|
|
95
|
+
if (!res.ok) {
|
|
96
|
+
return void 0;
|
|
97
|
+
}
|
|
98
|
+
return await res.text();
|
|
99
|
+
} catch {
|
|
100
|
+
return void 0;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
get baseUrl() {
|
|
104
|
+
return `https://unpkg.com/@getflip/swirl-ai@${this.version}/dist/agent`;
|
|
105
|
+
}
|
|
106
|
+
get sourceBaseUrl() {
|
|
107
|
+
return `https://raw.githubusercontent.com/getflip/swirl/@getflip/swirl-components@${this.version}`;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
var LocalDataSource = class {
|
|
111
|
+
async readJson(relativePath) {
|
|
112
|
+
return JSON.parse(readFileSync(this.agentPath(relativePath), "utf8"));
|
|
113
|
+
}
|
|
114
|
+
async readText(relativePath) {
|
|
115
|
+
try {
|
|
116
|
+
return readFileSync(this.agentPath(relativePath), "utf8");
|
|
117
|
+
} catch {
|
|
118
|
+
return void 0;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async readComponentSource(tag) {
|
|
122
|
+
const componentDir = join(packagesDir, "swirl-components", "src", "components", tag);
|
|
123
|
+
const read = (ext) => {
|
|
124
|
+
try {
|
|
125
|
+
return readFileSync(join(componentDir, `${tag}.${ext}`), "utf8");
|
|
126
|
+
} catch {
|
|
127
|
+
return void 0;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return { tsx: read("tsx"), css: read("css") };
|
|
131
|
+
}
|
|
132
|
+
agentPath(relativePath) {
|
|
133
|
+
return join(packagesDir, "swirl-ai", "dist", "agent", relativePath);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var packagesDir = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
137
|
+
|
|
138
|
+
// src/artifact-library.ts
|
|
139
|
+
var ArtifactLibrary = class _ArtifactLibrary {
|
|
140
|
+
catalog;
|
|
141
|
+
tagIndex;
|
|
142
|
+
tokens;
|
|
143
|
+
dataSource;
|
|
144
|
+
constructor(catalog, tokens, dataSource) {
|
|
145
|
+
this.catalog = catalog;
|
|
146
|
+
this.tokens = tokens;
|
|
147
|
+
this.dataSource = dataSource;
|
|
148
|
+
this.tagIndex = /* @__PURE__ */ new Map();
|
|
149
|
+
for (const entry of this.catalog) {
|
|
150
|
+
this.tagIndex.set(entry.tag, entry);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Load artifacts from a remote base URL (CDN).
|
|
155
|
+
*/
|
|
156
|
+
static async fromRemote(version) {
|
|
157
|
+
return _ArtifactLibrary.fromDataSource(new RemoteDataSource(version));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Load artifacts from the local monorepo (`packages/swirl-ai/dist` and
|
|
161
|
+
* `packages/swirl-components/src`) for development against an unpublished
|
|
162
|
+
* swirl-ai build.
|
|
163
|
+
*/
|
|
164
|
+
static async fromLocal() {
|
|
165
|
+
return _ArtifactLibrary.fromDataSource(new LocalDataSource());
|
|
166
|
+
}
|
|
167
|
+
getByCategory(category) {
|
|
168
|
+
return this.catalog.filter((c) => categorize(c.tag) === category);
|
|
169
|
+
}
|
|
170
|
+
getByTag(tag) {
|
|
171
|
+
return this.tagIndex.get(tag);
|
|
172
|
+
}
|
|
173
|
+
async getComponentMarkdown(tag) {
|
|
174
|
+
return this.dataSource.readText(`components/${tag}.md`);
|
|
175
|
+
}
|
|
176
|
+
async getComponentSource(tag) {
|
|
177
|
+
return this.dataSource.readComponentSource(tag);
|
|
178
|
+
}
|
|
179
|
+
async getGuide(name) {
|
|
180
|
+
return this.dataSource.readText(`${name}.md`);
|
|
181
|
+
}
|
|
182
|
+
getTokensByCategory(category) {
|
|
183
|
+
return this.tokens[category];
|
|
184
|
+
}
|
|
185
|
+
static async fromDataSource(dataSource) {
|
|
186
|
+
const [components, tokens] = await Promise.all([
|
|
187
|
+
dataSource.readJson("components-index.json"),
|
|
188
|
+
dataSource.readJson("tokens.json")
|
|
189
|
+
]);
|
|
190
|
+
return new _ArtifactLibrary(components.components, tokens, dataSource);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
function categorize(tag) {
|
|
194
|
+
if (tag.startsWith("swirl-icon-")) {
|
|
195
|
+
return "icon";
|
|
196
|
+
}
|
|
197
|
+
if (tag.startsWith("swirl-symbol-")) {
|
|
198
|
+
return "symbol";
|
|
199
|
+
}
|
|
200
|
+
return "core";
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// src/library-cache.ts
|
|
204
|
+
var LibraryCache = class {
|
|
205
|
+
cache = /* @__PURE__ */ new Map();
|
|
206
|
+
maxSize;
|
|
207
|
+
constructor(maxSize = 20) {
|
|
208
|
+
this.maxSize = maxSize;
|
|
209
|
+
}
|
|
210
|
+
get(version) {
|
|
211
|
+
const lib = this.cache.get(version);
|
|
212
|
+
if (lib) {
|
|
213
|
+
this.cache.delete(version);
|
|
214
|
+
this.cache.set(version, lib);
|
|
215
|
+
}
|
|
216
|
+
return lib;
|
|
217
|
+
}
|
|
218
|
+
set(version, lib) {
|
|
219
|
+
if (this.cache.has(version)) {
|
|
220
|
+
this.cache.delete(version);
|
|
221
|
+
} else if (this.cache.size >= this.maxSize) {
|
|
222
|
+
const oldest = this.cache.keys().next().value;
|
|
223
|
+
this.cache.delete(oldest);
|
|
224
|
+
}
|
|
225
|
+
this.cache.set(version, lib);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// src/tools/get-component-details.ts
|
|
230
|
+
import { z } from "zod";
|
|
231
|
+
var VERSION_DESCRIPTION = "The @getflip/swirl-components version installed in the project. Read the user's package.json or node_modules/@getflip/swirl-components/package.json to find this.";
|
|
232
|
+
function registerGetComponentDetails(server, loadLibrary2) {
|
|
233
|
+
server.registerTool(
|
|
234
|
+
"get_component_details",
|
|
235
|
+
{
|
|
236
|
+
description: "Get full details for a Swirl component including all props with types and defaults, events, methods, slots, accessibility info, and usage examples.",
|
|
237
|
+
inputSchema: {
|
|
238
|
+
tag: z.string().describe('The component tag name, e.g. "swirl-button"'),
|
|
239
|
+
version: z.string().describe(VERSION_DESCRIPTION)
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
// @ts-ignore - MCP SDK + zod 3.x causes excessively deep type instantiation
|
|
243
|
+
async ({ tag, version }) => {
|
|
244
|
+
const lib = await loadLibrary2(version);
|
|
245
|
+
const entry = lib.getByTag(tag);
|
|
246
|
+
if (!entry) {
|
|
247
|
+
return {
|
|
248
|
+
content: [
|
|
249
|
+
{
|
|
250
|
+
type: "text",
|
|
251
|
+
text: `Component "${tag}" not found. Use list_components to see available components.`
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
const markdown = await lib.getComponentMarkdown(tag);
|
|
257
|
+
if (!markdown) {
|
|
258
|
+
return {
|
|
259
|
+
content: [
|
|
260
|
+
{
|
|
261
|
+
type: "text",
|
|
262
|
+
text: `Component "${tag}" exists but no detailed documentation was found.`
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
content: [{ type: "text", text: markdown }]
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// src/tools/get-component-source.ts
|
|
275
|
+
import { z as z2 } from "zod";
|
|
276
|
+
var VERSION_DESCRIPTION2 = "The @getflip/swirl-components version installed in the project. Read the user's package.json or node_modules/@getflip/swirl-components/package.json to find this.";
|
|
277
|
+
function registerGetComponentSource(server, loadLibrary2) {
|
|
278
|
+
server.registerTool(
|
|
279
|
+
"get_component_source",
|
|
280
|
+
{
|
|
281
|
+
description: "Get the versioned original TSX and CSS source files for a Swirl component. Use this when behavior, styling, layout, rendering details, debugging, or uncertainty requires the full implementation.",
|
|
282
|
+
inputSchema: {
|
|
283
|
+
tag: z2.string().describe('The component tag name, e.g. "swirl-button"'),
|
|
284
|
+
version: z2.string().describe(VERSION_DESCRIPTION2)
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
// @ts-ignore - MCP SDK + zod 3.x causes excessively deep type instantiation
|
|
288
|
+
async ({ tag, version }) => {
|
|
289
|
+
const lib = await loadLibrary2(version);
|
|
290
|
+
const entry = lib.getByTag(tag);
|
|
291
|
+
if (!entry) {
|
|
292
|
+
return {
|
|
293
|
+
content: [
|
|
294
|
+
{
|
|
295
|
+
type: "text",
|
|
296
|
+
text: `Component "${tag}" not found. Use list_components to see available components.`
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
const source = await lib.getComponentSource(tag);
|
|
302
|
+
const sections = [
|
|
303
|
+
formatSourceSection(tag, "tsx", source.tsx),
|
|
304
|
+
formatSourceSection(tag, "css", source.css)
|
|
305
|
+
].filter(Boolean);
|
|
306
|
+
if (sections.length === 0) {
|
|
307
|
+
return {
|
|
308
|
+
content: [
|
|
309
|
+
{
|
|
310
|
+
type: "text",
|
|
311
|
+
text: `Component "${tag}" exists but no original source files were found for version "${version}". Make sure the version matches an @getflip/swirl-components release tag.`
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
return {
|
|
317
|
+
content: [{ type: "text", text: sections.join("\n\n") }]
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
function formatSourceSection(tag, extension, content) {
|
|
323
|
+
if (!content) {
|
|
324
|
+
return void 0;
|
|
325
|
+
}
|
|
326
|
+
const path = `packages/swirl-components/src/components/${tag}/${tag}.${extension}`;
|
|
327
|
+
return [`## ${path}`, "", `\`\`\`\`${extension}`, content, "````"].join("\n");
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// src/tools/get-started.ts
|
|
331
|
+
import { z as z3 } from "zod";
|
|
332
|
+
var VERSION_DESCRIPTION3 = "The @getflip/swirl-components version installed in the project. Read the user's package.json or node_modules/@getflip/swirl-components/package.json to find this.";
|
|
333
|
+
function registerGetStarted(server, loadLibrary2) {
|
|
334
|
+
server.registerTool(
|
|
335
|
+
"get_started",
|
|
336
|
+
{
|
|
337
|
+
description: "Get installation and setup instructions for Swirl components. Covers Web Components, Angular, and React wrapper libraries.",
|
|
338
|
+
inputSchema: {
|
|
339
|
+
version: z3.string().describe(VERSION_DESCRIPTION3)
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
async ({ version }) => {
|
|
343
|
+
const lib = await loadLibrary2(version);
|
|
344
|
+
const markdown = await lib.getGuide("get-started");
|
|
345
|
+
if (!markdown) {
|
|
346
|
+
return {
|
|
347
|
+
content: [
|
|
348
|
+
{
|
|
349
|
+
type: "text",
|
|
350
|
+
text: "Getting started guide not found."
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
content: [{ type: "text", text: markdown }]
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// src/tools/list-components.ts
|
|
363
|
+
import { z as z4 } from "zod";
|
|
364
|
+
var VERSION_DESCRIPTION4 = "The @getflip/swirl-components version installed in the project. Read the user's package.json or node_modules/@getflip/swirl-components/package.json to find this.";
|
|
365
|
+
function registerListComponents(server, loadLibrary2) {
|
|
366
|
+
registerListTool(
|
|
367
|
+
server,
|
|
368
|
+
loadLibrary2,
|
|
369
|
+
"list_components",
|
|
370
|
+
"List all Swirl design system UI components (buttons, modals, forms, etc.) with brief summaries and related components. Does NOT include icons or symbols \u2014 use list_icons or list_symbols for those. Use get_component_details for full props, events, slots, and examples.",
|
|
371
|
+
"core"
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
function registerListIcons(server, loadLibrary2) {
|
|
375
|
+
registerListTool(
|
|
376
|
+
server,
|
|
377
|
+
loadLibrary2,
|
|
378
|
+
"list_icons",
|
|
379
|
+
"List all Swirl icon components (swirl-icon-*). Use get_component_details for full details on a specific icon.",
|
|
380
|
+
"icon"
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
function registerListSymbols(server, loadLibrary2) {
|
|
384
|
+
registerListTool(
|
|
385
|
+
server,
|
|
386
|
+
loadLibrary2,
|
|
387
|
+
"list_symbols",
|
|
388
|
+
"List all Swirl symbol components (swirl-symbol-*). Use get_component_details for full details on a specific symbol.",
|
|
389
|
+
"symbol"
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
function registerListTool(server, loadLibrary2, name, description, category) {
|
|
393
|
+
server.registerTool(
|
|
394
|
+
name,
|
|
395
|
+
{
|
|
396
|
+
description,
|
|
397
|
+
inputSchema: {
|
|
398
|
+
version: z4.string().describe(VERSION_DESCRIPTION4)
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
// @ts-ignore - MCP SDK + zod 3.x causes excessively deep type instantiation
|
|
402
|
+
async ({ version }) => {
|
|
403
|
+
const lib = await loadLibrary2(version);
|
|
404
|
+
const components = lib.getByCategory(category);
|
|
405
|
+
return {
|
|
406
|
+
content: [{ type: "text", text: JSON.stringify(components) }]
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// src/tools/list-tokens.ts
|
|
413
|
+
import { z as z5 } from "zod";
|
|
414
|
+
var VERSION_DESCRIPTION5 = "The @getflip/swirl-components version installed in the project. Read the user's package.json or node_modules/@getflip/swirl-components/package.json to find this.";
|
|
415
|
+
var FORMAT_DESCRIPTION = "Output format for the token key. 'css' - CSS custom property. 'scss' - SCSS variable. 'tailwind' - returns `key: '{name}'` + `namespace` (e.g. 'colors', 'fontSize', 'spacing') so the agent can build the right utility class. Pick the format that matches the project's styling stack.";
|
|
416
|
+
function registerListColorTokens(server, loadLibrary2) {
|
|
417
|
+
registerListTokensTool(
|
|
418
|
+
server,
|
|
419
|
+
loadLibrary2,
|
|
420
|
+
"list_color_tokens",
|
|
421
|
+
"List Swirl color tokens with light + dark values. Pass 'format' to choose css / scss / tailwind output. For tailwind, all colors use the 'colors' namespace (e.g. `text-{name}`, `bg-{name}`, `border-{name}`). Prefer these over hard-coded hex/rgb values.",
|
|
422
|
+
"colors"
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
function registerListTypographyTokens(server, loadLibrary2) {
|
|
426
|
+
registerListTokensTool(
|
|
427
|
+
server,
|
|
428
|
+
loadLibrary2,
|
|
429
|
+
"list_typography_tokens",
|
|
430
|
+
"List Swirl typography tokens. Pass 'format' to choose css / scss / tailwind output. Prefer these over ad-hoc font sizes/weights.",
|
|
431
|
+
"typography"
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
function registerListLayoutTokens(server, loadLibrary2) {
|
|
435
|
+
registerListTokensTool(
|
|
436
|
+
server,
|
|
437
|
+
loadLibrary2,
|
|
438
|
+
"list_layout_tokens",
|
|
439
|
+
"List Swirl layout tokens (spacing, border radius, border width, box shadows, z-index, blur). Pass 'format' to choose css / scss / tailwind output. Prefer these over arbitrary px/rem values.",
|
|
440
|
+
"layout"
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
function registerListTokensTool(server, loadLibrary2, name, description, category) {
|
|
444
|
+
server.registerTool(
|
|
445
|
+
name,
|
|
446
|
+
{
|
|
447
|
+
description,
|
|
448
|
+
inputSchema: {
|
|
449
|
+
version: z5.string().describe(VERSION_DESCRIPTION5),
|
|
450
|
+
format: z5.enum(["css", "scss", "tailwind"]).describe(FORMAT_DESCRIPTION)
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
// @ts-ignore - MCP SDK + zod 3.x causes excessively deep type instantiation
|
|
454
|
+
async ({ version, format }) => {
|
|
455
|
+
const lib = await loadLibrary2(version);
|
|
456
|
+
const tokens = lib.getTokensByCategory(category);
|
|
457
|
+
const formatted = tokens.map((t) => formatToken(t, format)).filter((t) => t !== null);
|
|
458
|
+
return {
|
|
459
|
+
content: [{ type: "text", text: JSON.stringify(formatted) }]
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
function formatToken(token, format) {
|
|
465
|
+
if (format === "tailwind" && !token.tailwindNamespace) {
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
const out = { key: tokenKey(token, format) };
|
|
469
|
+
if (format === "tailwind") {
|
|
470
|
+
out.namespace = token.tailwindNamespace;
|
|
471
|
+
}
|
|
472
|
+
if (token.valueLight !== void 0) {
|
|
473
|
+
out.valueLight = token.valueLight;
|
|
474
|
+
out.valueDark = token.valueDark;
|
|
475
|
+
} else if (token.value !== void 0) {
|
|
476
|
+
out.value = token.value;
|
|
477
|
+
}
|
|
478
|
+
if (token.description) {
|
|
479
|
+
out.description = token.description;
|
|
480
|
+
}
|
|
481
|
+
return out;
|
|
482
|
+
}
|
|
483
|
+
function tokenKey(token, format) {
|
|
484
|
+
switch (format) {
|
|
485
|
+
case "css":
|
|
486
|
+
return `--s-${token.name}`;
|
|
487
|
+
case "scss":
|
|
488
|
+
return `$s-${token.name}`;
|
|
489
|
+
case "tailwind":
|
|
490
|
+
return token.name;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// src/create-server.ts
|
|
495
|
+
var cache = new LibraryCache();
|
|
496
|
+
var useLocal = Boolean(process.env.SWIRL_AI_LOCAL);
|
|
497
|
+
async function loadLibrary(version) {
|
|
498
|
+
const cacheKey = useLocal ? "__local__" : version;
|
|
499
|
+
const cached = cache.get(cacheKey);
|
|
500
|
+
if (cached) {
|
|
501
|
+
return cached;
|
|
502
|
+
}
|
|
503
|
+
try {
|
|
504
|
+
const lib = useLocal ? await ArtifactLibrary.fromLocal() : await ArtifactLibrary.fromRemote(version);
|
|
505
|
+
cache.set(cacheKey, lib);
|
|
506
|
+
return lib;
|
|
507
|
+
} catch (error) {
|
|
508
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
509
|
+
if (useLocal) {
|
|
510
|
+
throw new Error(
|
|
511
|
+
`Failed to load local swirl-ai artifacts. Make sure swirl-ai has been built (\`pnpm --filter @getflip/swirl-ai build\`). Details: ${message}`
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
throw new Error(
|
|
515
|
+
`Version "${version}" not found or failed to load. Make sure the version matches your installed @getflip/swirl-components version. Details: ${message}`
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
var INSTRUCTIONS = `Use this server as the authoritative, version-aware source for the Swirl design system (@getflip/swirl-components).
|
|
520
|
+
|
|
521
|
+
If a project has @getflip/swirl-components installed, use Swirl as the default
|
|
522
|
+
UI system for all UI work. Prefer Swirl components, icons, symbols, tokens, and
|
|
523
|
+
documented patterns over custom UI. Only build custom UI when no suitable Swirl
|
|
524
|
+
component or pattern exists.
|
|
525
|
+
|
|
526
|
+
For any UI task in a project that uses Swirl, call the appropriate Swirl MCP
|
|
527
|
+
tool before choosing or implementing UI. Do not infer component APIs, prop names,
|
|
528
|
+
token values, icon names, or usage patterns from memory.
|
|
529
|
+
|
|
530
|
+
Use get_component_details for documented component APIs, accessibility guidance,
|
|
531
|
+
slots, events, examples, and related components. When behavior, styling, layout,
|
|
532
|
+
rendering details, debugging, or uncertainty requires the full picture, use
|
|
533
|
+
get_component_source to read the versioned original source and styles for the
|
|
534
|
+
specific component as well.
|
|
535
|
+
|
|
536
|
+
Every tool requires a 'version' parameter matching the project's
|
|
537
|
+
installed @getflip/swirl-components version. Read it from the user's
|
|
538
|
+
package.json (or node_modules/@getflip/swirl-components/package.json)
|
|
539
|
+
before the first tool call and reuse it for subsequent calls.`;
|
|
540
|
+
function createMcpServer() {
|
|
541
|
+
const server = new McpServer(
|
|
542
|
+
{
|
|
543
|
+
name: "swirl-mcp",
|
|
544
|
+
version: package_default.version
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
instructions: INSTRUCTIONS
|
|
548
|
+
}
|
|
549
|
+
);
|
|
550
|
+
registerListComponents(server, loadLibrary);
|
|
551
|
+
registerListIcons(server, loadLibrary);
|
|
552
|
+
registerListSymbols(server, loadLibrary);
|
|
553
|
+
registerGetComponentDetails(server, loadLibrary);
|
|
554
|
+
registerGetComponentSource(server, loadLibrary);
|
|
555
|
+
registerGetStarted(server, loadLibrary);
|
|
556
|
+
registerListColorTokens(server, loadLibrary);
|
|
557
|
+
registerListTypographyTokens(server, loadLibrary);
|
|
558
|
+
registerListLayoutTokens(server, loadLibrary);
|
|
559
|
+
return server;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
export {
|
|
563
|
+
createMcpServer
|
|
564
|
+
};
|
package/dist/transports/http.js
CHANGED
package/dist/transports/stdio.js
CHANGED
package/package.json
CHANGED
package/dist/chunk-4X45IM6A.js
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/create-server.ts
|
|
4
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
-
|
|
6
|
-
// src/data-source.ts
|
|
7
|
-
var DataSource = class {
|
|
8
|
-
constructor(version) {
|
|
9
|
-
this.version = version;
|
|
10
|
-
}
|
|
11
|
-
async readJson(relativePath) {
|
|
12
|
-
const url = `${this.baseUrl}/${relativePath}`;
|
|
13
|
-
const res = await fetch(url);
|
|
14
|
-
if (!res.ok) {
|
|
15
|
-
throw new Error(
|
|
16
|
-
`Failed to fetch ${url}: ${res.status} ${res.statusText}`
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
return await res.json();
|
|
20
|
-
}
|
|
21
|
-
async readText(relativePath) {
|
|
22
|
-
const url = `${this.baseUrl}/${relativePath}`;
|
|
23
|
-
try {
|
|
24
|
-
const res = await fetch(url);
|
|
25
|
-
if (!res.ok) {
|
|
26
|
-
return void 0;
|
|
27
|
-
}
|
|
28
|
-
return await res.text();
|
|
29
|
-
} catch {
|
|
30
|
-
return void 0;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
get baseUrl() {
|
|
34
|
-
return `https://unpkg.com/@getflip/swirl-ai@${this.version}/dist/agent`;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// src/artifact-library.ts
|
|
39
|
-
var ArtifactLibrary = class _ArtifactLibrary {
|
|
40
|
-
catalog;
|
|
41
|
-
tagIndex;
|
|
42
|
-
dataSource;
|
|
43
|
-
constructor(catalog, dataSource) {
|
|
44
|
-
this.catalog = catalog;
|
|
45
|
-
this.dataSource = dataSource;
|
|
46
|
-
this.tagIndex = /* @__PURE__ */ new Map();
|
|
47
|
-
for (const entry of this.catalog) {
|
|
48
|
-
this.tagIndex.set(entry.tag, entry);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Load artifacts from a remote base URL (CDN).
|
|
53
|
-
*/
|
|
54
|
-
static async fromRemote(version) {
|
|
55
|
-
const ds = new DataSource(version);
|
|
56
|
-
const json = await ds.readJson(
|
|
57
|
-
"components-index.json"
|
|
58
|
-
);
|
|
59
|
-
return new _ArtifactLibrary(json.components, ds);
|
|
60
|
-
}
|
|
61
|
-
getByCategory(category) {
|
|
62
|
-
return this.catalog.filter((c) => categorize(c.tag) === category);
|
|
63
|
-
}
|
|
64
|
-
getByTag(tag) {
|
|
65
|
-
return this.tagIndex.get(tag);
|
|
66
|
-
}
|
|
67
|
-
async getComponentMarkdown(tag) {
|
|
68
|
-
return this.dataSource.readText(`components/${tag}.md`);
|
|
69
|
-
}
|
|
70
|
-
async getGuide(name) {
|
|
71
|
-
return this.dataSource.readText(`${name}.md`);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
function categorize(tag) {
|
|
75
|
-
if (tag.startsWith("swirl-icon-")) {
|
|
76
|
-
return "icon";
|
|
77
|
-
}
|
|
78
|
-
if (tag.startsWith("swirl-symbol-")) {
|
|
79
|
-
return "symbol";
|
|
80
|
-
}
|
|
81
|
-
return "core";
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// src/library-cache.ts
|
|
85
|
-
var LibraryCache = class {
|
|
86
|
-
cache = /* @__PURE__ */ new Map();
|
|
87
|
-
maxSize;
|
|
88
|
-
constructor(maxSize = 20) {
|
|
89
|
-
this.maxSize = maxSize;
|
|
90
|
-
}
|
|
91
|
-
get(version) {
|
|
92
|
-
const lib = this.cache.get(version);
|
|
93
|
-
if (lib) {
|
|
94
|
-
this.cache.delete(version);
|
|
95
|
-
this.cache.set(version, lib);
|
|
96
|
-
}
|
|
97
|
-
return lib;
|
|
98
|
-
}
|
|
99
|
-
set(version, lib) {
|
|
100
|
-
if (this.cache.has(version)) {
|
|
101
|
-
this.cache.delete(version);
|
|
102
|
-
} else if (this.cache.size >= this.maxSize) {
|
|
103
|
-
const oldest = this.cache.keys().next().value;
|
|
104
|
-
this.cache.delete(oldest);
|
|
105
|
-
}
|
|
106
|
-
this.cache.set(version, lib);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
// src/tools/list-components.ts
|
|
111
|
-
import { z } from "zod";
|
|
112
|
-
var VERSION_DESCRIPTION = "The @getflip/swirl-components version installed in the project. Read the user's package.json or node_modules/@getflip/swirl-components/package.json to find this.";
|
|
113
|
-
function registerListComponents(server, loadLibrary2) {
|
|
114
|
-
registerListTool(
|
|
115
|
-
server,
|
|
116
|
-
loadLibrary2,
|
|
117
|
-
"list_components",
|
|
118
|
-
"List all Swirl design system UI components (buttons, modals, forms, etc.) with brief summaries and related components. Does NOT include icons or symbols \u2014 use list_icons or list_symbols for those. Use get_component_details for full props, events, slots, and examples. IMPORTANT: First read the user's package.json to determine their installed @getflip/swirl-components version, then pass it as the 'version' parameter.",
|
|
119
|
-
"core"
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
function registerListIcons(server, loadLibrary2) {
|
|
123
|
-
registerListTool(
|
|
124
|
-
server,
|
|
125
|
-
loadLibrary2,
|
|
126
|
-
"list_icons",
|
|
127
|
-
"List all Swirl icon components (swirl-icon-*). Use get_component_details for full details on a specific icon. IMPORTANT: First read the user's package.json to determine their installed @getflip/swirl-components version, then pass it as the 'version' parameter.",
|
|
128
|
-
"icon"
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
function registerListSymbols(server, loadLibrary2) {
|
|
132
|
-
registerListTool(
|
|
133
|
-
server,
|
|
134
|
-
loadLibrary2,
|
|
135
|
-
"list_symbols",
|
|
136
|
-
"List all Swirl symbol components (swirl-symbol-*). Use get_component_details for full details on a specific symbol. IMPORTANT: First read the user's package.json to determine their installed @getflip/swirl-components version, then pass it as the 'version' parameter.",
|
|
137
|
-
"symbol"
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
function registerListTool(server, loadLibrary2, name, description, category) {
|
|
141
|
-
server.registerTool(
|
|
142
|
-
name,
|
|
143
|
-
{
|
|
144
|
-
description,
|
|
145
|
-
inputSchema: {
|
|
146
|
-
version: z.string().describe(VERSION_DESCRIPTION)
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
// @ts-ignore - MCP SDK + zod 3.x causes excessively deep type instantiation
|
|
150
|
-
async ({ version }) => {
|
|
151
|
-
const lib = await loadLibrary2(version);
|
|
152
|
-
const components = lib.getByCategory(category);
|
|
153
|
-
return {
|
|
154
|
-
content: [{ type: "text", text: JSON.stringify(components) }]
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// src/tools/get-component-details.ts
|
|
161
|
-
import { z as z2 } from "zod";
|
|
162
|
-
var VERSION_DESCRIPTION2 = "The @getflip/swirl-components version installed in the project. Read the user's package.json or node_modules/@getflip/swirl-components/package.json to find this.";
|
|
163
|
-
function registerGetComponentDetails(server, loadLibrary2) {
|
|
164
|
-
server.registerTool(
|
|
165
|
-
"get_component_details",
|
|
166
|
-
{
|
|
167
|
-
description: "Get full details for a Swirl component including all props with types and defaults, events, methods, slots, accessibility info, and usage examples. IMPORTANT: First read the user's package.json to determine their installed @getflip/swirl-components version, then pass it as the 'version' parameter.",
|
|
168
|
-
inputSchema: {
|
|
169
|
-
tag: z2.string().describe('The component tag name, e.g. "swirl-button"'),
|
|
170
|
-
version: z2.string().describe(VERSION_DESCRIPTION2)
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
// @ts-ignore - MCP SDK + zod 3.x causes excessively deep type instantiation
|
|
174
|
-
async ({ tag, version }) => {
|
|
175
|
-
const lib = await loadLibrary2(version);
|
|
176
|
-
const entry = lib.getByTag(tag);
|
|
177
|
-
if (!entry) {
|
|
178
|
-
return {
|
|
179
|
-
content: [
|
|
180
|
-
{
|
|
181
|
-
type: "text",
|
|
182
|
-
text: `Component "${tag}" not found. Use list_components to see available components.`
|
|
183
|
-
}
|
|
184
|
-
]
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
const markdown = await lib.getComponentMarkdown(tag);
|
|
188
|
-
if (!markdown) {
|
|
189
|
-
return {
|
|
190
|
-
content: [
|
|
191
|
-
{
|
|
192
|
-
type: "text",
|
|
193
|
-
text: `Component "${tag}" exists but no detailed documentation was found.`
|
|
194
|
-
}
|
|
195
|
-
]
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
content: [{ type: "text", text: markdown }]
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// src/tools/get-started.ts
|
|
206
|
-
import { z as z3 } from "zod";
|
|
207
|
-
var VERSION_DESCRIPTION3 = "The @getflip/swirl-components version installed in the project. Read the user's package.json or node_modules/@getflip/swirl-components/package.json to find this.";
|
|
208
|
-
function registerGetStarted(server, loadLibrary2) {
|
|
209
|
-
server.registerTool(
|
|
210
|
-
"get_started",
|
|
211
|
-
{
|
|
212
|
-
description: "Get installation and setup instructions for Swirl components. Covers Web Components, Angular, and React wrapper libraries. IMPORTANT: First read the user's package.json to determine their installed @getflip/swirl-components version, then pass it as the 'version' parameter.",
|
|
213
|
-
inputSchema: {
|
|
214
|
-
version: z3.string().describe(VERSION_DESCRIPTION3)
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
async ({ version }) => {
|
|
218
|
-
const lib = await loadLibrary2(version);
|
|
219
|
-
const markdown = await lib.getGuide("get-started");
|
|
220
|
-
if (!markdown) {
|
|
221
|
-
return {
|
|
222
|
-
content: [
|
|
223
|
-
{
|
|
224
|
-
type: "text",
|
|
225
|
-
text: "Getting started guide not found."
|
|
226
|
-
}
|
|
227
|
-
]
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
content: [{ type: "text", text: markdown }]
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// src/create-server.ts
|
|
238
|
-
var cache = new LibraryCache();
|
|
239
|
-
async function loadLibrary(version) {
|
|
240
|
-
const cached = cache.get(version);
|
|
241
|
-
if (cached) {
|
|
242
|
-
return cached;
|
|
243
|
-
}
|
|
244
|
-
try {
|
|
245
|
-
const lib = await ArtifactLibrary.fromRemote(version);
|
|
246
|
-
cache.set(version, lib);
|
|
247
|
-
return lib;
|
|
248
|
-
} catch (error) {
|
|
249
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
250
|
-
throw new Error(
|
|
251
|
-
`Version "${version}" not found or failed to load. Make sure the version matches your installed @getflip/swirl-components version. Details: ${message}`
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
var INSTRUCTIONS = `The authoritative source for the Swirl design system (@getflip/swirl-components).
|
|
256
|
-
Covers components, icons, symbols, and usage guidance.
|
|
257
|
-
|
|
258
|
-
For any task involving Swirl \u2014 a swirl-* component (e.g. swirl-button,
|
|
259
|
-
swirl-file-chip), an icon or the design system in general \u2014
|
|
260
|
-
you MUST call the appropriate tool on this server BEFORE reading Swirl
|
|
261
|
-
source files, grepping the repo, or searching the web. Do not infer
|
|
262
|
-
component APIs, prop names, token values, or icon names from source code,
|
|
263
|
-
type definitions, or memory \u2014 they may be outdated. This server is the
|
|
264
|
-
source of truth.`;
|
|
265
|
-
function createMcpServer() {
|
|
266
|
-
const server = new McpServer({
|
|
267
|
-
name: "swirl-mcp",
|
|
268
|
-
version: "0.1.0"
|
|
269
|
-
}, {
|
|
270
|
-
instructions: INSTRUCTIONS
|
|
271
|
-
});
|
|
272
|
-
registerListComponents(server, loadLibrary);
|
|
273
|
-
registerListIcons(server, loadLibrary);
|
|
274
|
-
registerListSymbols(server, loadLibrary);
|
|
275
|
-
registerGetComponentDetails(server, loadLibrary);
|
|
276
|
-
registerGetStarted(server, loadLibrary);
|
|
277
|
-
return server;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
export {
|
|
281
|
-
createMcpServer
|
|
282
|
-
};
|