@wizeworks/silicaui-mcp 0.55.0 → 0.56.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
@@ -532,92 +532,149 @@ function createServer() {
532
532
  },
533
533
  async ({ query }) => {
534
534
  const q = query.toLowerCase();
535
- const matchedComponents = components.filter((c) => c.name.toLowerCase().includes(q) || (c.description ?? "").toLowerCase().includes(q) || (c.label ?? "").toLowerCase().includes(q)).map((c) => ({ kind: "component", name: c.name, package: c.package }));
536
- const matchedBlocks = blocks.filter((b) => b.name.toLowerCase().includes(q) || b.description.toLowerCase().includes(q)).map((b) => ({ kind: "block", key: b.key, name: b.name }));
537
- const matchedBehaviors = behaviors.filter((b) => b.type.toLowerCase().includes(q) || b.description.toLowerCase().includes(q)).map((b) => ({ kind: "behavior", type: b.type }));
538
- const matchedClasses = Object.entries(classesByComponent).flatMap(
539
- ([component, classes]) => classes.filter((cls) => cls.toLowerCase().includes(q)).map((cls) => ({ kind: "class", component, class: cls }))
540
- );
541
- const matchedTokens = tokens.semanticColors.filter((name) => name.toLowerCase().includes(q)).map((name) => ({ kind: "token", name }));
542
- const COLOR_CONCEPT = [
543
- "custom color",
544
- "custom colors",
545
- "color role",
546
- "n-color",
547
- "brand",
548
- "register",
549
- "registered",
550
- "declare",
551
- "@plugin",
552
- "plugin",
553
- "@theme",
554
- "palette",
555
- "extra color",
556
- "new color"
557
- ];
558
- const matchedColorConcept = COLOR_CONCEPT.some((k) => k.includes(q) || q.includes(k)) ? [
559
- {
560
- kind: "concept",
561
- name: "custom colors (N-color)",
562
- summary: tokens.customColors.summary,
563
- tool: "get_tokens",
564
- field: "customColors"
565
- }
566
- ] : [];
567
- const matchedThemes = themes.presets.filter((p) => p.name.toLowerCase().includes(q) || p.character.toLowerCase().includes(q)).map((p) => ({ kind: "theme", name: p.name, applyAs: p.applyAs, tool: "get_theme" }));
568
- const THEME_CONCEPT = [
569
- "theme",
570
- "theming",
571
- "data-theme",
572
- "dark mode",
573
- "dark",
574
- "light mode",
575
- "light",
576
- "color scheme",
577
- "colour scheme",
578
- "prefers-color-scheme",
579
- "toggle",
580
- "island",
581
- "skin",
582
- "white label",
583
- "white-label",
584
- "multi-tenant"
585
- ];
586
- const matchedThemeConcept = THEME_CONCEPT.some((k) => k.includes(q) || q.includes(k)) ? [
587
- {
588
- kind: "concept",
589
- name: "themes (data-theme)",
590
- summary: themes.note,
591
- tool: "list_themes",
592
- field: "mechanism"
535
+ const terms = q.split(/\s+/).filter(Boolean);
536
+ const normalize = (s) => {
537
+ const raw = s.toLowerCase();
538
+ const split = s.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").toLowerCase();
539
+ return split === raw ? raw : `${raw} ${split}`;
540
+ };
541
+ const ALIASES = {
542
+ snackbar: ["toast"],
543
+ loader: ["loading", "spinner"],
544
+ loading: ["skeleton", "spinner"],
545
+ history: ["timeline"],
546
+ audit: ["timeline"],
547
+ trail: ["timeline"],
548
+ activity: ["timeline"],
549
+ feed: ["timeline"],
550
+ log: ["timeline"],
551
+ picture: ["avatar", "image"],
552
+ photo: ["avatar", "image"],
553
+ headshot: ["avatar"],
554
+ crumbs: ["breadcrumb"]
555
+ };
556
+ const spellings = terms.map((t) => [t, ...ALIASES[t] ?? []]);
557
+ let active = spellings;
558
+ const matches = (...parts) => {
559
+ if (!active.length) return false;
560
+ const hay = parts.filter(Boolean).map((p) => normalize(p)).join(" ");
561
+ return active.every((alts) => alts.some((t) => hay.includes(t)));
562
+ };
563
+ const collect = () => {
564
+ const matchedComponents = components.filter((c) => matches(c.name, c.description, c.label)).map((c) => ({ kind: "component", name: c.name, package: c.package }));
565
+ const matchedBlocks = blocks.filter((b) => matches(b.name, b.description)).map((b) => ({ kind: "block", key: b.key, name: b.name }));
566
+ const matchedBehaviors = behaviors.filter((b) => matches(b.type, b.description)).map((b) => ({ kind: "behavior", type: b.type }));
567
+ const matchedClasses = Object.entries(classesByComponent).flatMap(
568
+ ([component, classes]) => classes.filter((cls) => matches(cls)).map((cls) => ({ kind: "class", component, class: cls }))
569
+ );
570
+ const matchedTokens = tokens.semanticColors.filter((name) => matches(name)).map((name) => ({ kind: "token", name }));
571
+ const COLOR_CONCEPT = [
572
+ "custom color",
573
+ "custom colors",
574
+ "color role",
575
+ "n-color",
576
+ "brand",
577
+ "register",
578
+ "registered",
579
+ "declare",
580
+ "@plugin",
581
+ "plugin",
582
+ "@theme",
583
+ "palette",
584
+ "extra color",
585
+ "new color"
586
+ ];
587
+ const matchedColorConcept = COLOR_CONCEPT.some((k) => k.includes(q) || q.includes(k)) ? [
588
+ {
589
+ kind: "concept",
590
+ name: "custom colors (N-color)",
591
+ summary: tokens.customColors.summary,
592
+ tool: "get_tokens",
593
+ field: "customColors"
594
+ }
595
+ ] : [];
596
+ const matchedThemes = themes.presets.filter((p) => matches(p.name, p.character)).map((p) => ({ kind: "theme", name: p.name, applyAs: p.applyAs, tool: "get_theme" }));
597
+ const THEME_CONCEPT = [
598
+ "theme",
599
+ "theming",
600
+ "data-theme",
601
+ "dark mode",
602
+ "dark",
603
+ "light mode",
604
+ "light",
605
+ "color scheme",
606
+ "colour scheme",
607
+ "prefers-color-scheme",
608
+ "toggle",
609
+ "island",
610
+ "skin",
611
+ "white label",
612
+ "white-label",
613
+ "multi-tenant"
614
+ ];
615
+ const matchedThemeConcept = THEME_CONCEPT.some((k) => k.includes(q) || q.includes(k)) ? [
616
+ {
617
+ kind: "concept",
618
+ name: "themes (data-theme)",
619
+ summary: themes.note,
620
+ tool: "list_themes",
621
+ field: "mechanism"
622
+ }
623
+ ] : [];
624
+ const matchedBindings = schema.dataBindings.filter((b) => matches(b.kind, b.doc, ...b.fields.map((f) => f.name))).map((b) => ({ kind: "data-binding", binding: b.kind, tool: "get_node_schema" }));
625
+ const matchedNodeKinds = schema.kinds.filter((k) => matches(k.kind, k.typeName, k.doc)).map((k) => ({ kind: "node-kind", node: k.kind, tool: "get_node_schema" }));
626
+ 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" }));
627
+ const matchedEmail = email.kinds.filter((k) => matches(k.kind, k.typeName, k.doc, ...k.fields.map((f) => f.name))).map((k) => ({ kind: "email-node", node: k.kind, typeName: k.typeName }));
628
+ const matchedEmailTypes = email.documentTypes.filter((t) => matches(t.typeName, t.doc, ...t.fields.map((f) => f.name))).map((t) => ({ kind: "email-type", typeName: t.typeName }));
629
+ return [
630
+ ...matchedComponents,
631
+ ...matchedBlocks,
632
+ ...matchedBehaviors,
633
+ ...matchedClasses,
634
+ ...matchedTokens,
635
+ ...matchedColorConcept,
636
+ ...matchedThemes,
637
+ ...matchedThemeConcept,
638
+ ...matchedBindings,
639
+ ...matchedNodeKinds,
640
+ ...matchedTags,
641
+ ...matchedEmail,
642
+ ...matchedEmailTypes
643
+ ];
644
+ };
645
+ let results = collect();
646
+ let ignored = [];
647
+ if (!results.length) {
648
+ for (let keep = spellings.length - 1; keep >= 1 && !results.length; keep--) {
649
+ let best = null;
650
+ let bestDrop = -1;
651
+ for (let drop = 0; drop < spellings.length; drop++) {
652
+ active = spellings.filter((_, i) => i !== drop).slice(0, keep);
653
+ if (active.length !== keep) continue;
654
+ const got = collect();
655
+ if (got.length && (best === null || got.length < best.length)) {
656
+ best = got;
657
+ bestDrop = drop;
658
+ }
659
+ }
660
+ const dropped = terms[bestDrop];
661
+ if (best && dropped !== void 0) {
662
+ results = best;
663
+ ignored = [dropped];
664
+ }
593
665
  }
594
- ] : [];
595
- const matchedBindings = schema.dataBindings.filter(
596
- (b) => b.kind.toLowerCase().includes(q) || b.doc.toLowerCase().includes(q) || b.fields.some((f) => f.name.toLowerCase().includes(q))
597
- ).map((b) => ({ kind: "data-binding", binding: b.kind, tool: "get_node_schema" }));
598
- 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" }));
599
- 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" }));
600
- const matchedEmail = email.kinds.filter(
601
- (k) => k.kind.includes(q) || k.typeName.toLowerCase().includes(q) || k.doc.toLowerCase().includes(q) || k.fields.some((f) => f.name.toLowerCase().includes(q))
602
- ).map((k) => ({ kind: "email-node", node: k.kind, typeName: k.typeName }));
603
- const matchedEmailTypes = email.documentTypes.filter(
604
- (t) => t.typeName.toLowerCase().includes(q) || t.doc.toLowerCase().includes(q) || t.fields.some((f) => f.name.toLowerCase().includes(q))
605
- ).map((t) => ({ kind: "email-type", typeName: t.typeName }));
606
- const results = [
607
- ...matchedComponents,
608
- ...matchedBlocks,
609
- ...matchedBehaviors,
610
- ...matchedClasses,
611
- ...matchedTokens,
612
- ...matchedColorConcept,
613
- ...matchedThemes,
614
- ...matchedThemeConcept,
615
- ...matchedBindings,
616
- ...matchedNodeKinds,
617
- ...matchedTags,
618
- ...matchedEmail,
619
- ...matchedEmailTypes
620
- ];
666
+ }
667
+ active = spellings;
668
+ if (ignored.length) {
669
+ results = [
670
+ {
671
+ kind: "search-note",
672
+ note: `No entry matched every word. Showing results for "${terms.filter((t) => !ignored.includes(t)).join(" ")}".`,
673
+ ignored
674
+ },
675
+ ...results
676
+ ];
677
+ }
621
678
  return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] };
622
679
  }
623
680
  );
@@ -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,C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,WAAA;AAAA,QACH,GAAG,YAAA;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 /** How an app registers extra color roles, and everything one reaches once declared. */\n customColors: {\n summary: string;\n howToDeclare: string;\n declareNote: string;\n contentNote: string;\n utilities: string[];\n componentPatterns: string[];\n componentPatternsNote: string;\n builderNote: string;\n };\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, 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 — but the eight built-in roles are a DEFAULT, not a closed set. Silica's core promise is that N named colors cascade through everything: an app registers extra roles (get_tokens → customColors for the two-line syntax) and each works everywhere a built-in does, so \\`btn-brand\\` is exactly as real as \\`btn-primary\\`. Read a component's \\`colorPattern\\` (get_component) and substitute the registered name — most are \\`<root>-<color>\\`, but chat, pin-input and toast are not. A REGISTERED color is the one name you may use that this catalog does not list literally; an unregistered one is still an invention, and renders unstyled.\n- Do not re-skin a component with inline styles or arbitrary hex — it defeats theming and light/dark.\n- A different PALETTE is a theme, applied as \\`data-theme=\"<name>\"\\` on an element — never restyled components, a second stylesheet, or hex. Everything inside resolves against that theme's tokens, so nesting it themes one section (\\`<section data-theme=\"dark\">\\`) and putting it on <html> themes the page. Dark mode is just \\`data-theme=\"dark\"\\`; there is no \\`.dark\\` class. list_themes for the mechanism and the shipped presets, get_theme for one's resolved tokens.\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 /** Selector template for the color axis, e.g. `btn-<color>` — substitute any registered color. */\n colorPattern?: string;\n colorNote?: 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 /** The host contract: the resolve hooks, the unknown-vs-empty honesty rule,\n * and — separately from `bindingNote`'s `data` markers — how inline\n * `{{ref}}` merge tokens resolve in prose fields. */\n resolution: {\n note: string;\n honesty: string;\n tokens: string;\n host: FieldData[];\n bindableFields: Record<string, { default?: string; fields: Record<string, string> }>;\n };\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\n/** One shipped theme preset, with both modes already RESOLVED (dark deltas\n * merged, `-content` inks derived) — the map a browser actually computes, not\n * the authored bag. */\ninterface ThemePreset {\n name: string;\n character: string;\n /** The literal attribute to write, e.g. `data-theme=\"midnight\"`. */\n applyAs: string;\n mode: string;\n roles: string[];\n fonts: { sans?: unknown; head?: unknown } | null;\n shape: Record<string, string>;\n light: Record<string, string>;\n dark: Record<string, string>;\n contrastWarnings: { light: Array<{ role: string; ratio: number }>; dark: Array<{ role: string; ratio: number }> };\n}\n\n/** The THEME layer: the `data-theme` mechanism, how an app declares its own,\n * the runtime `Theme` object a host stores, and the shipped presets. */\ninterface ThemesData {\n note: string;\n mechanism: {\n attribute: string;\n selectors: string[];\n builtIn: string[];\n builtInNote: string;\n apply: string;\n paints: string[];\n paintsNote: string;\n darkMode: string;\n presetModes: string;\n contentInk: string;\n never: string;\n };\n declaring: Record<string, unknown>;\n themeObject: Record<string, unknown>;\n presets: ThemePreset[];\n}\n\nconst packages = loadJson<PackageMeta[]>(\"packages\");\nconst tokens = loadJson<TokensData>(\"tokens\");\nconst themes = loadJson<ThemesData>(\"themes\");\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 the DEFAULT theme's 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. Also returns `customColors` (how to register extra color roles beyond the built-in eight, and the selector pattern for every component a registered color reaches — call this before concluding a color like `brand` is unavailable) and `theming` (the `data-theme` mechanism these values are ACTIVATED by, including dark mode and per-section theme islands). For a different palette you want a THEME, not different values here: list_themes / get_theme.\",\n inputSchema: {},\n },\n async () => ({\n content: [\n {\n type: \"text\",\n // The token values alone never said how either map is turned ON, so\n // `data-theme` — the whole mechanism — was unreachable from the tool\n // an agent calls when it asks about color. Spliced in here rather\n // than left to a tool it has no reason to discover.\n text: JSON.stringify(\n {\n ...tokens,\n theming: {\n note: themes.note,\n ...themes.mechanism,\n declaring: themes.declaring,\n themeObject: themes.themeObject,\n },\n presets: {\n count: themes.presets.length,\n names: themes.presets.map((p) => p.name),\n note: \"Considered, shipped themes — call list_themes for what each one is, get_theme for its resolved tokens. `light`/`dark` above are the DEFAULT theme (quartz); every preset re-points the same token names.\",\n },\n },\n null,\n 2,\n ),\n },\n ],\n }),\n );\n\n server.registerTool(\n \"list_themes\",\n {\n title: \"List Silica UI themes and the data-theme mechanism\",\n description:\n \"List every shipped theme preset — name, what it's for, its type faces and shape — plus the `data-theme` mechanism itself: how a theme is applied, how dark mode works (there is no `.dark` class), and how a section opts into a different palette by nesting the attribute. Call this whenever the answer involves a different palette, a dark section, or theming at all; the alternative an agent reaches for otherwise is hardcoded hex or bespoke CSS, which can never respond to the theme it ends up inside.\",\n inputSchema: {},\n },\n async () => ({\n content: [\n {\n type: \"text\",\n text: JSON.stringify(\n {\n note: themes.note,\n mechanism: themes.mechanism,\n // Summaries only — the resolved token maps are ~25 entries per\n // mode per preset. get_theme returns those for the one you pick.\n themes: themes.presets.map((p) => ({\n name: p.name,\n character: p.character,\n applyAs: p.applyAs,\n fonts: p.fonts,\n shape: p.shape,\n ...(p.contrastWarnings.light.length || p.contrastWarnings.dark.length\n ? { contrastWarnings: p.contrastWarnings }\n : {}),\n })),\n tokensNote: \"get_theme(name) returns each preset's full resolved token map for both modes.\",\n },\n null,\n 2,\n ),\n },\n ],\n }),\n );\n\n server.registerTool(\n \"get_theme\",\n {\n title: \"Get a Silica UI theme's resolved tokens\",\n description:\n \"Get one theme preset's fully RESOLVED token map — dark deltas already merged over the base tokens and every `-content` ink derived by measured contrast, i.e. what a browser actually computes rather than the authored bag — plus the exact attribute to apply it, its type faces, its shape tokens, and any role whose ink fails WCAG AA. Pass mode to get just light or just dark.\",\n inputSchema: {\n name: z.string().describe(\"Theme name — the `data-theme` value, e.g. 'midnight', 'quartz', 'clay'.\"),\n mode: z\n .enum([\"light\", \"dark\", \"both\"])\n .optional()\n .describe(\"Which mode's tokens to return. Defaults to both.\"),\n },\n },\n async ({ name, mode }) => {\n const preset = themes.presets.find((p) => p.name.toLowerCase() === name.toLowerCase());\n if (!preset) {\n return {\n content: [\n {\n type: \"text\",\n text:\n `No theme named \"${name}\". Shipped presets: ${themes.presets.map((p) => p.name).join(\", \")}. ` +\n `A name that isn't here isn't unavailable — an app declares its own with @plugin \"@wizeworks/silicaui/theme\" (see get_tokens → theming.declaring).`,\n },\n ],\n isError: true,\n };\n }\n const { light, dark, ...rest } = preset;\n const body =\n mode === \"light\" ? { light } : mode === \"dark\" ? { dark } : { light, dark };\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify(\n {\n ...rest,\n // `mode` is the Theme type's own field and reads as a\n // restriction if left unexplained — it is not one. Both maps\n // below render.\n modeNote:\n \"`mode` is which mode this theme's authored token bag expresses — not a limitation. Both maps below render. Which one a page shows is the host's dark strategy, not this field: the built-in themes switch on the `data-theme` value itself (`light`/`dark`), while a named preset is emitted as two `themeTokenCss` calls — one per mode — under whichever selectors that strategy uses.\",\n apply: themes.mechanism.apply,\n ...body,\n tokensNote:\n \"RESOLVED, not authored: the dark map is the base tokens with this theme's dark deltas merged over them and `-content` inks re-derived. Apply the theme with the attribute — do not paste these values into CSS, or the result stops tracking the theme.\",\n },\n null,\n 2,\n ),\n },\n ],\n };\n },\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 // The host contract, same as path 3's schema publishes. Without\n // it a caller can author a document and still have no idea how\n // live data reaches it — through a `data` marker or through an\n // inline `{{ref}}` token, which are different surfaces.\n resolution: email.resolution,\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 // Whether THIS kind's prose field takes inline `{{ref}}`\n // substitution is a per-kind fact an agent asking about one\n // kind needs, and the note names them — `text`/`button` yes,\n // `html` deliberately never. Carried on every kind because the\n // negative case is the one that surprises people.\n tokenNote: email.resolution.tokens,\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 // Custom colors are a CONCEPT, not a literal name, so nothing above could\n // ever match them: \"brand\", \"custom color\", \"register\" and \"@plugin\" all\n // returned empty and an agent reasonably concluded the 8 semantic roles\n // were the whole set — then refused to write `badge-brand`. Same failure\n // mode the data-binding entry below was added for.\n const COLOR_CONCEPT = [\n \"custom color\",\n \"custom colors\",\n \"color role\",\n \"n-color\",\n \"brand\",\n \"register\",\n \"registered\",\n \"declare\",\n \"@plugin\",\n \"plugin\",\n \"@theme\",\n \"palette\",\n \"extra color\",\n \"new color\",\n ];\n const matchedColorConcept = COLOR_CONCEPT.some((k) => k.includes(q) || q.includes(k))\n ? [\n {\n kind: \"concept\" as const,\n name: \"custom colors (N-color)\",\n summary: tokens.customColors.summary,\n tool: \"get_tokens\",\n field: \"customColors\",\n },\n ]\n : [];\n // Themes, by name or by character (\"warm\", \"serif\", \"navy\"). A preset's\n // name is the only handle an agent has on it, and twenty of them are\n // unguessable — `clay`, `dune`, `frost` match nothing else in the catalog.\n const matchedThemes = themes.presets\n .filter((p) => p.name.toLowerCase().includes(q) || p.character.toLowerCase().includes(q))\n .map((p) => ({ kind: \"theme\" as const, name: p.name, applyAs: p.applyAs, tool: \"get_theme\" }));\n // Theming is a MECHANISM, not a literal name — the exact failure the\n // custom-colors entry above was added for. \"dark mode\", \"data-theme\",\n // \"light/dark\" and \"theme\" all matched nothing, so an agent asked to make\n // a dark section concluded it had to write hex or its own CSS.\n const THEME_CONCEPT = [\n \"theme\",\n \"theming\",\n \"data-theme\",\n \"dark mode\",\n \"dark\",\n \"light mode\",\n \"light\",\n \"color scheme\",\n \"colour scheme\",\n \"prefers-color-scheme\",\n \"toggle\",\n \"island\",\n \"skin\",\n \"white label\",\n \"white-label\",\n \"multi-tenant\",\n ];\n const matchedThemeConcept = THEME_CONCEPT.some((k) => k.includes(q) || q.includes(k))\n ? [\n {\n kind: \"concept\" as const,\n name: \"themes (data-theme)\",\n summary: themes.note,\n tool: \"list_themes\",\n field: \"mechanism\",\n },\n ]\n : [];\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 ...matchedColorConcept,\n ...matchedThemes,\n ...matchedThemeConcept,\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"]}
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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B;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 /** How an app registers extra color roles, and everything one reaches once declared. */\n customColors: {\n summary: string;\n howToDeclare: string;\n declareNote: string;\n contentNote: string;\n utilities: string[];\n componentPatterns: string[];\n componentPatternsNote: string;\n builderNote: string;\n };\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, 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 — but the eight built-in roles are a DEFAULT, not a closed set. Silica's core promise is that N named colors cascade through everything: an app registers extra roles (get_tokens → customColors for the two-line syntax) and each works everywhere a built-in does, so \\`btn-brand\\` is exactly as real as \\`btn-primary\\`. Read a component's \\`colorPattern\\` (get_component) and substitute the registered name — most are \\`<root>-<color>\\`, but chat, pin-input and toast are not. A REGISTERED color is the one name you may use that this catalog does not list literally; an unregistered one is still an invention, and renders unstyled.\n- Do not re-skin a component with inline styles or arbitrary hex — it defeats theming and light/dark.\n- A different PALETTE is a theme, applied as \\`data-theme=\"<name>\"\\` on an element — never restyled components, a second stylesheet, or hex. Everything inside resolves against that theme's tokens, so nesting it themes one section (\\`<section data-theme=\"dark\">\\`) and putting it on <html> themes the page. Dark mode is just \\`data-theme=\"dark\"\\`; there is no \\`.dark\\` class. list_themes for the mechanism and the shipped presets, get_theme for one's resolved tokens.\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 /** Selector template for the color axis, e.g. `btn-<color>` — substitute any registered color. */\n colorPattern?: string;\n colorNote?: 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 /** The host contract: the resolve hooks, the unknown-vs-empty honesty rule,\n * and — separately from `bindingNote`'s `data` markers — how inline\n * `{{ref}}` merge tokens resolve in prose fields. */\n resolution: {\n note: string;\n honesty: string;\n tokens: string;\n host: FieldData[];\n bindableFields: Record<string, { default?: string; fields: Record<string, string> }>;\n };\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\n/** One shipped theme preset, with both modes already RESOLVED (dark deltas\n * merged, `-content` inks derived) — the map a browser actually computes, not\n * the authored bag. */\ninterface ThemePreset {\n name: string;\n character: string;\n /** The literal attribute to write, e.g. `data-theme=\"midnight\"`. */\n applyAs: string;\n mode: string;\n roles: string[];\n fonts: { sans?: unknown; head?: unknown } | null;\n shape: Record<string, string>;\n light: Record<string, string>;\n dark: Record<string, string>;\n contrastWarnings: { light: Array<{ role: string; ratio: number }>; dark: Array<{ role: string; ratio: number }> };\n}\n\n/** The THEME layer: the `data-theme` mechanism, how an app declares its own,\n * the runtime `Theme` object a host stores, and the shipped presets. */\ninterface ThemesData {\n note: string;\n mechanism: {\n attribute: string;\n selectors: string[];\n builtIn: string[];\n builtInNote: string;\n apply: string;\n paints: string[];\n paintsNote: string;\n darkMode: string;\n presetModes: string;\n contentInk: string;\n never: string;\n };\n declaring: Record<string, unknown>;\n themeObject: Record<string, unknown>;\n presets: ThemePreset[];\n}\n\nconst packages = loadJson<PackageMeta[]>(\"packages\");\nconst tokens = loadJson<TokensData>(\"tokens\");\nconst themes = loadJson<ThemesData>(\"themes\");\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 the DEFAULT theme's 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. Also returns `customColors` (how to register extra color roles beyond the built-in eight, and the selector pattern for every component a registered color reaches — call this before concluding a color like `brand` is unavailable) and `theming` (the `data-theme` mechanism these values are ACTIVATED by, including dark mode and per-section theme islands). For a different palette you want a THEME, not different values here: list_themes / get_theme.\",\n inputSchema: {},\n },\n async () => ({\n content: [\n {\n type: \"text\",\n // The token values alone never said how either map is turned ON, so\n // `data-theme` — the whole mechanism — was unreachable from the tool\n // an agent calls when it asks about color. Spliced in here rather\n // than left to a tool it has no reason to discover.\n text: JSON.stringify(\n {\n ...tokens,\n theming: {\n note: themes.note,\n ...themes.mechanism,\n declaring: themes.declaring,\n themeObject: themes.themeObject,\n },\n presets: {\n count: themes.presets.length,\n names: themes.presets.map((p) => p.name),\n note: \"Considered, shipped themes — call list_themes for what each one is, get_theme for its resolved tokens. `light`/`dark` above are the DEFAULT theme (quartz); every preset re-points the same token names.\",\n },\n },\n null,\n 2,\n ),\n },\n ],\n }),\n );\n\n server.registerTool(\n \"list_themes\",\n {\n title: \"List Silica UI themes and the data-theme mechanism\",\n description:\n \"List every shipped theme preset — name, what it's for, its type faces and shape — plus the `data-theme` mechanism itself: how a theme is applied, how dark mode works (there is no `.dark` class), and how a section opts into a different palette by nesting the attribute. Call this whenever the answer involves a different palette, a dark section, or theming at all; the alternative an agent reaches for otherwise is hardcoded hex or bespoke CSS, which can never respond to the theme it ends up inside.\",\n inputSchema: {},\n },\n async () => ({\n content: [\n {\n type: \"text\",\n text: JSON.stringify(\n {\n note: themes.note,\n mechanism: themes.mechanism,\n // Summaries only — the resolved token maps are ~25 entries per\n // mode per preset. get_theme returns those for the one you pick.\n themes: themes.presets.map((p) => ({\n name: p.name,\n character: p.character,\n applyAs: p.applyAs,\n fonts: p.fonts,\n shape: p.shape,\n ...(p.contrastWarnings.light.length || p.contrastWarnings.dark.length\n ? { contrastWarnings: p.contrastWarnings }\n : {}),\n })),\n tokensNote: \"get_theme(name) returns each preset's full resolved token map for both modes.\",\n },\n null,\n 2,\n ),\n },\n ],\n }),\n );\n\n server.registerTool(\n \"get_theme\",\n {\n title: \"Get a Silica UI theme's resolved tokens\",\n description:\n \"Get one theme preset's fully RESOLVED token map — dark deltas already merged over the base tokens and every `-content` ink derived by measured contrast, i.e. what a browser actually computes rather than the authored bag — plus the exact attribute to apply it, its type faces, its shape tokens, and any role whose ink fails WCAG AA. Pass mode to get just light or just dark.\",\n inputSchema: {\n name: z.string().describe(\"Theme name — the `data-theme` value, e.g. 'midnight', 'quartz', 'clay'.\"),\n mode: z\n .enum([\"light\", \"dark\", \"both\"])\n .optional()\n .describe(\"Which mode's tokens to return. Defaults to both.\"),\n },\n },\n async ({ name, mode }) => {\n const preset = themes.presets.find((p) => p.name.toLowerCase() === name.toLowerCase());\n if (!preset) {\n return {\n content: [\n {\n type: \"text\",\n text:\n `No theme named \"${name}\". Shipped presets: ${themes.presets.map((p) => p.name).join(\", \")}. ` +\n `A name that isn't here isn't unavailable — an app declares its own with @plugin \"@wizeworks/silicaui/theme\" (see get_tokens → theming.declaring).`,\n },\n ],\n isError: true,\n };\n }\n const { light, dark, ...rest } = preset;\n const body =\n mode === \"light\" ? { light } : mode === \"dark\" ? { dark } : { light, dark };\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify(\n {\n ...rest,\n // `mode` is the Theme type's own field and reads as a\n // restriction if left unexplained — it is not one. Both maps\n // below render.\n modeNote:\n \"`mode` is which mode this theme's authored token bag expresses — not a limitation. Both maps below render. Which one a page shows is the host's dark strategy, not this field: the built-in themes switch on the `data-theme` value itself (`light`/`dark`), while a named preset is emitted as two `themeTokenCss` calls — one per mode — under whichever selectors that strategy uses.\",\n apply: themes.mechanism.apply,\n ...body,\n tokensNote:\n \"RESOLVED, not authored: the dark map is the base tokens with this theme's dark deltas merged over them and `-content` inks re-derived. Apply the theme with the attribute — do not paste these values into CSS, or the result stops tracking the theme.\",\n },\n null,\n 2,\n ),\n },\n ],\n };\n },\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 // The host contract, same as path 3's schema publishes. Without\n // it a caller can author a document and still have no idea how\n // live data reaches it — through a `data` marker or through an\n // inline `{{ref}}` token, which are different surfaces.\n resolution: email.resolution,\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 // Whether THIS kind's prose field takes inline `{{ref}}`\n // substitution is a per-kind fact an agent asking about one\n // kind needs, and the note names them — `text`/`button` yes,\n // `html` deliberately never. Carried on every kind because the\n // negative case is the one that surprises people.\n tokenNote: email.resolution.tokens,\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 // Every group below matches through `matches()`. It used to be a literal\n // `name.toLowerCase().includes(q)` written out thirteen times, which meant\n // the whole query had to appear verbatim — so `\"app shell\"` found nothing\n // while `\"appshell\"` found seven things, and the same for DataTable,\n // EmptyState, CommandPalette and most of the React surface. Nobody types\n // the identifier; they type the words.\n //\n // That matters more here than in a human search box, and the site's own ⌘K\n // palette is in fact fine. This server exists so an AGENT reaches for a\n // real component instead of hand-rolling one, and an agent handed `[]`\n // does not retry with the space removed — it concludes there is no app\n // shell and writes its own grid. The tool manufactures the exact RULE #1\n // violation it exists to prevent, silently.\n //\n // The two hardcoded keyword lists further down are the fossil record of\n // this: both comments say \"the exact failure above\", and both patched a\n // call site instead of the test. They stay — they map real synonyms that\n // no normalisation reaches — but they are no longer load-bearing.\n // (docs/personas/issues/014.)\n const terms = q.split(/\\s+/).filter(Boolean);\n\n /**\n * Index a haystack BOTH as written and word-split, so `AppShell` answers\n * to `appshell`, `app shell` and `shell`, and `data-table` to `data table`.\n */\n const normalize = (s: string): string => {\n const raw = s.toLowerCase();\n const split = s\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/[-_]+/g, \" \")\n .toLowerCase();\n return split === raw ? raw : `${raw} ${split}`;\n };\n\n /**\n * Industry words that share no substring with what this library calls the\n * thing. Normalisation cannot reach these: `snackbar` and `toast` have no\n * letters in common in the right order, so no amount of splitting or\n * casing helps.\n *\n * Measured, not invented — 41 phrases a person would actually type were run\n * against the server and these are the ones that returned NOTHING while the\n * component sat right there (docs/personas/issues/025). Everything else in\n * that run already worked, which is why this list is short and stays short:\n * it is for true synonyms, not for spelling variants.\n */\n const ALIASES: Record<string, string[]> = {\n snackbar: [\"toast\"],\n loader: [\"loading\", \"spinner\"],\n loading: [\"skeleton\", \"spinner\"],\n history: [\"timeline\"],\n audit: [\"timeline\"],\n trail: [\"timeline\"],\n activity: [\"timeline\"],\n feed: [\"timeline\"],\n log: [\"timeline\"],\n picture: [\"avatar\", \"image\"],\n photo: [\"avatar\", \"image\"],\n headshot: [\"avatar\"],\n crumbs: [\"breadcrumb\"],\n };\n /** A term matches if ANY of its spellings does. */\n const spellings = terms.map((t) => [t, ...(ALIASES[t] ?? [])]);\n\n /**\n * `strict` is the AND pass — every term must appear in the SAME entry, which\n * is what a search should do and what issue 014 established.\n *\n * It has one failure mode, and it is the one an agent hits: add an ordinary\n * descriptive word and a working query stops working. `toast` returns 12 and\n * `message` returns 22, but `toast message` returns **0**, because no single\n * entry carries both. A person reads that as \"there is no toast component\"\n * and hand-rolls one — the exact RULE #1 violation this tool exists to stop,\n * and the same failure issue 014 was filed for, one layer further in.\n *\n * So a zero-result query RELAXES rather than switching to OR. OR was tried\n * first and is worse than it sounds: `toast message` returned 34 entries\n * with Toast nowhere in the first eight, because every Chat* component\n * matches \"message\" and nothing ranks them. A result set that buries the\n * answer is not much better than an empty one.\n *\n * Dropping the least useful WORD keeps the AND, and therefore the\n * precision: `toast message` -> `toast` -> the twelve toast entries.\n * Subsets are tried largest first, so as much of the query is honoured as\n * can be. Anything that returns results today is untouched, because the\n * full query is always tried first.\n */\n let active = spellings;\n\n /** True when every term in the ACTIVE subset (or its alias) appears. */\n const matches = (...parts: (string | null | undefined)[]): boolean => {\n if (!active.length) return false;\n const hay = parts.filter(Boolean).map((p) => normalize(p as string)).join(\" \");\n return active.every((alts) => alts.some((t) => hay.includes(t)));\n };\n\n const collect = () => {\n const matchedComponents = components\n .filter((c) => matches(c.name, c.description, c.label))\n .map((c) => ({ kind: \"component\", name: c.name, package: c.package }));\n const matchedBlocks = blocks\n .filter((b) => matches(b.name, b.description))\n .map((b) => ({ kind: \"block\", key: b.key, name: b.name }));\n const matchedBehaviors = behaviors\n .filter((b) => matches(b.type, b.description))\n .map((b) => ({ kind: \"behavior\", type: b.type }));\n const matchedClasses = Object.entries(classesByComponent).flatMap(([component, classes]) =>\n classes\n .filter((cls) => matches(cls))\n .map((cls) => ({ kind: \"class\" as const, component, class: cls })),\n );\n const matchedTokens = tokens.semanticColors\n .filter((name) => matches(name))\n .map((name) => ({ kind: \"token\" as const, name }));\n // Custom colors are a CONCEPT, not a literal name, so nothing above could\n // ever match them: \"brand\", \"custom color\", \"register\" and \"@plugin\" all\n // returned empty and an agent reasonably concluded the 8 semantic roles\n // were the whole set — then refused to write `badge-brand`. Same failure\n // mode the data-binding entry below was added for.\n const COLOR_CONCEPT = [\n \"custom color\",\n \"custom colors\",\n \"color role\",\n \"n-color\",\n \"brand\",\n \"register\",\n \"registered\",\n \"declare\",\n \"@plugin\",\n \"plugin\",\n \"@theme\",\n \"palette\",\n \"extra color\",\n \"new color\",\n ];\n const matchedColorConcept = COLOR_CONCEPT.some((k) => k.includes(q) || q.includes(k))\n ? [\n {\n kind: \"concept\" as const,\n name: \"custom colors (N-color)\",\n summary: tokens.customColors.summary,\n tool: \"get_tokens\",\n field: \"customColors\",\n },\n ]\n : [];\n // Themes, by name or by character (\"warm\", \"serif\", \"navy\"). A preset's\n // name is the only handle an agent has on it, and twenty of them are\n // unguessable — `clay`, `dune`, `frost` match nothing else in the catalog.\n const matchedThemes = themes.presets\n .filter((p) => matches(p.name, p.character))\n .map((p) => ({ kind: \"theme\" as const, name: p.name, applyAs: p.applyAs, tool: \"get_theme\" }));\n // Theming is a MECHANISM, not a literal name — the exact failure the\n // custom-colors entry above was added for. \"dark mode\", \"data-theme\",\n // \"light/dark\" and \"theme\" all matched nothing, so an agent asked to make\n // a dark section concluded it had to write hex or its own CSS.\n const THEME_CONCEPT = [\n \"theme\",\n \"theming\",\n \"data-theme\",\n \"dark mode\",\n \"dark\",\n \"light mode\",\n \"light\",\n \"color scheme\",\n \"colour scheme\",\n \"prefers-color-scheme\",\n \"toggle\",\n \"island\",\n \"skin\",\n \"white label\",\n \"white-label\",\n \"multi-tenant\",\n ];\n const matchedThemeConcept = THEME_CONCEPT.some((k) => k.includes(q) || q.includes(k))\n ? [\n {\n kind: \"concept\" as const,\n name: \"themes (data-theme)\",\n summary: themes.note,\n tool: \"list_themes\",\n field: \"mechanism\",\n },\n ]\n : [];\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((b) => matches(b.kind, b.doc, ...b.fields.map((f) => f.name)))\n .map((b) => ({ kind: \"data-binding\" as const, binding: b.kind, tool: \"get_node_schema\" }));\n const matchedNodeKinds = schema.kinds\n .filter((k) => matches(k.kind, k.typeName, k.doc))\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((k) => matches(k.kind, k.typeName, k.doc, ...k.fields.map((f) => f.name)))\n .map((k) => ({ kind: \"email-node\" as const, node: k.kind, typeName: k.typeName }));\n const matchedEmailTypes = email.documentTypes\n .filter((t) => matches(t.typeName, t.doc, ...t.fields.map((f) => f.name)))\n .map((t) => ({ kind: \"email-type\" as const, typeName: t.typeName }));\n return [\n ...matchedComponents,\n ...matchedBlocks,\n ...matchedBehaviors,\n ...matchedClasses,\n ...matchedTokens,\n ...matchedColorConcept,\n ...matchedThemes,\n ...matchedThemeConcept,\n ...matchedBindings,\n ...matchedNodeKinds,\n ...matchedTags,\n ...matchedEmail,\n ...matchedEmailTypes,\n ];\n };\n\n let results = collect();\n // Relax one word at a time and keep the MOST SPECIFIC relaxation that finds\n // anything — the smallest non-empty result set, not the first one.\n //\n // Position is not a reliable signal and trying it proved that: dropping the\n // first word is right for `status history` (-> `history` -> Timeline) and\n // wrong for `toast message` (-> `message` -> twenty-two Chat entries with\n // Toast nowhere). Dropping the last is exactly the reverse. Fewest results\n // gets both right, because the word that narrows most is the one that\n // carries the meaning.\n let ignored: string[] = [];\n if (!results.length) {\n for (let keep = spellings.length - 1; keep >= 1 && !results.length; keep--) {\n let best: typeof results | null = null;\n let bestDrop = -1;\n for (let drop = 0; drop < spellings.length; drop++) {\n active = spellings.filter((_, i) => i !== drop).slice(0, keep);\n if (active.length !== keep) continue;\n const got = collect();\n if (got.length && (best === null || got.length < best.length)) {\n best = got;\n bestDrop = drop;\n }\n }\n const dropped = terms[bestDrop];\n if (best && dropped !== undefined) {\n results = best;\n ignored = [dropped];\n }\n }\n }\n active = spellings;\n\n // SAY when the query was relaxed. A silent relaxation is its own lie: the\n // caller asked for two words, got results, and has no way to know one word\n // was dropped — so `phone zzzznotathing` would read as \"zzzznotathing is a\n // real thing in this library\". The note is a first entry rather than a new\n // response shape, so every existing caller keeps working and an agent\n // reading the list sees exactly what happened.\n if (ignored.length) {\n results = [\n {\n kind: \"search-note\" as const,\n note: `No entry matched every word. Showing results for \"${terms.filter((t) => !ignored.includes(t)).join(\" \")}\".`,\n ignored,\n },\n ...results,\n ] as typeof results;\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.55.0",
3
+ "version": "0.56.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",