About Swatchbook
Swatchbook is an MCP server published by unpunnyfuns in the Blockchain category: model Context Protocol server for swatchbook — exposes a DTCG project's tokens, axes, and diagnostics to AI agents without running Storybook. Conduid read 14 tools from its source: describe_project, emit_css, get_alias_chain, get_aliased_by, get_axis_variance, get_color_contrast and 8 more. It is published to npm as @unpunnyfuns/swatchbook-mcp and starts with npx.
The unpunnyfuns/swatchbook monorepo this package is published from has 28 stars and 1 forks, and its last commit was on 27 Nov 2026. Conduid has no tagged release on record for it. It passes all 1 static checks Conduid ran on the repository. Its topics include design-system, design-tokens, storybook and storybook-addon.
Install
claude mcp add swatchbook -- npx -y @unpunnyfuns/swatchbook-mcpnpx -y @unpunnyfuns/swatchbook-mcpgit clone https://github.com/unpunnyfuns/swatchbookTools (14)
describe_projectHigh-level summary of the project — total token count per theme, axes (with contexts) and how they compose, preset list, diagnostic counts by severity, css-var prefix, and the DTCG `$type`s present. Good first call for an agent that needs an orientation before querying specifics.emit_cssReturn the full project CSS — a `:root` baseline + per-axis singleton cells (`[data-<prefix>-<axis>="<context>"]`) + compound joint-override blocks for tokens whose value at a multi-axis combination diverges from cascade composition + a trailing chrome alias block. Same output the addon injects into Storybook and the docs-site chrome pipeline writes to disk. Useful when an agent needs to inline the stylesheet into a generated artifact.get_alias_chainForward alias chain for a token — the sequence of paths it resolves through on the way to a primitive value (e.g. `color.accent.bg → color.brand.blue.700 → color.palette.blue.700`). Returns the chain per theme because aliases can resolve through different paths per axis context. Empty chain when the token is a primitive (no aliases) or missing.| Parameter | Type | Description |
|---|---|---|
| path * | string | Dot-path of the token, e.g. `color.accent.bg`. |
get_aliased_byBackward alias tree for a token — every token that resolves through this path at any depth. Breadth-first walk with cycle protection; `maxDepth` caps recursion (default 6). Empty when nothing aliases the token.| Parameter | Type | Description |
|---|---|---|
| maxDepth | number | Maximum recursion depth. Default 6. |
| path * | string | Dot-path of the token, e.g. `color.palette.blue.500`. |
get_axis_varianceClassify how a token's resolved value depends on the project's axes. Returns `kind` — `constant` (same across every tuple), `single` (varies with exactly one axis, e.g. mode only), or `multi` (varies across two or more axes). Also returns `varyingAxes` / `constantAcrossAxes` plus a `perAxis` breakdown with each context's stringified value (holding other axes at their defaults). Use when reasoning about whether a token is theme-independent, whether a refactor changed an axis dependency, or to confirm that (say) a role token only varies with `contrast`.| Parameter | Type | Description |
|---|---|---|
| path * | string | Dot-path of the token to analyse, e.g. `color.text.default`. |
get_color_contrastCompute the contrast between two color tokens for a given theme. The score is returned under `value`: WCAG 2.1 returns the ratio (1–21) plus AA/AAA pass flags for normal + large text; APCA returns the signed Lc value plus body / large-text / non-text pass flags (absolute-value thresholds 75 / 60 / 45). Use this when reasoning about text legibility, focus-ring visibility, border contrast, etc., without having to reimplement the luminance math in the agent. Per-theme so the same pair can be checked against Light, Dark, High-contrast, etc.| Parameter | Type | Description |
|---|---|---|
| algorithm | string | Contrast algorithm. `wcag21` is the classic 4.5:1 ratio; `apca` is the perceptually-weighted Silver-draft successor. Defaults to `wcag21`. |
| background * | string | Dot-path of the background color token, e.g. `color.surface.default`. |
| foreground * | string | Dot-path of the foreground color token, e.g. `color.text.default`. |
| theme | string | Theme name. Defaults to the project default theme. |
get_color_formatsFor a color token, return its value rendered in every format the addon toolbar exposes — `hex`, `rgb`, `hsl`, `oklch`, and the raw JSON. Each entry carries an `outOfGamut` flag when the chosen colorspace can't losslessly represent the token (wide-gamut tokens rendered in sRGB, for example). Skips non-color tokens.| Parameter | Type | Description |
|---|---|---|
| path * | string | Dot-path of a color token, e.g. `color.accent.bg`. |
| theme | string | Theme name to read the value from. Defaults to the project default theme. |
get_css_usageCSS var reference + resolved value + HTML data-attribute activation for a token under an optional axis tuple. Tells an agent everything it needs to write a stylesheet or JSX snippet that pins a particular theme combination — `selector` is the compound CSS selector that matches the tuple on `<html>`, `attrs` is the same information as HTML attributes, `cssVar` is the `var(--…)` reference. Tuple defaults to the project default when omitted.| Parameter | Type | Description |
|---|---|---|
| path * | string | Dot-path of the token, e.g. `color.accent.bg`. |
| tuple | object | Optional axis tuple (e.g. `{ mode: "Dark", brand: "Brand A" }`). Defaults to each axis's own default. |
get_diagnosticsList parser / resolver / validation diagnostics for the project. Each entry carries a severity (`error`, `warn`, `info`), group, message, and optional filename / line / column for locating the issue.| Parameter | Type | Description |
|---|---|---|
| severity | string | Optional severity filter. Omit for all diagnostics. |
get_tokenGet full details for a single token: resolved value in every theme, DTCG `$type`, `$description`, `$deprecated` (message or `true` when the token is deprecated), an axis-variance summary (`kind` + the axes it flips across, present only when it varies — see `get_axis_variance` for the per-axis breakdown), alias chain, aliased-by list, and CSS var reference. Use after `list_tokens` to inspect a specific path.| Parameter | Type | Description |
|---|---|---|
| path * | string | Dot-path of the token, e.g. `color.accent.bg`. |
list_axesList the project axes — each axis has a name, its contexts (discrete values like `Light` / `Dark`), a default, and a source (`resolver` for DTCG-resolver-driven, `layered` for authored layered axes, `synthetic` for single-theme projects). Also returns the named themes (one per default tuple + per-axis non-default singleton + preset) and any presets defined in the project config.list_tokensList token paths in the project, optionally filtered by path glob (`color.*`, `color.palette.**`) and/or DTCG `$type` (color, dimension, typography, …). Returns path + $type + stringified value from the default theme. Use this first to discover what tokens exist; follow with get_token for details.| Parameter | Type | Description |
|---|---|---|
| filter | string | Dot-path glob, e.g. `color.*` or `color.palette.**`. Omit for all tokens. |
| theme | string | Theme name to read values from. Defaults to the project default theme. |
| type | string | DTCG `$type` to scope the result, e.g. `color`, `dimension`, `typography`. |
resolve_themeResolve the full token map for a given axis tuple. Agent passes a partial tuple (`{ mode: "Dark", brand: "Brand A" }`); any axis omitted — or the whole `tuple` argument itself — falls back to that axis's default, so calling with no `tuple` resolves the project default theme. Returns the matching theme name, the complete tuple after filling defaults, and the resolved `{ path: { value, type, aliasOf?, aliasChain? } }` map — effectively "what do all tokens look like if I pin this combination".| Parameter | Type | Description |
|---|---|---|
| filter | string | Optional path glob to scope the returned map. |
| tuple | object | Partial axis tuple, e.g. `{ mode: "Dark", brand: "Brand A" }`. Omit for the project default theme. |
| type | string | Optional DTCG `$type` to scope the returned map. |
search_tokensFuzzy search across token paths, `$description`, and stringified values. Case-insensitive, tolerates a single-character typo per term, and accepts out-of-order terms (`"blue palette"` finds `color.palette.blue.500`). Returns matches ranked by relevance with a short snippet pointing at where the match hit. Use when you know what you want but not the exact path. Scopes to a single theme (default: project default).| Parameter | Type | Description |
|---|---|---|
| limit | number | Cap the result count. Default 50. |
| query * | string | Fuzzy query (case-insensitive). |
| theme | string | Theme name to search within. Defaults to the project default. |
Security checks
From the unpunnyfuns/swatchbook monorepo, not this package alone.
- ✓README presentThe repository's README runs to about 246 words.
5 checks have not been run yet.
README
The repository's README runs to about 246 words. The original in the repository is authoritative.
Read full README