@wizeworks/silicaui-mcp 0.36.0 → 0.38.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/dist/server.js CHANGED
@@ -28,12 +28,50 @@ function readOwnVersion() {
28
28
  return "unknown";
29
29
  }
30
30
  var VERSION = readOwnVersion();
31
+ var INSTRUCTIONS = `Silica UI is ONE design system delivered through THREE paths. Decide which path matches the code you are writing BEFORE writing any markup \u2014 the paths share a class vocabulary but are not interchangeable, and mixing them is the most common way an integration breaks.
32
+
33
+ 1. CSS \u2014 \`@wizeworks/silicaui\`
34
+ A Tailwind v4 plugin. You write plain HTML and put Silica's classes on it: \`<button class="btn btn-primary">\`. No JavaScript ships, so nothing is interactive \u2014 a dialog styled this way will not open. Use it for static markup, server-rendered templates (Rails, Django, PHP, Go, \u2026), email, or any framework at all. It is the floor the other two paths stand on.
35
+ \u2192 get_component(name, package "@wizeworks/silicaui") for a family's root class, its parts, and its color variants; list_classes for the literal names.
36
+
37
+ 2. React \u2014 \`@wizeworks/silicaui-react\`
38
+ Typed React components over those same classes, with Base UI supplying real behavior and accessibility: \`<Button color="primary" size="lg">\`. Use it whenever the output is React or Next.js.
39
+ \u2192 get_component(name, package "@wizeworks/silicaui-react") for real props (extracted from the TypeScript source) and a working usage example.
40
+
41
+ 3. HTML / node-tree \u2014 \`@wizeworks/silicaui-html\` + \`@wizeworks/silicaui-behaviors\`
42
+ A framework-neutral node-tree schema that projects to HTML \u2014 for generated or user-authored documents: site builders, CMS output, static export. Component macros expand to element subtrees carrying \`data-sui-*\` markers, which the zero-dependency \`@wizeworks/silicaui-behaviors\` runtime hydrates at load. That runtime is what makes path 3 interactive; without it you have path 1.
43
+ \u2192 get_node_schema FIRST for the tree's own shape: the node kinds, the data-binding vocabulary (how a node draws live content, repeats over a collection, or hides itself), the resolution contract, and the tag/attribute allowlist \`toHtml\` enforces. Then get_component(name, package "@wizeworks/silicaui-html") for the macro; list_blocks / get_block for composed sections; list_behaviors for the marker contract.
44
+ Path 3 fails SILENTLY where the others fail loudly \u2014 an unlisted tag becomes a <div>, an unlisted attribute is dropped, an invented binding field is not persisted, and the output still looks plausible. Look it up.
45
+
46
+ Rules that hold on every path:
47
+ - Never invent a class, prop, color, or block key. Everything this server returns is extracted from Silica's source at release time \u2014 look it up rather than guessing, including when you are fairly confident.
48
+ - Colors are semantic tokens (get_tokens), never hex. An app can declare extra color roles; those work everywhere a built-in one does.
49
+ - Do not re-skin a component with inline styles or arbitrary hex \u2014 it defeats theming and light/dark.
50
+ - The same name can exist on more than one path with a different shape. get_component with no \`package\` returns every path's answer at once; pass \`package\` to narrow.
51
+ - Don't know the name? search_docs first. Unsure what to install? list_packages.
52
+
53
+ Authoring an EMAIL through \`@wizeworks/silicaui-builder/email\`? That is a separate surface, not a fourth path: a CLOSED document schema of typed nodes that projects to table-based inline-styled HTML. Its kinds, fields, and nesting rules are enforced \u2014 an invented kind or an illegal nesting is dropped silently, with no error to read \u2014 so call list_email_nodes / get_email_node rather than reasoning from the paths above. Classes and components do not apply there; colors are literal hex.
54
+
55
+ Signs you are on the wrong path: importing @wizeworks/silicaui-react into output that is not React; hand-writing \`data-sui-*\` markers (they come from macro expansion, never from you); shipping path-3 markup without loading @wizeworks/silicaui-behaviors; expecting path 1 alone to open a dialog.`;
31
56
  var packages = loadJson("packages");
32
57
  var tokens = loadJson("tokens");
33
58
  var classesByComponent = loadJson("classes");
34
59
  var blocks = loadJson("blocks");
35
60
  var behaviors = loadJson("behaviors");
36
61
  var components = loadJson("components");
62
+ var email = loadJson("email");
63
+ var schema = loadJson("schema");
64
+ var PATH_ORDER_LIST = [
65
+ "@wizeworks/silicaui",
66
+ "@wizeworks/silicaui-react",
67
+ "@wizeworks/silicaui-html"
68
+ ];
69
+ var PATH_ORDER = {
70
+ indexOf(pkg) {
71
+ const i = PATH_ORDER_LIST.indexOf(pkg);
72
+ return i === -1 ? PATH_ORDER_LIST.length : i;
73
+ }
74
+ };
37
75
  function toKebab(name) {
38
76
  return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
39
77
  }
@@ -42,10 +80,13 @@ function blockSummary(b) {
42
80
  return summary;
43
81
  }
44
82
  function createServer() {
45
- const server = new McpServer({
46
- name: "@wizeworks/silicaui-mcp",
47
- version: VERSION
48
- });
83
+ const server = new McpServer(
84
+ {
85
+ name: "@wizeworks/silicaui-mcp",
86
+ version: VERSION
87
+ },
88
+ { instructions: INSTRUCTIONS }
89
+ );
49
90
  server.registerTool(
50
91
  "list_packages",
51
92
  {
@@ -71,7 +112,7 @@ function createServer() {
71
112
  "list_components",
72
113
  {
73
114
  title: "List Silica UI components",
74
- description: "List component names, categories, and source packages \u2014 spans BOTH @wizeworks/silicaui-react (typed React components) and @wizeworks/silicaui-html (the framework-neutral ComponentDef macros: Dialog, Popover, Combobox, etc., for non-React output). The same name can exist in both packages with different shapes; use get_component's package param to disambiguate. Optionally filter to one package (e.g. '@wizeworks/silicaui-react', '@wizeworks/silicaui-html', '@wizeworks/silicaui-charts').",
115
+ description: "List component names, categories, and source packages \u2014 spans ALL THREE delivery paths: @wizeworks/silicaui (CSS class families for plain HTML), @wizeworks/silicaui-react (typed React components), and @wizeworks/silicaui-html (framework-neutral ComponentDef macros for generated/non-React output). The same component usually exists on more than one path with a completely different shape; get_component returns every path's answer unless you pass a package. Filter here with the package param (e.g. '@wizeworks/silicaui', '@wizeworks/silicaui-react', '@wizeworks/silicaui-html', '@wizeworks/silicaui-charts').",
75
116
  inputSchema: {
76
117
  package: z.string().optional().describe("Filter to one package name, e.g. '@wizeworks/silicaui-react'.")
77
118
  }
@@ -91,7 +132,7 @@ function createServer() {
91
132
  "get_component",
92
133
  {
93
134
  title: "Get a Silica UI component's real shape",
94
- description: "Get a component's real definition \u2014 for @wizeworks/silicaui-react: props (name, type, optional, doc \u2014 extracted from its actual TypeScript source) and a real, working usage example from the playground demos; for @wizeworks/silicaui-html: its palette category/label/icon, whether it's a container, and the BehaviorType(s) it carries (cross-reference with get_behavior for the marker contract). Use this instead of guessing prop names or shapes. Pass package when a name exists in more than one package.",
135
+ description: "Get a component's real definition on whichever delivery path you're building on \u2014 for @wizeworks/silicaui (CSS): the family's root class, every literal class it generates, its color variants, and any compound selector that reveals required markup structure; for @wizeworks/silicaui-react: props (name, type, optional, doc \u2014 extracted from its actual TypeScript source) plus a real, working usage example; for @wizeworks/silicaui-html: its palette category/label/icon, whether it's a container, and the BehaviorType(s) it carries (cross-reference get_behavior for the marker contract). Use this instead of guessing class names, prop names, or shapes. Omit package to see every path's answer side by side; pass it to get just one.",
95
136
  inputSchema: {
96
137
  name: z.string().describe("Component name, e.g. 'Button', 'DataTable', 'Dialog'."),
97
138
  package: z.string().optional().describe("Disambiguate when the name exists in more than one package, e.g. '@wizeworks/silicaui-html'.")
@@ -112,14 +153,24 @@ function createServer() {
112
153
  };
113
154
  }
114
155
  if (matches.length > 1) {
156
+ const ordered = [...matches].sort(
157
+ (a, b) => PATH_ORDER.indexOf(a.package) - PATH_ORDER.indexOf(b.package)
158
+ );
115
159
  return {
116
160
  content: [
117
161
  {
118
162
  type: "text",
119
- text: `"${name}" exists in more than one package \u2014 pass package to disambiguate: ${matches.map((c) => c.package).join(", ")}`
163
+ text: JSON.stringify(
164
+ {
165
+ name: ordered[0]?.name ?? name,
166
+ note: `"${name}" exists on ${ordered.length} delivery paths, listed below with their real (different) shapes: ${ordered.map((c) => c.package).join(", ")}. Use the one matching the code you're writing \u2014 they are not interchangeable. Pass \`package\` to get just one.`,
167
+ paths: ordered
168
+ },
169
+ null,
170
+ 2
171
+ )
120
172
  }
121
- ],
122
- isError: true
173
+ ]
123
174
  };
124
175
  }
125
176
  return { content: [{ type: "text", text: JSON.stringify(matches[0], null, 2) }] };
@@ -129,7 +180,7 @@ function createServer() {
129
180
  "list_classes",
130
181
  {
131
182
  title: "List real Silica UI CSS class names",
132
- description: "List the exact, literal CSS class names Silica UI generates for a core component (e.g. 'button', 'card', 'badge') \u2014 or all components if none given. These are extracted directly from the class generators, so they are never hallucinated. Also covers 'color-utilities' (text-*/bg-*/border-* for every declared color).",
183
+ description: "List the exact, literal CSS class names Silica UI generates for a core component (e.g. 'button', 'card', 'badge') \u2014 or all components if none given. These are extracted directly from the class generators, so they are never hallucinated. Also covers 'color-utilities' (text-*/bg-*/border-* for every declared color). This returns a flat list; for the CSS path's STRUCTURE \u2014 which class is the root, which are its parts, which are color variants \u2014 call get_component with package '@wizeworks/silicaui'.",
133
184
  inputSchema: {
134
185
  component: z.string().optional().describe("A core @wizeworks/silicaui component name, e.g. 'button'. Omit to list every component's classes.")
135
186
  }
@@ -239,11 +290,119 @@ function createServer() {
239
290
  return { content: [{ type: "text", text: JSON.stringify(behavior, null, 2) }] };
240
291
  }
241
292
  );
293
+ server.registerTool(
294
+ "list_email_nodes",
295
+ {
296
+ title: "List the email builder's node kinds",
297
+ description: "List every node kind an email document can contain (@wizeworks/silicaui-builder/email) with its nesting rules \u2014 what each kind may HOLD and which kinds may hold IT \u2014 plus the insertable palette presets. This schema is CLOSED and enforced: `EmailEditor.insert` returns undefined for an illegal kind or nesting, silently, so check here rather than assuming a site/HTML structure carries over. Email nodes carry typed fields, not classes, and literal hex colors, not tokens. Call get_email_node for one kind's real fields.",
298
+ inputSchema: {}
299
+ },
300
+ async () => ({
301
+ content: [
302
+ {
303
+ type: "text",
304
+ text: JSON.stringify(
305
+ {
306
+ entrypoint: email.entrypoint,
307
+ reactEntrypoint: email.reactEntrypoint,
308
+ note: email.note,
309
+ bindingNote: email.bindingNote,
310
+ kinds: email.kinds.map(({ kind, typeName, isContent, container, holds, allowedParents, binding }) => ({
311
+ kind,
312
+ typeName,
313
+ isContent,
314
+ container,
315
+ holds,
316
+ allowedParents,
317
+ bindableFields: binding ? Object.keys(binding.fields) : [],
318
+ defaultBindTarget: binding?.default ?? null
319
+ })),
320
+ palette: email.palette,
321
+ // The envelope, in full: it's small, and a caller that has the
322
+ // kinds but not `EmailDocument` still can't produce a document.
323
+ documentTypes: email.documentTypes
324
+ },
325
+ null,
326
+ 2
327
+ )
328
+ }
329
+ ]
330
+ })
331
+ );
332
+ server.registerTool(
333
+ "get_email_node",
334
+ {
335
+ title: "Get an email node kind's real fields",
336
+ description: "Get one email node kind's full definition: every typed field with its TypeScript type, whether it's optional, and its source doc comment; the fields shared by every node (id/ord/data/locked); its nesting rules; and its data-binding contract \u2014 which `attr` a `value` bind may target and which one a bind with no `attr` fills. Use this instead of guessing field names: an unknown field is dropped by the engine and an unknown bind target is inert, neither with an error.",
337
+ inputSchema: {
338
+ kind: z.string().describe("Node kind, e.g. 'link', 'image', 'section'. See list_email_nodes.")
339
+ }
340
+ },
341
+ async ({ kind }) => {
342
+ const node = email.kinds.find((k) => k.kind === kind.toLowerCase());
343
+ if (!node) {
344
+ return {
345
+ content: [
346
+ {
347
+ type: "text",
348
+ text: `No email node kind "${kind}". Known kinds: ${email.kinds.map((k) => k.kind).join(", ")}`
349
+ }
350
+ ],
351
+ isError: true
352
+ };
353
+ }
354
+ return {
355
+ content: [
356
+ {
357
+ type: "text",
358
+ text: JSON.stringify(
359
+ {
360
+ ...node,
361
+ sharedFields: email.sharedFields,
362
+ bindingNote: email.bindingNote,
363
+ palette: email.palette.filter((p) => p.kind === node.kind)
364
+ },
365
+ null,
366
+ 2
367
+ )
368
+ }
369
+ ]
370
+ };
371
+ }
372
+ );
373
+ server.registerTool(
374
+ "get_node_schema",
375
+ {
376
+ title: "Get the Silica UI node-tree schema (path 3)",
377
+ description: "Get the DOCUMENT schema for @wizeworks/silicaui-html \u2014 the shape of the tree itself, as opposed to what you put in it. Covers the four node kinds and their fields, the typed system-metadata band every node carries (data / slot / behavior / part / locked / instanceOf), the DATA-BINDING vocabulary with every field, the resolution contract a host implements, and the raw-element/attribute allowlist `toHtml` enforces. Call this before authoring or generating a node tree: the failures here are SILENT \u2014 an unlisted tag is downgraded to <div>, an unlisted attribute is dropped, an invented binding field is not persisted \u2014 so none of it can be inferred from output that looks like it worked. Not needed for path 1 (CSS classes on your own HTML) or path 2 (React).",
378
+ inputSchema: {
379
+ section: z.enum(["all", "nodes", "bindings", "resolution", "elements"]).optional().describe(
380
+ "Narrow the answer: 'nodes' (kinds + the shared metadata band), 'bindings' (the data vocabulary), 'resolution' (the host hooks and their honesty contract), 'elements' (the tag/attribute floor). Omit for everything."
381
+ )
382
+ }
383
+ },
384
+ async ({ section }) => {
385
+ const head = {
386
+ entrypoint: schema.entrypoint,
387
+ behaviorRuntime: schema.behaviorRuntime,
388
+ sourceFile: schema.sourceFile,
389
+ note: schema.note
390
+ };
391
+ const sections = {
392
+ nodes: { child: schema.child, nodeBase: schema.nodeBase, kinds: schema.kinds },
393
+ bindings: { bindingNote: schema.bindingNote, dataBindings: schema.dataBindings },
394
+ resolution: schema.resolution,
395
+ elements: schema.elementFloor
396
+ };
397
+ const body = !section || section === "all" ? { ...sections.nodes, ...sections.bindings, resolution: schema.resolution, elementFloor: schema.elementFloor } : sections[section];
398
+ return { content: [{ type: "text", text: JSON.stringify({ ...head, ...body }, null, 2) }] };
399
+ }
400
+ );
242
401
  server.registerTool(
243
402
  "search_docs",
244
403
  {
245
404
  title: "Search Silica UI catalog data",
246
- description: "Full-text search across everything this server knows: component names/descriptions, block names/descriptions, behavior descriptions, literal CSS class names, and design tokens. Use this when you don't know the exact name to look up.",
405
+ description: "Full-text search across everything this server knows: component names/descriptions, block names/descriptions, behavior descriptions, literal CSS class names, design tokens, and the email builder's node kinds + their fields. Use this when you don't know the exact name to look up.",
247
406
  inputSchema: {
248
407
  query: z.string().describe("Search term, case-insensitive.")
249
408
  }
@@ -257,12 +416,28 @@ function createServer() {
257
416
  ([component, classes]) => classes.filter((cls) => cls.toLowerCase().includes(q)).map((cls) => ({ kind: "class", component, class: cls }))
258
417
  );
259
418
  const matchedTokens = tokens.semanticColors.filter((name) => name.toLowerCase().includes(q)).map((name) => ({ kind: "token", name }));
419
+ const matchedBindings = schema.dataBindings.filter(
420
+ (b) => b.kind.toLowerCase().includes(q) || b.doc.toLowerCase().includes(q) || b.fields.some((f) => f.name.toLowerCase().includes(q))
421
+ ).map((b) => ({ kind: "data-binding", binding: b.kind, tool: "get_node_schema" }));
422
+ const matchedNodeKinds = schema.kinds.filter((k) => k.kind.toLowerCase().includes(q) || k.typeName.toLowerCase().includes(q) || k.doc.toLowerCase().includes(q)).map((k) => ({ kind: "node-kind", node: k.kind, tool: "get_node_schema" }));
423
+ const matchedTags = schema.elementFloor.tags.filter((t) => t.tag.toLowerCase() === q || t.attrs.some((a) => a.toLowerCase() === q)).map((t) => ({ kind: "element-tag", tag: t.tag, group: t.group, tool: "get_node_schema" }));
424
+ const matchedEmail = email.kinds.filter(
425
+ (k) => k.kind.includes(q) || k.typeName.toLowerCase().includes(q) || k.doc.toLowerCase().includes(q) || k.fields.some((f) => f.name.toLowerCase().includes(q))
426
+ ).map((k) => ({ kind: "email-node", node: k.kind, typeName: k.typeName }));
427
+ const matchedEmailTypes = email.documentTypes.filter(
428
+ (t) => t.typeName.toLowerCase().includes(q) || t.doc.toLowerCase().includes(q) || t.fields.some((f) => f.name.toLowerCase().includes(q))
429
+ ).map((t) => ({ kind: "email-type", typeName: t.typeName }));
260
430
  const results = [
261
431
  ...matchedComponents,
262
432
  ...matchedBlocks,
263
433
  ...matchedBehaviors,
264
434
  ...matchedClasses,
265
- ...matchedTokens
435
+ ...matchedTokens,
436
+ ...matchedBindings,
437
+ ...matchedNodeKinds,
438
+ ...matchedTags,
439
+ ...matchedEmail,
440
+ ...matchedEmailTypes
266
441
  ];
267
442
  return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] };
268
443
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;AAOA,IAAM,OAAO,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAC,CAAA;AACxD,IAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,MAAM,CAAA;AAEtC,SAAS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CAAC,CAAC,SAAA,EAAW,OAAO,CAAA,KACpF,QACG,MAAA,CAAO,CAAC,GAAA,KAAQ,GAAA,CAAI,WAAA,EAAY,CAAE,SAAS,CAAC,CAAC,CAAA,CAC7C,GAAA,CAAI,CAAC,GAAA,MAAS,EAAE,IAAA,EAAM,OAAA,EAAkB,SAAA,EAAW,KAAA,EAAO,GAAA,EAAI,CAAE;AAAA,OACrE;AACA,MAAA,MAAM,aAAA,GAAgB,OAAO,cAAA,CAC1B,MAAA,CAAO,CAAC,IAAA,KAAS,IAAA,CAAK,aAAY,CAAE,QAAA,CAAS,CAAC,CAAC,CAAA,CAC/C,IAAI,CAAC,IAAA,MAAU,EAAE,IAAA,EAAM,OAAA,EAAkB,MAAK,CAAE,CAAA;AACnD,MAAA,MAAM,OAAA,GAAU;AAAA,QACd,GAAG,iBAAA;AAAA,QACH,GAAG,aAAA;AAAA,QACH,GAAG,gBAAA;AAAA,QACH,GAAG,cAAA;AAAA,QACH,GAAG;AAAA,OACL;AACA,MAAA,OAAO,EAAE,OAAA,EAAS,CAAC,EAAE,MAAM,MAAA,EAAQ,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,OAAA,EAAS,IAAA,EAAM,CAAC,CAAA,EAAG,CAAA,EAAE;AAAA,IAC/E;AAAA,GACF;AAEA,EAAA,OAAO,MAAA;AACT;AAEA,eAAsB,IAAA,GAAsB;AAC1C,EAAA,MAAM,SAAS,YAAA,EAAa;AAC5B,EAAA,MAAM,SAAA,GAAY,IAAI,oBAAA,EAAqB;AAC3C,EAAA,MAAM,MAAA,CAAO,QAAQ,SAAS,CAAA;AAChC","file":"server.js","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\n\nconst here = path.dirname(fileURLToPath(import.meta.url));\nconst dataDir = path.join(here, \"data\");\n\nfunction loadJson<T>(name: string): T {\n return JSON.parse(readFileSync(path.join(dataDir, `${name}.json`), \"utf8\")) as T;\n}\n\n/**\n * The version this catalog documents, read from our OWN package.json at\n * startup rather than baked into the generated catalog.\n *\n * Every package in the family is released in lockstep — they're all listed in\n * `fixed` in .changeset/config.json, so their versions are identical by\n * construction — which makes our own version the right answer for all of them.\n *\n * This used to be snapshotted into `packages.json` at catalog-generation time,\n * but `gen` isn't part of `build` or the release, so the number froze at\n * whichever version happened to be current the last time someone ran it by\n * hand, and the server reported 0.26.0 while npm served 0.29.0. Reading it at\n * runtime makes that drift structurally impossible instead of a step someone\n * has to remember.\n */\nfunction readOwnVersion(): string {\n // `here` is dist/ in a build and src/ in dev; package.json sits one level up\n // from both, and npm always includes it in the published tarball.\n try {\n const pkg = JSON.parse(\n readFileSync(path.join(here, \"..\", \"package.json\"), \"utf8\"),\n ) as { version?: unknown };\n if (typeof pkg.version === \"string\" && pkg.version) return pkg.version;\n console.error(\n \"[silicaui-mcp] package.json has no usable `version`; reporting 'unknown'.\",\n );\n } catch (err) {\n console.error(\n `[silicaui-mcp] could not read own package.json (${(err as Error).message}); reporting 'unknown'.`,\n );\n }\n return \"unknown\";\n}\n\nconst VERSION = readOwnVersion();\n\ninterface PackageMeta {\n name: string;\n purpose: string;\n install: string | null;\n private?: boolean;\n}\n\ninterface TokensData {\n semanticColors: string[];\n light: Record<string, string>;\n dark: Record<string, string>;\n typography: { baseFontSize: string; fontFamilyTokens: string[]; note: string };\n}\n\ninterface PropMember {\n name: string;\n optional: boolean;\n type: string;\n doc: string;\n}\n\ninterface PropsInterface {\n name: string;\n extends?: string;\n members: PropMember[];\n}\n\ninterface ComponentData {\n name: string;\n package: string;\n category: string;\n sourceFile: string;\n /** silicaui-react entries: extracted from source via TS AST. silicaui-html\n * macros carry no static description (never hand-authored — see label/icon\n * instead) and omit these two fields. */\n description?: string;\n props?: PropsInterface[];\n usageExample?: string | null;\n /** silicaui-html macros only: palette label/icon, whether it's a container,\n * and the BehaviorType(s) its expansion carries (found by actually calling\n * expand(), not guessed — see get_behavior for the marker contract). */\n label?: string;\n icon?: string;\n container?: boolean;\n behaviors?: string[];\n}\n\ninterface BlockSlot {\n name: string;\n [key: string]: unknown;\n}\n\ninterface BlockData {\n key: string;\n name: string;\n category: string;\n version: string;\n description: string;\n tags?: string[];\n colors: string[];\n behaviors: string[];\n emailEligible: boolean;\n slots: BlockSlot[];\n root: unknown;\n preview?: unknown;\n}\n\ninterface BehaviorData {\n type: string;\n description: string;\n}\n\nconst packages = loadJson<PackageMeta[]>(\"packages\");\nconst tokens = loadJson<TokensData>(\"tokens\");\nconst classesByComponent = loadJson<Record<string, string[]>>(\"classes\");\nconst blocks = loadJson<BlockData[]>(\"blocks\");\nconst behaviors = loadJson<BehaviorData[]>(\"behaviors\");\nconst components = loadJson<ComponentData[]>(\"components\");\n\nfunction toKebab(name: string): string {\n return name\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .toLowerCase();\n}\n\nfunction blockSummary(b: BlockData) {\n const { root: _root, ...summary } = b;\n return summary;\n}\n\nexport function createServer(): McpServer {\n const server = new McpServer({\n name: \"@wizeworks/silicaui-mcp\",\n version: VERSION,\n });\n\n server.registerTool(\n \"list_packages\",\n {\n title: \"List Silica UI packages\",\n description:\n \"List every package in the Silica UI family (@wizeworks/silicaui, @wizeworks/silicaui-react, @wizeworks/silicaui-html, @wizeworks/silicaui-behaviors, and the wrapper packages), with purpose, install command, and version.\",\n inputSchema: {},\n },\n async () => ({\n content: [\n {\n type: \"text\",\n // Version is stamped here, not stored in the catalog — see VERSION.\n text: JSON.stringify(\n packages.map((p) => ({ ...p, version: VERSION })),\n null,\n 2,\n ),\n },\n ],\n }),\n );\n\n server.registerTool(\n \"list_components\",\n {\n title: \"List Silica UI components\",\n description:\n \"List component names, categories, and source packages — spans BOTH @wizeworks/silicaui-react (typed React components) and @wizeworks/silicaui-html (the framework-neutral ComponentDef macros: Dialog, Popover, Combobox, etc., for non-React output). The same name can exist in both packages with different shapes; use get_component's package param to disambiguate. Optionally filter to one package (e.g. '@wizeworks/silicaui-react', '@wizeworks/silicaui-html', '@wizeworks/silicaui-charts').\",\n inputSchema: {\n package: z.string().optional().describe(\"Filter to one package name, e.g. '@wizeworks/silicaui-react'.\"),\n },\n },\n async ({ package: pkg }) => {\n const filtered = pkg ? components.filter((c) => c.package === pkg) : components;\n const summary = filtered.map(({ name, package: p, category, sourceFile }) => ({\n name,\n package: p,\n category,\n sourceFile,\n }));\n return { content: [{ type: \"text\", text: JSON.stringify(summary, null, 2) }] };\n },\n );\n\n server.registerTool(\n \"get_component\",\n {\n title: \"Get a Silica UI component's real shape\",\n description:\n \"Get a component's real definition — for @wizeworks/silicaui-react: props (name, type, optional, doc — extracted from its actual TypeScript source) and a real, working usage example from the playground demos; for @wizeworks/silicaui-html: its palette category/label/icon, whether it's a container, and the BehaviorType(s) it carries (cross-reference with get_behavior for the marker contract). Use this instead of guessing prop names or shapes. Pass package when a name exists in more than one package.\",\n inputSchema: {\n name: z.string().describe(\"Component name, e.g. 'Button', 'DataTable', 'Dialog'.\"),\n package: z.string().optional().describe(\"Disambiguate when the name exists in more than one package, e.g. '@wizeworks/silicaui-html'.\"),\n },\n },\n async ({ name, package: pkg }) => {\n let matches = components.filter((c) => c.name.toLowerCase() === name.toLowerCase());\n if (pkg) matches = matches.filter((c) => c.package === pkg);\n if (!matches.length) {\n return {\n content: [\n {\n type: \"text\",\n text: `No component named \"${name}\"${pkg ? ` in ${pkg}` : \"\"}. Call list_components to see valid names.`,\n },\n ],\n isError: true,\n };\n }\n if (matches.length > 1) {\n return {\n content: [\n {\n type: \"text\",\n text: `\"${name}\" exists in more than one package — pass package to disambiguate: ${matches.map((c) => c.package).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n return { content: [{ type: \"text\", text: JSON.stringify(matches[0], null, 2) }] };\n },\n );\n\n server.registerTool(\n \"list_classes\",\n {\n title: \"List real Silica UI CSS class names\",\n description:\n \"List the exact, literal CSS class names Silica UI generates for a core component (e.g. 'button', 'card', 'badge') — or all components if none given. These are extracted directly from the class generators, so they are never hallucinated. Also covers 'color-utilities' (text-*/bg-*/border-* for every declared color).\",\n inputSchema: {\n component: z\n .string()\n .optional()\n .describe(\"A core @wizeworks/silicaui component name, e.g. 'button'. Omit to list every component's classes.\"),\n },\n },\n async ({ component }) => {\n if (!component) {\n return { content: [{ type: \"text\", text: JSON.stringify(classesByComponent, null, 2) }] };\n }\n const key = toKebab(component);\n const classes = classesByComponent[key];\n if (!classes) {\n return {\n content: [\n {\n type: \"text\",\n text: `No class data for \"${component}\". Known components: ${Object.keys(classesByComponent).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n return { content: [{ type: \"text\", text: JSON.stringify({ component: key, classes }, null, 2) }] };\n },\n );\n\n server.registerTool(\n \"get_tokens\",\n {\n title: \"Get Silica UI design tokens\",\n description:\n \"Get the semantic color list and their light/dark OKLCH values, the typography token model, and the scalar theme tokens (radius/border/depth/noise/focus/disabled-opacity) with defaults, ranges, and what each one actually affects.\",\n inputSchema: {},\n },\n async () => ({ content: [{ type: \"text\", text: JSON.stringify(tokens, null, 2) }] }),\n );\n\n server.registerTool(\n \"list_blocks\",\n {\n title: \"List Silica UI composed blocks\",\n description:\n \"List composed page blocks from @wizeworks/silicaui-html (hero sections, FAQs, feature grids, …) without their full node tree. Optionally filter by category or tag.\",\n inputSchema: {\n category: z.string().optional(),\n tag: z.string().optional(),\n },\n },\n async ({ category, tag }) => {\n const filtered = blocks.filter(\n (b) => (!category || b.category === category) && (!tag || (b.tags ?? []).includes(tag)),\n );\n return { content: [{ type: \"text\", text: JSON.stringify(filtered.map(blockSummary), null, 2) }] };\n },\n );\n\n server.registerTool(\n \"get_block\",\n {\n title: \"Get a Silica UI block's full node tree\",\n description:\n \"Get one composed block's full definition, including its node tree — the real, validated structure to reuse or adapt, not a guess.\",\n inputSchema: {\n key: z.string().describe(\"The block's stable key, e.g. 'hero_split_cta'.\"),\n },\n },\n async ({ key }) => {\n const block = blocks.find((b) => b.key === key);\n if (!block) {\n return {\n content: [\n {\n type: \"text\",\n text: `No block \"${key}\". Known keys: ${blocks.map((b) => b.key).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n return { content: [{ type: \"text\", text: JSON.stringify(block, null, 2) }] };\n },\n );\n\n server.registerTool(\n \"list_behaviors\",\n {\n title: \"List Silica UI behavior types\",\n description:\n \"List the closed set of interactive behaviors that @wizeworks/silicaui-behaviors hydrates from data-sui-* markers (the vanilla-JS runtime for non-React output). Each type is also the BehaviorType a @wizeworks/silicaui-html ComponentDef macro carries — cross-reference with get_component. Call this to see the current set rather than assuming a fixed list; it grows over time.\",\n inputSchema: {},\n },\n async () => ({ content: [{ type: \"text\", text: JSON.stringify(behaviors, null, 2) }] }),\n );\n\n server.registerTool(\n \"get_behavior\",\n {\n title: \"Get one Silica UI behavior's contract\",\n description: \"Get the marker contract and semantics for one behavior type.\",\n inputSchema: {\n type: z.string().describe(\"Behavior type, e.g. 'disclosure'.\"),\n },\n },\n async ({ type }) => {\n const behavior = behaviors.find((b) => b.type === type);\n if (!behavior) {\n return {\n content: [\n {\n type: \"text\",\n text: `No behavior \"${type}\". Known types: ${behaviors.map((b) => b.type).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n return { content: [{ type: \"text\", text: JSON.stringify(behavior, null, 2) }] };\n },\n );\n\n server.registerTool(\n \"search_docs\",\n {\n title: \"Search Silica UI catalog data\",\n description:\n \"Full-text search across everything this server knows: component names/descriptions, block names/descriptions, behavior descriptions, literal CSS class names, and design tokens. Use this when you don't know the exact name to look up.\",\n inputSchema: {\n query: z.string().describe(\"Search term, case-insensitive.\"),\n },\n },\n async ({ query }) => {\n const q = query.toLowerCase();\n const matchedComponents = components\n .filter((c) => c.name.toLowerCase().includes(q) || (c.description ?? \"\").toLowerCase().includes(q) || (c.label ?? \"\").toLowerCase().includes(q))\n .map((c) => ({ kind: \"component\", name: c.name, package: c.package }));\n const matchedBlocks = blocks\n .filter((b) => b.name.toLowerCase().includes(q) || b.description.toLowerCase().includes(q))\n .map((b) => ({ kind: \"block\", key: b.key, name: b.name }));\n const matchedBehaviors = behaviors\n .filter((b) => b.type.toLowerCase().includes(q) || b.description.toLowerCase().includes(q))\n .map((b) => ({ kind: \"behavior\", type: b.type }));\n const matchedClasses = Object.entries(classesByComponent).flatMap(([component, classes]) =>\n classes\n .filter((cls) => cls.toLowerCase().includes(q))\n .map((cls) => ({ kind: \"class\" as const, component, class: cls })),\n );\n const matchedTokens = tokens.semanticColors\n .filter((name) => name.toLowerCase().includes(q))\n .map((name) => ({ kind: \"token\" as const, name }));\n const results = [\n ...matchedComponents,\n ...matchedBlocks,\n ...matchedBehaviors,\n ...matchedClasses,\n ...matchedTokens,\n ];\n return { content: [{ type: \"text\", text: JSON.stringify(results, null, 2) }] };\n },\n );\n\n return server;\n}\n\nexport async function main(): Promise<void> {\n const server = createServer();\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n"]}
1
+ {"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;AAOA,IAAM,OAAO,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAC,CAAA;AACxD,IAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,MAAM,CAAA;AAEtC,SAAS,SAAY,IAAA,EAAiB;AACpC,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,IAAA,CAAK,IAAA,CAAK,OAAA,EAAS,CAAA,EAAG,IAAI,CAAA,KAAA,CAAO,CAAA,EAAG,MAAM,CAAC,CAAA;AAC5E;AAiBA,SAAS,cAAA,GAAyB;AAGhC,EAAA,IAAI;AACF,IAAA,MAAM,MAAM,IAAA,CAAK,KAAA;AAAA,MACf,aAAa,IAAA,CAAK,IAAA,CAAK,MAAM,IAAA,EAAM,cAAc,GAAG,MAAM;AAAA,KAC5D;AACA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EAAA,MAAM,SAAS,YAAA,EAAa;AAC5B,EAAA,MAAM,SAAA,GAAY,IAAI,oBAAA,EAAqB;AAC3C,EAAA,MAAM,MAAA,CAAO,QAAQ,SAAS,CAAA;AAChC","file":"server.js","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\n\nconst here = path.dirname(fileURLToPath(import.meta.url));\nconst dataDir = path.join(here, \"data\");\n\nfunction loadJson<T>(name: string): T {\n return JSON.parse(readFileSync(path.join(dataDir, `${name}.json`), \"utf8\")) as T;\n}\n\n/**\n * The version this catalog documents, read from our OWN package.json at\n * startup rather than baked into the generated catalog.\n *\n * Every package in the family is released in lockstep — they're all listed in\n * `fixed` in .changeset/config.json, so their versions are identical by\n * construction — which makes our own version the right answer for all of them.\n *\n * This used to be snapshotted into `packages.json` at catalog-generation time,\n * but `gen` isn't part of `build` or the release, so the number froze at\n * whichever version happened to be current the last time someone ran it by\n * hand, and the server reported 0.26.0 while npm served 0.29.0. Reading it at\n * runtime makes that drift structurally impossible instead of a step someone\n * has to remember.\n */\nfunction readOwnVersion(): string {\n // `here` is dist/ in a build and src/ in dev; package.json sits one level up\n // from both, and npm always includes it in the published tarball.\n try {\n const pkg = JSON.parse(\n readFileSync(path.join(here, \"..\", \"package.json\"), \"utf8\"),\n ) as { version?: unknown };\n if (typeof pkg.version === \"string\" && pkg.version) return pkg.version;\n console.error(\n \"[silicaui-mcp] package.json has no usable `version`; reporting 'unknown'.\",\n );\n } catch (err) {\n console.error(\n `[silicaui-mcp] could not read own package.json (${(err as Error).message}); reporting 'unknown'.`,\n );\n }\n return \"unknown\";\n}\n\nconst VERSION = readOwnVersion();\n\ninterface PackageMeta {\n name: string;\n purpose: string;\n install: string | null;\n private?: boolean;\n}\n\ninterface TokensData {\n semanticColors: string[];\n light: Record<string, string>;\n dark: Record<string, string>;\n typography: { baseFontSize: string; fontFamilyTokens: string[]; note: string };\n}\n\ninterface PropMember {\n name: string;\n optional: boolean;\n type: string;\n doc: string;\n}\n\ninterface PropsInterface {\n name: string;\n extends?: string;\n members: PropMember[];\n}\n\n/**\n * The routing preamble every connecting client receives from `initialize`,\n * before it calls a single tool.\n *\n * Silica ships one design system through three delivery paths, and the choice\n * between them is made BEFORE any tool call — by which point per-tool\n * descriptions are too late to help. Without this, an agent got ten tools in a\n * bag and inferred the architecture from their names; the standard failure was\n * reaching for `@wizeworks/silicaui-react` while emitting non-React output, or\n * shipping node-tree markup with no behavior runtime and wondering why nothing\n * opened.\n *\n * Deliberately names no counts and no version — those drift. Package names are\n * asserted against the real catalog by verify.mjs.\n */\nconst INSTRUCTIONS = `Silica UI is ONE design system delivered through THREE paths. Decide which path matches the code you are writing BEFORE writing any markup — the paths share a class vocabulary but are not interchangeable, and mixing them is the most common way an integration breaks.\n\n1. CSS — \\`@wizeworks/silicaui\\`\n A Tailwind v4 plugin. You write plain HTML and put Silica's classes on it: \\`<button class=\"btn btn-primary\">\\`. No JavaScript ships, so nothing is interactive — a dialog styled this way will not open. Use it for static markup, server-rendered templates (Rails, Django, PHP, Go, …), email, or any framework at all. It is the floor the other two paths stand on.\n → get_component(name, package \"@wizeworks/silicaui\") for a family's root class, its parts, and its color variants; list_classes for the literal names.\n\n2. React — \\`@wizeworks/silicaui-react\\`\n Typed React components over those same classes, with Base UI supplying real behavior and accessibility: \\`<Button color=\"primary\" size=\"lg\">\\`. Use it whenever the output is React or Next.js.\n → get_component(name, package \"@wizeworks/silicaui-react\") for real props (extracted from the TypeScript source) and a working usage example.\n\n3. HTML / node-tree — \\`@wizeworks/silicaui-html\\` + \\`@wizeworks/silicaui-behaviors\\`\n A framework-neutral node-tree schema that projects to HTML — for generated or user-authored documents: site builders, CMS output, static export. Component macros expand to element subtrees carrying \\`data-sui-*\\` markers, which the zero-dependency \\`@wizeworks/silicaui-behaviors\\` runtime hydrates at load. That runtime is what makes path 3 interactive; without it you have path 1.\n → get_node_schema FIRST for the tree's own shape: the node kinds, the data-binding vocabulary (how a node draws live content, repeats over a collection, or hides itself), the resolution contract, and the tag/attribute allowlist \\`toHtml\\` enforces. Then get_component(name, package \"@wizeworks/silicaui-html\") for the macro; list_blocks / get_block for composed sections; list_behaviors for the marker contract.\n Path 3 fails SILENTLY where the others fail loudly — an unlisted tag becomes a <div>, an unlisted attribute is dropped, an invented binding field is not persisted, and the output still looks plausible. Look it up.\n\nRules that hold on every path:\n- Never invent a class, prop, color, or block key. Everything this server returns is extracted from Silica's source at release time — look it up rather than guessing, including when you are fairly confident.\n- Colors are semantic tokens (get_tokens), never hex. An app can declare extra color roles; those work everywhere a built-in one does.\n- Do not re-skin a component with inline styles or arbitrary hex — it defeats theming and light/dark.\n- The same name can exist on more than one path with a different shape. get_component with no \\`package\\` returns every path's answer at once; pass \\`package\\` to narrow.\n- Don't know the name? search_docs first. Unsure what to install? list_packages.\n\nAuthoring an EMAIL through \\`@wizeworks/silicaui-builder/email\\`? That is a separate surface, not a fourth path: a CLOSED document schema of typed nodes that projects to table-based inline-styled HTML. Its kinds, fields, and nesting rules are enforced — an invented kind or an illegal nesting is dropped silently, with no error to read — so call list_email_nodes / get_email_node rather than reasoning from the paths above. Classes and components do not apply there; colors are literal hex.\n\nSigns you are on the wrong path: importing @wizeworks/silicaui-react into output that is not React; hand-writing \\`data-sui-*\\` markers (they come from macro expansion, never from you); shipping path-3 markup without loading @wizeworks/silicaui-behaviors; expecting path 1 alone to open a dialog.`;\n\ninterface ComponentData {\n name: string;\n package: string;\n category: string;\n sourceFile: string;\n /** silicaui-react entries: extracted from source via TS AST. silicaui-html\n * macros carry no static description (never hand-authored — see label/icon\n * instead) and omit these two fields. */\n description?: string;\n props?: PropsInterface[];\n usageExample?: string | null;\n /** silicaui-html macros only: palette label/icon, whether it's a container,\n * and the BehaviorType(s) its expansion carries (found by actually calling\n * expand(), not guessed — see get_behavior for the marker contract). */\n label?: string;\n icon?: string;\n container?: boolean;\n behaviors?: string[];\n /** silicaui (CSS) entries only: the family's root class (null when it has\n * none — see familyPrefix/rootNote), every literal class it generates, its\n * color variants, and any compound selector that reveals required structure. */\n root?: string | null;\n familyPrefix?: string;\n rootNote?: string;\n classes?: string[];\n colorVariants?: string[];\n compoundSelectors?: string[];\n}\n\ninterface BlockSlot {\n name: string;\n [key: string]: unknown;\n}\n\ninterface BlockData {\n key: string;\n name: string;\n category: string;\n version: string;\n description: string;\n tags?: string[];\n colors: string[];\n behaviors: string[];\n emailEligible: boolean;\n slots: BlockSlot[];\n root: unknown;\n preview?: unknown;\n}\n\ninterface BehaviorData {\n type: string;\n description: string;\n}\n\ninterface EmailFieldData {\n name: string;\n optional: boolean;\n type: string;\n doc: string;\n}\n\ninterface EmailKindData {\n kind: string;\n typeName: string;\n doc: string;\n isContent: boolean;\n container: boolean;\n holds: string[];\n allowedParents: string[];\n fields: EmailFieldData[];\n binding: { default?: string; fields: Record<string, string> } | null;\n sourceFile: string;\n}\n\ninterface EmailData {\n entrypoint: string;\n reactEntrypoint: string;\n note: string;\n sharedFields: EmailFieldData[];\n bindingNote: string;\n /** The envelope around the node tree — EmailDocument/EmailProject/\n * EmailColorDefaults and friends. A kind list alone can't answer \"what do I\n * wrap this in\". */\n documentTypes: Array<{ typeName: string; doc: string; fields: EmailFieldData[] }>;\n kinds: EmailKindData[];\n palette: Array<{ key: string; label: string; hint: string; icon: string; kind: string }>;\n}\n\ninterface FieldData {\n name: string;\n optional: boolean;\n type: string;\n doc: string;\n}\n\n/** Path 3's DOCUMENT schema — the node tree itself, as opposed to what you put\n * in it. Generated from silicaui-html's own source; see gen-catalog's\n * schema.json section for why each part is extracted rather than described. */\ninterface SchemaData {\n entrypoint: string;\n behaviorRuntime: string;\n sourceFile: string;\n note: string;\n child: string;\n nodeBase: FieldData[];\n kinds: Array<{ kind: string; typeName: string; doc: string; sharedFields: boolean; fields: FieldData[] }>;\n bindingNote: string;\n dataBindings: Array<{ kind: string; doc: string; fields: Array<{ name: string; optional: boolean; type: string }> }>;\n resolution: {\n note: string;\n honesty: string;\n host: FieldData[];\n resolved: FieldData[];\n scope: FieldData[];\n options: FieldData[];\n diagnostic: FieldData[];\n };\n elementFloor: {\n note: string;\n globalAttrs: string[];\n tags: Array<{ tag: string; group: string; void: boolean; attrs: string[] }>;\n };\n}\n\nconst packages = loadJson<PackageMeta[]>(\"packages\");\nconst tokens = loadJson<TokensData>(\"tokens\");\nconst classesByComponent = loadJson<Record<string, string[]>>(\"classes\");\nconst blocks = loadJson<BlockData[]>(\"blocks\");\nconst behaviors = loadJson<BehaviorData[]>(\"behaviors\");\nconst components = loadJson<ComponentData[]>(\"components\");\nconst email = loadJson<EmailData>(\"email\");\nconst schema = loadJson<SchemaData>(\"schema\");\n\n/** CSS → React → HTML: the order the instructions introduce the paths in, so a\n * multi-path get_component answer reads the same way every time. Packages not\n * listed (the wrappers) sort last via indexOf's -1... which sorts them FIRST,\n * so map those to a large index instead. */\nconst PATH_ORDER_LIST = [\n \"@wizeworks/silicaui\",\n \"@wizeworks/silicaui-react\",\n \"@wizeworks/silicaui-html\",\n];\nconst PATH_ORDER = {\n indexOf(pkg: string): number {\n const i = PATH_ORDER_LIST.indexOf(pkg);\n return i === -1 ? PATH_ORDER_LIST.length : i;\n },\n};\n\nfunction toKebab(name: string): string {\n return name\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .toLowerCase();\n}\n\nfunction blockSummary(b: BlockData) {\n const { root: _root, ...summary } = b;\n return summary;\n}\n\nexport function createServer(): McpServer {\n const server = new McpServer(\n {\n name: \"@wizeworks/silicaui-mcp\",\n version: VERSION,\n },\n { instructions: INSTRUCTIONS },\n );\n\n server.registerTool(\n \"list_packages\",\n {\n title: \"List Silica UI packages\",\n description:\n \"List every package in the Silica UI family (@wizeworks/silicaui, @wizeworks/silicaui-react, @wizeworks/silicaui-html, @wizeworks/silicaui-behaviors, and the wrapper packages), with purpose, install command, and version.\",\n inputSchema: {},\n },\n async () => ({\n content: [\n {\n type: \"text\",\n // Version is stamped here, not stored in the catalog — see VERSION.\n text: JSON.stringify(\n packages.map((p) => ({ ...p, version: VERSION })),\n null,\n 2,\n ),\n },\n ],\n }),\n );\n\n server.registerTool(\n \"list_components\",\n {\n title: \"List Silica UI components\",\n description:\n \"List component names, categories, and source packages — spans ALL THREE delivery paths: @wizeworks/silicaui (CSS class families for plain HTML), @wizeworks/silicaui-react (typed React components), and @wizeworks/silicaui-html (framework-neutral ComponentDef macros for generated/non-React output). The same component usually exists on more than one path with a completely different shape; get_component returns every path's answer unless you pass a package. Filter here with the package param (e.g. '@wizeworks/silicaui', '@wizeworks/silicaui-react', '@wizeworks/silicaui-html', '@wizeworks/silicaui-charts').\",\n inputSchema: {\n package: z.string().optional().describe(\"Filter to one package name, e.g. '@wizeworks/silicaui-react'.\"),\n },\n },\n async ({ package: pkg }) => {\n const filtered = pkg ? components.filter((c) => c.package === pkg) : components;\n const summary = filtered.map(({ name, package: p, category, sourceFile }) => ({\n name,\n package: p,\n category,\n sourceFile,\n }));\n return { content: [{ type: \"text\", text: JSON.stringify(summary, null, 2) }] };\n },\n );\n\n server.registerTool(\n \"get_component\",\n {\n title: \"Get a Silica UI component's real shape\",\n description:\n \"Get a component's real definition on whichever delivery path you're building on — for @wizeworks/silicaui (CSS): the family's root class, every literal class it generates, its color variants, and any compound selector that reveals required markup structure; for @wizeworks/silicaui-react: props (name, type, optional, doc — extracted from its actual TypeScript source) plus a real, working usage example; for @wizeworks/silicaui-html: its palette category/label/icon, whether it's a container, and the BehaviorType(s) it carries (cross-reference get_behavior for the marker contract). Use this instead of guessing class names, prop names, or shapes. Omit package to see every path's answer side by side; pass it to get just one.\",\n inputSchema: {\n name: z.string().describe(\"Component name, e.g. 'Button', 'DataTable', 'Dialog'.\"),\n package: z.string().optional().describe(\"Disambiguate when the name exists in more than one package, e.g. '@wizeworks/silicaui-html'.\"),\n },\n },\n async ({ name, package: pkg }) => {\n let matches = components.filter((c) => c.name.toLowerCase() === name.toLowerCase());\n if (pkg) matches = matches.filter((c) => c.package === pkg);\n if (!matches.length) {\n return {\n content: [\n {\n type: \"text\",\n text: `No component named \"${name}\"${pkg ? ` in ${pkg}` : \"\"}. Call list_components to see valid names.`,\n },\n ],\n isError: true,\n };\n }\n // A name on more than one path used to be an isError telling the caller\n // to pick a package — which costs a round trip and, worse, asks for a\n // choice the caller can't make yet: it doesn't know how the shapes\n // differ, which is the very thing it's asking about. Returning all of\n // them answers the question AND demonstrates the three paths at the one\n // moment the distinction actually matters.\n if (matches.length > 1) {\n const ordered = [...matches].sort(\n (a, b) => PATH_ORDER.indexOf(a.package) - PATH_ORDER.indexOf(b.package),\n );\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify(\n {\n name: ordered[0]?.name ?? name,\n note:\n `\"${name}\" exists on ${ordered.length} delivery paths, listed below with their real (different) shapes: ` +\n `${ordered.map((c) => c.package).join(\", \")}. Use the one matching the code you're writing — ` +\n `they are not interchangeable. Pass \\`package\\` to get just one.`,\n paths: ordered,\n },\n null,\n 2,\n ),\n },\n ],\n };\n }\n return { content: [{ type: \"text\", text: JSON.stringify(matches[0], null, 2) }] };\n },\n );\n\n server.registerTool(\n \"list_classes\",\n {\n title: \"List real Silica UI CSS class names\",\n description:\n \"List the exact, literal CSS class names Silica UI generates for a core component (e.g. 'button', 'card', 'badge') — or all components if none given. These are extracted directly from the class generators, so they are never hallucinated. Also covers 'color-utilities' (text-*/bg-*/border-* for every declared color). This returns a flat list; for the CSS path's STRUCTURE — which class is the root, which are its parts, which are color variants — call get_component with package '@wizeworks/silicaui'.\",\n inputSchema: {\n component: z\n .string()\n .optional()\n .describe(\"A core @wizeworks/silicaui component name, e.g. 'button'. Omit to list every component's classes.\"),\n },\n },\n async ({ component }) => {\n if (!component) {\n return { content: [{ type: \"text\", text: JSON.stringify(classesByComponent, null, 2) }] };\n }\n const key = toKebab(component);\n const classes = classesByComponent[key];\n if (!classes) {\n return {\n content: [\n {\n type: \"text\",\n text: `No class data for \"${component}\". Known components: ${Object.keys(classesByComponent).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n return { content: [{ type: \"text\", text: JSON.stringify({ component: key, classes }, null, 2) }] };\n },\n );\n\n server.registerTool(\n \"get_tokens\",\n {\n title: \"Get Silica UI design tokens\",\n description:\n \"Get the semantic color list and their light/dark OKLCH values, the typography token model, and the scalar theme tokens (radius/border/depth/noise/focus/disabled-opacity) with defaults, ranges, and what each one actually affects.\",\n inputSchema: {},\n },\n async () => ({ content: [{ type: \"text\", text: JSON.stringify(tokens, null, 2) }] }),\n );\n\n server.registerTool(\n \"list_blocks\",\n {\n title: \"List Silica UI composed blocks\",\n description:\n \"List composed page blocks from @wizeworks/silicaui-html (hero sections, FAQs, feature grids, …) without their full node tree. Optionally filter by category or tag.\",\n inputSchema: {\n category: z.string().optional(),\n tag: z.string().optional(),\n },\n },\n async ({ category, tag }) => {\n const filtered = blocks.filter(\n (b) => (!category || b.category === category) && (!tag || (b.tags ?? []).includes(tag)),\n );\n return { content: [{ type: \"text\", text: JSON.stringify(filtered.map(blockSummary), null, 2) }] };\n },\n );\n\n server.registerTool(\n \"get_block\",\n {\n title: \"Get a Silica UI block's full node tree\",\n description:\n \"Get one composed block's full definition, including its node tree — the real, validated structure to reuse or adapt, not a guess.\",\n inputSchema: {\n key: z.string().describe(\"The block's stable key, e.g. 'hero_split_cta'.\"),\n },\n },\n async ({ key }) => {\n const block = blocks.find((b) => b.key === key);\n if (!block) {\n return {\n content: [\n {\n type: \"text\",\n text: `No block \"${key}\". Known keys: ${blocks.map((b) => b.key).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n return { content: [{ type: \"text\", text: JSON.stringify(block, null, 2) }] };\n },\n );\n\n server.registerTool(\n \"list_behaviors\",\n {\n title: \"List Silica UI behavior types\",\n description:\n \"List the closed set of interactive behaviors that @wizeworks/silicaui-behaviors hydrates from data-sui-* markers (the vanilla-JS runtime for non-React output). Each type is also the BehaviorType a @wizeworks/silicaui-html ComponentDef macro carries — cross-reference with get_component. Call this to see the current set rather than assuming a fixed list; it grows over time.\",\n inputSchema: {},\n },\n async () => ({ content: [{ type: \"text\", text: JSON.stringify(behaviors, null, 2) }] }),\n );\n\n server.registerTool(\n \"get_behavior\",\n {\n title: \"Get one Silica UI behavior's contract\",\n description: \"Get the marker contract and semantics for one behavior type.\",\n inputSchema: {\n type: z.string().describe(\"Behavior type, e.g. 'disclosure'.\"),\n },\n },\n async ({ type }) => {\n const behavior = behaviors.find((b) => b.type === type);\n if (!behavior) {\n return {\n content: [\n {\n type: \"text\",\n text: `No behavior \"${type}\". Known types: ${behaviors.map((b) => b.type).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n return { content: [{ type: \"text\", text: JSON.stringify(behavior, null, 2) }] };\n },\n );\n\n server.registerTool(\n \"list_email_nodes\",\n {\n title: \"List the email builder's node kinds\",\n description:\n \"List every node kind an email document can contain (@wizeworks/silicaui-builder/email) with its nesting rules — what each kind may HOLD and which kinds may hold IT — plus the insertable palette presets. This schema is CLOSED and enforced: `EmailEditor.insert` returns undefined for an illegal kind or nesting, silently, so check here rather than assuming a site/HTML structure carries over. Email nodes carry typed fields, not classes, and literal hex colors, not tokens. Call get_email_node for one kind's real fields.\",\n inputSchema: {},\n },\n async () => ({\n content: [\n {\n type: \"text\",\n text: JSON.stringify(\n {\n entrypoint: email.entrypoint,\n reactEntrypoint: email.reactEntrypoint,\n note: email.note,\n bindingNote: email.bindingNote,\n kinds: email.kinds.map(({ kind, typeName, isContent, container, holds, allowedParents, binding }) => ({\n kind,\n typeName,\n isContent,\n container,\n holds,\n allowedParents,\n bindableFields: binding ? Object.keys(binding.fields) : [],\n defaultBindTarget: binding?.default ?? null,\n })),\n palette: email.palette,\n // The envelope, in full: it's small, and a caller that has the\n // kinds but not `EmailDocument` still can't produce a document.\n documentTypes: email.documentTypes,\n },\n null,\n 2,\n ),\n },\n ],\n }),\n );\n\n server.registerTool(\n \"get_email_node\",\n {\n title: \"Get an email node kind's real fields\",\n description:\n \"Get one email node kind's full definition: every typed field with its TypeScript type, whether it's optional, and its source doc comment; the fields shared by every node (id/ord/data/locked); its nesting rules; and its data-binding contract — which `attr` a `value` bind may target and which one a bind with no `attr` fills. Use this instead of guessing field names: an unknown field is dropped by the engine and an unknown bind target is inert, neither with an error.\",\n inputSchema: {\n kind: z.string().describe(\"Node kind, e.g. 'link', 'image', 'section'. See list_email_nodes.\"),\n },\n },\n async ({ kind }) => {\n const node = email.kinds.find((k) => k.kind === kind.toLowerCase());\n if (!node) {\n return {\n content: [\n {\n type: \"text\",\n text: `No email node kind \"${kind}\". Known kinds: ${email.kinds.map((k) => k.kind).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify(\n {\n ...node,\n sharedFields: email.sharedFields,\n bindingNote: email.bindingNote,\n palette: email.palette.filter((p) => p.kind === node.kind),\n },\n null,\n 2,\n ),\n },\n ],\n };\n },\n );\n\n server.registerTool(\n \"get_node_schema\",\n {\n title: \"Get the Silica UI node-tree schema (path 3)\",\n description:\n \"Get the DOCUMENT schema for @wizeworks/silicaui-html — the shape of the tree itself, as opposed to what you put in it. Covers the four node kinds and their fields, the typed system-metadata band every node carries (data / slot / behavior / part / locked / instanceOf), the DATA-BINDING vocabulary with every field, the resolution contract a host implements, and the raw-element/attribute allowlist `toHtml` enforces. Call this before authoring or generating a node tree: the failures here are SILENT — an unlisted tag is downgraded to <div>, an unlisted attribute is dropped, an invented binding field is not persisted — so none of it can be inferred from output that looks like it worked. Not needed for path 1 (CSS classes on your own HTML) or path 2 (React).\",\n inputSchema: {\n section: z\n .enum([\"all\", \"nodes\", \"bindings\", \"resolution\", \"elements\"])\n .optional()\n .describe(\n \"Narrow the answer: 'nodes' (kinds + the shared metadata band), 'bindings' (the data vocabulary), 'resolution' (the host hooks and their honesty contract), 'elements' (the tag/attribute floor). Omit for everything.\",\n ),\n },\n },\n async ({ section }) => {\n const head = {\n entrypoint: schema.entrypoint,\n behaviorRuntime: schema.behaviorRuntime,\n sourceFile: schema.sourceFile,\n note: schema.note,\n };\n const sections: Record<string, unknown> = {\n nodes: { child: schema.child, nodeBase: schema.nodeBase, kinds: schema.kinds },\n bindings: { bindingNote: schema.bindingNote, dataBindings: schema.dataBindings },\n resolution: schema.resolution,\n elements: schema.elementFloor,\n };\n const body =\n !section || section === \"all\"\n ? { ...sections.nodes as object, ...sections.bindings as object, resolution: schema.resolution, elementFloor: schema.elementFloor }\n : sections[section];\n return { content: [{ type: \"text\", text: JSON.stringify({ ...head, ...(body as object) }, null, 2) }] };\n },\n );\n\n server.registerTool(\n \"search_docs\",\n {\n title: \"Search Silica UI catalog data\",\n description:\n \"Full-text search across everything this server knows: component names/descriptions, block names/descriptions, behavior descriptions, literal CSS class names, design tokens, and the email builder's node kinds + their fields. Use this when you don't know the exact name to look up.\",\n inputSchema: {\n query: z.string().describe(\"Search term, case-insensitive.\"),\n },\n },\n async ({ query }) => {\n const q = query.toLowerCase();\n const matchedComponents = components\n .filter((c) => c.name.toLowerCase().includes(q) || (c.description ?? \"\").toLowerCase().includes(q) || (c.label ?? \"\").toLowerCase().includes(q))\n .map((c) => ({ kind: \"component\", name: c.name, package: c.package }));\n const matchedBlocks = blocks\n .filter((b) => b.name.toLowerCase().includes(q) || b.description.toLowerCase().includes(q))\n .map((b) => ({ kind: \"block\", key: b.key, name: b.name }));\n const matchedBehaviors = behaviors\n .filter((b) => b.type.toLowerCase().includes(q) || b.description.toLowerCase().includes(q))\n .map((b) => ({ kind: \"behavior\", type: b.type }));\n const matchedClasses = Object.entries(classesByComponent).flatMap(([component, classes]) =>\n classes\n .filter((cls) => cls.toLowerCase().includes(q))\n .map((cls) => ({ kind: \"class\" as const, component, class: cls })),\n );\n const matchedTokens = tokens.semanticColors\n .filter((name) => name.toLowerCase().includes(q))\n .map((name) => ({ kind: \"token\" as const, name }));\n // The node-tree vocabulary. Without this, \"repeat\", \"limit\", \"srcset\" and\n // \"conditional\" found nothing here and an agent concluded the concept did\n // not exist — the exact failure a searchable catalog is meant to prevent.\n const matchedBindings = schema.dataBindings\n .filter(\n (b) =>\n b.kind.toLowerCase().includes(q) ||\n b.doc.toLowerCase().includes(q) ||\n b.fields.some((f) => f.name.toLowerCase().includes(q)),\n )\n .map((b) => ({ kind: \"data-binding\" as const, binding: b.kind, tool: \"get_node_schema\" }));\n const matchedNodeKinds = schema.kinds\n .filter((k) => k.kind.toLowerCase().includes(q) || k.typeName.toLowerCase().includes(q) || k.doc.toLowerCase().includes(q))\n .map((k) => ({ kind: \"node-kind\" as const, node: k.kind, tool: \"get_node_schema\" }));\n const matchedTags = schema.elementFloor.tags\n .filter((t) => t.tag.toLowerCase() === q || t.attrs.some((a) => a.toLowerCase() === q))\n .map((t) => ({ kind: \"element-tag\" as const, tag: t.tag, group: t.group, tool: \"get_node_schema\" }));\n // Email node kinds match on their own name, their doc, or any field they\n // declare — \"href\" should find the `link` group even though no component\n // or class is called that.\n const matchedEmail = email.kinds\n .filter(\n (k) =>\n k.kind.includes(q) ||\n k.typeName.toLowerCase().includes(q) ||\n k.doc.toLowerCase().includes(q) ||\n k.fields.some((f) => f.name.toLowerCase().includes(q)),\n )\n .map((k) => ({ kind: \"email-node\" as const, node: k.kind, typeName: k.typeName }));\n const matchedEmailTypes = email.documentTypes\n .filter(\n (t) =>\n t.typeName.toLowerCase().includes(q) ||\n t.doc.toLowerCase().includes(q) ||\n t.fields.some((f) => f.name.toLowerCase().includes(q)),\n )\n .map((t) => ({ kind: \"email-type\" as const, typeName: t.typeName }));\n const results = [\n ...matchedComponents,\n ...matchedBlocks,\n ...matchedBehaviors,\n ...matchedClasses,\n ...matchedTokens,\n ...matchedBindings,\n ...matchedNodeKinds,\n ...matchedTags,\n ...matchedEmail,\n ...matchedEmailTypes,\n ];\n return { content: [{ type: \"text\", text: JSON.stringify(results, null, 2) }] };\n },\n );\n\n return server;\n}\n\nexport async function main(): Promise<void> {\n const server = createServer();\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wizeworks/silicaui-mcp",
3
- "version": "0.36.0",
3
+ "version": "0.38.0",
4
4
  "description": "A local MCP server that lets AI coding assistants query the Silica UI design system — real class names, component props, blocks, and behaviors — instead of guessing.",
5
5
  "type": "module",
6
6
  "license": "MIT",