@wizeworks/silicaui-mcp 0.48.0 → 0.50.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.
@@ -35,6 +35,107 @@
35
35
  }
36
36
  ],
37
37
  "bindingNote": "A node carries AT MOST ONE `data` marker. `value` fills one field (`attr` picks which — see each kind's `binding.fields`; omitting it targets `binding.default`); `collection` repeats a node's children once per item and is only meaningful on a kind with children; `visible` keeps or drops the subtree; `action` is an inert marker the host wires. Two per-item values on one card is COMPOSITION, not two markers: a `link` group binds the href while each child binds its own field.",
38
+ "resolution": {
39
+ "note": "A host implements `resolveBinding` / `resolveCollection` and `resolveEmailTree` walks the document with them — the email twin of path 3's `resolveTree`, same shape and same contract. Pure and SYNCHRONOUS: a host with an async source fetches ONCE, up front. `toEmailHtml(doc, host)` runs the walk itself, so preview and send resolve identically. `action` nodes are never touched. Absent ALL the resolve hooks the walk is a no-op and the document projects exactly as authored.",
40
+ "honesty": "The hooks distinguish `undefined` (I have never heard of this ref) from `{ value: undefined }` (I know it and it is empty). An UNKNOWN ref keeps the node's AUTHORED content and fires a diagnostic; a KNOWN-but-empty ref renders empty, which is a legitimate result. Only `collection` differs on one point: `omitWhenEmpty` applies to a known-empty list, never to an unknown ref.",
41
+ "tokens": "Inline `{{ref}}` merge tokens are substituted inside PROSE fields — `text.html`, `button.label`, and the document's `subject`/`preheader` — independently of any whole-field `data` bind on the same node. A sentence like \"Hi {{customer.firstName}}, your order shipped\" has no single field to bind wholesale, so each token resolves on its own through the SAME `resolveBinding` hook. `html` nodes are NEVER substituted: that field is raw passthrough, so an ESP's own merge tags survive it verbatim. Silica's token grammar is exactly ONE production — a bare dotted path, `[a-zA-Z0-9_.]+`. A token containing anything else (a fallback like `{{name ?? \"there\"}}`, a filter pipe) is an EXPRESSION and is handed to the optional `resolveExpression` hook VERBATIM — braces stripped and outer whitespace trimmed, nothing tokenized, unquoted or evaluated — so the expression language lives in the host and silica never parses it. Unhandled either way, the token keeps its literal source and reports (`unknown-ref` for a path, `unknown-expression` for an expression: a misspelled field and an unwired syntax need different fixes). A resolved value is HTML-escaped inside `text.html` and left raw where the projector escapes it itself, so it is never double-escaped.",
42
+ "host": [
43
+ {
44
+ "name": "resolveBinding",
45
+ "optional": true,
46
+ "type": "(ref: string, scope: DataScope) => Resolved | undefined",
47
+ "doc": ""
48
+ },
49
+ {
50
+ "name": "resolveCollection",
51
+ "optional": true,
52
+ "type": "(ref: string, scope: DataScope) => readonly unknown[] | undefined",
53
+ "doc": ""
54
+ },
55
+ {
56
+ "name": "resolveExpression",
57
+ "optional": true,
58
+ "type": "(expr: string, scope: DataScope) => Resolved | undefined",
59
+ "doc": "Resolve an inline `{{…}}` token whose contents are NOT a bare dotted path — i.e. anything silica's own token grammar deliberately does not parse: `{{customer.firstName ?? \"there\"}}`, `{{price | currency}}`, whatever an ESP's documented syntax happens to be. This hook exists so the EXPRESSION LANGUAGE stays out of silica. Silica owns exactly one production — a dotted path — and hands everything else to the host verbatim (trimmed of its braces and surrounding whitespace, and NOTHING else: no tokenizing, no unquoting, no evaluation). A host that already runs its own interpolation pass over the projected HTML can reuse that same evaluator here and get an identical answer on the canvas. Same three-state contract as `resolveBinding`: `undefined` = \"I don't understand this expression\" (the literal `{{…}}` stays exactly as authored and an `unknown-expression` diagnostic fires), `{ value: undefined }` / `visible: false` = \"understood, renders empty\". Absent → non-path tokens pass through verbatim, which is what they did before this hook existed. Wiring it is purely additive."
60
+ },
61
+ {
62
+ "name": "onDiagnostic",
63
+ "optional": true,
64
+ "type": "(d: ResolveDiagnostic) => void",
65
+ "doc": ""
66
+ }
67
+ ],
68
+ "bindableFields": {
69
+ "text": {
70
+ "default": "html",
71
+ "fields": {
72
+ "html": "string"
73
+ }
74
+ },
75
+ "image": {
76
+ "default": "src",
77
+ "fields": {
78
+ "src": "string",
79
+ "alt": "string",
80
+ "href": "string",
81
+ "width": "number"
82
+ }
83
+ },
84
+ "link": {
85
+ "default": "href",
86
+ "fields": {
87
+ "href": "string"
88
+ }
89
+ },
90
+ "button": {
91
+ "default": "label",
92
+ "fields": {
93
+ "label": "string",
94
+ "href": "string",
95
+ "bg": "string",
96
+ "color": "string"
97
+ }
98
+ },
99
+ "divider": {
100
+ "fields": {
101
+ "color": "string",
102
+ "thickness": "number"
103
+ }
104
+ },
105
+ "spacer": {
106
+ "fields": {
107
+ "height": "number"
108
+ }
109
+ },
110
+ "html": {
111
+ "default": "html",
112
+ "fields": {
113
+ "html": "string"
114
+ }
115
+ },
116
+ "video": {
117
+ "default": "href",
118
+ "fields": {
119
+ "href": "string",
120
+ "thumbnail": "string",
121
+ "width": "number"
122
+ }
123
+ },
124
+ "section": {
125
+ "fields": {
126
+ "bg": "string",
127
+ "bgImage": "string"
128
+ }
129
+ },
130
+ "body": {
131
+ "fields": {
132
+ "bg": "string",
133
+ "contentBg": "string",
134
+ "fontFamily": "string"
135
+ }
136
+ }
137
+ }
138
+ },
38
139
  "documentTypes": [
39
140
  {
40
141
  "typeName": "SocialLink",
@@ -305,8 +305,8 @@
305
305
  {
306
306
  "name": "code",
307
307
  "optional": false,
308
- "type": "\"unknown-ref\" | \"hidden\"",
309
- "doc": "`unknown-ref` — the host returned `undefined` for a ref it was asked about (a typo, a stale document, a catalog entry its resolver doesn't implement). `hidden` — an `editing` walk kept a `visible: false` node that production would have dropped, so an editor can render it ghosted. Additive union; new codes are non-breaking."
308
+ "type": "\"unknown-ref\" | \"hidden\" | \"unknown-expression\"",
309
+ "doc": "`unknown-ref` — the host returned `undefined` for a ref it was asked about (a typo, a stale document, a catalog entry its resolver doesn't implement). `hidden` — an `editing` walk kept a `visible: false` node that production would have dropped, so an editor can render it ghosted. `unknown-expression` — an inline `{{…}}` token carried something other than a bare dotted path and the host either has no `resolveExpression` hook or didn't understand the expression. Distinct from `unknown-ref` on purpose: the fix is a host that speaks that syntax, not a corrected reference, and an editor badging \"unknown field\" over `{{a ?? \"b\"}}` would be lying. (Email-only today — the site tree has no inline token pass.) Additive union; new codes are non-breaking."
310
310
  },
311
311
  {
312
312
  "name": "ref",
package/dist/server.js CHANGED
@@ -432,7 +432,12 @@ function createServer() {
432
432
  palette: email.palette,
433
433
  // The envelope, in full: it's small, and a caller that has the
434
434
  // kinds but not `EmailDocument` still can't produce a document.
435
- documentTypes: email.documentTypes
435
+ documentTypes: email.documentTypes,
436
+ // The host contract, same as path 3's schema publishes. Without
437
+ // it a caller can author a document and still have no idea how
438
+ // live data reaches it — through a `data` marker or through an
439
+ // inline `{{ref}}` token, which are different surfaces.
440
+ resolution: email.resolution
436
441
  },
437
442
  null,
438
443
  2
@@ -472,6 +477,12 @@ function createServer() {
472
477
  ...node,
473
478
  sharedFields: email.sharedFields,
474
479
  bindingNote: email.bindingNote,
480
+ // Whether THIS kind's prose field takes inline `{{ref}}`
481
+ // substitution is a per-kind fact an agent asking about one
482
+ // kind needs, and the note names them — `text`/`button` yes,
483
+ // `html` deliberately never. Carried on every kind because the
484
+ // negative case is the one that surprises people.
485
+ tokenNote: email.resolution.tokens,
475
486
  palette: email.palette.filter((p) => p.kind === node.kind)
476
487
  },
477
488
  null,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;AAOA,IAAM,OAAO,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAC,CAAA;AACxD,IAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,MAAM,CAAA;AAEtC,SAAS,SAAY,IAAA,EAAiB;AACpC,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,IAAA,CAAK,IAAA,CAAK,OAAA,EAAS,CAAA,EAAG,IAAI,CAAA,KAAA,CAAO,CAAA,EAAG,MAAM,CAAC,CAAA;AAC5E;AAiBA,SAAS,cAAA,GAAyB;AAGhC,EAAA,IAAI;AACF,IAAA,MAAM,MAAM,IAAA,CAAK,KAAA;AAAA,MACf,aAAa,IAAA,CAA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port 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}\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 },\n null,\n 2,\n ),\n },\n ],\n }),\n );\n\n server.registerTool(\n \"get_email_node\",\n {\n title: \"Get an email node kind's real fields\",\n description:\n \"Get one email node kind's full definition: every typed field with its TypeScript type, whether it's optional, and its source doc comment; the fields shared by every node (id/ord/data/locked); its nesting rules; and its data-binding contract — which `attr` a `value` bind may target and which one a bind with no `attr` fills. Use this instead of guessing field names: an unknown field is dropped by the engine and an unknown bind target is inert, neither with an error.\",\n inputSchema: {\n kind: z.string().describe(\"Node kind, e.g. 'link', 'image', 'section'. See list_email_nodes.\"),\n },\n },\n async ({ kind }) => {\n const node = email.kinds.find((k) => k.kind === kind.toLowerCase());\n if (!node) {\n return {\n content: [\n {\n type: \"text\",\n text: `No email node kind \"${kind}\". Known kinds: ${email.kinds.map((k) => k.kind).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify(\n {\n ...node,\n sharedFields: email.sharedFields,\n bindingNote: email.bindingNote,\n palette: email.palette.filter((p) => p.kind === node.kind),\n },\n null,\n 2,\n ),\n },\n ],\n };\n },\n );\n\n server.registerTool(\n \"get_node_schema\",\n {\n title: \"Get the Silica UI node-tree schema (path 3)\",\n description:\n \"Get the DOCUMENT schema for @wizeworks/silicaui-html — the shape of the tree itself, as opposed to what you put in it. Covers the four node kinds and their fields, the typed system-metadata band every node carries (data / slot / behavior / part / locked / instanceOf), the DATA-BINDING vocabulary with every field, the resolution contract a host implements, and the raw-element/attribute allowlist `toHtml` enforces. Call this before authoring or generating a node tree: the failures here are SILENT — an unlisted tag is downgraded to <div>, an unlisted attribute is dropped, an invented binding field is not persisted — so none of it can be inferred from output that looks like it worked. Not needed for path 1 (CSS classes on your own HTML) or path 2 (React).\",\n inputSchema: {\n section: z\n .enum([\"all\", \"nodes\", \"bindings\", \"resolution\", \"elements\"])\n .optional()\n .describe(\n \"Narrow the answer: 'nodes' (kinds + the shared metadata band), 'bindings' (the data vocabulary), 'resolution' (the host hooks and their honesty contract), 'elements' (the tag/attribute floor). Omit for everything.\",\n ),\n },\n },\n async ({ section }) => {\n const head = {\n entrypoint: schema.entrypoint,\n behaviorRuntime: schema.behaviorRuntime,\n sourceFile: schema.sourceFile,\n note: schema.note,\n };\n const sections: Record<string, unknown> = {\n nodes: { child: schema.child, nodeBase: schema.nodeBase, kinds: schema.kinds },\n bindings: { bindingNote: schema.bindingNote, dataBindings: schema.dataBindings },\n resolution: schema.resolution,\n elements: schema.elementFloor,\n };\n const body =\n !section || section === \"all\"\n ? { ...sections.nodes as object, ...sections.bindings as object, resolution: schema.resolution, elementFloor: schema.elementFloor }\n : sections[section];\n return { content: [{ type: \"text\", text: JSON.stringify({ ...head, ...(body as object) }, null, 2) }] };\n },\n );\n\n server.registerTool(\n \"search_docs\",\n {\n title: \"Search Silica UI catalog data\",\n description:\n \"Full-text search across everything this server knows: component names/descriptions, block names/descriptions, behavior descriptions, literal CSS class names, design tokens, and the email builder's node kinds + their fields. Use this when you don't know the exact name to look up.\",\n inputSchema: {\n query: z.string().describe(\"Search term, case-insensitive.\"),\n },\n },\n async ({ query }) => {\n const q = query.toLowerCase();\n const matchedComponents = components\n .filter((c) => c.name.toLowerCase().includes(q) || (c.description ?? \"\").toLowerCase().includes(q) || (c.label ?? \"\").toLowerCase().includes(q))\n .map((c) => ({ kind: \"component\", name: c.name, package: c.package }));\n const matchedBlocks = blocks\n .filter((b) => b.name.toLowerCase().includes(q) || b.description.toLowerCase().includes(q))\n .map((b) => ({ kind: \"block\", key: b.key, name: b.name }));\n const matchedBehaviors = behaviors\n .filter((b) => b.type.toLowerCase().includes(q) || b.description.toLowerCase().includes(q))\n .map((b) => ({ kind: \"behavior\", type: b.type }));\n const matchedClasses = Object.entries(classesByComponent).flatMap(([component, classes]) =>\n classes\n .filter((cls) => cls.toLowerCase().includes(q))\n .map((cls) => ({ kind: \"class\" as const, component, class: cls })),\n );\n const matchedTokens = tokens.semanticColors\n .filter((name) => name.toLowerCase().includes(q))\n .map((name) => ({ kind: \"token\" as const, name }));\n // 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,MA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A,QACH,GAAG,mBAAA;AAAA,QACH,GAAG,eAAA;AAAA,QACH,GAAG,gBAAA;AAAA,QACH,GAAG,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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wizeworks/silicaui-mcp",
3
- "version": "0.48.0",
3
+ "version": "0.50.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",