neumo-mcp-server
v0.3.0MCP server for the Neumo / GDS design system
An MCP (Model Context Protocol) server that exposes the Neumo / GDS design system — components, design tokens, usage examples, and a suite of alignment/audit tools — as structured context for AI coding assistants (Claude Code, Cursor, VS Code, etc.). In practice it acts as a guardrail: when an assistant generates UI code, it can ask this server for the real component API, the real token for a color, or whether a stylesheet drifts from the design system — instead of guessing.
Summary extracted from the README.
@kofile/neumo-mcp-server
Private package.
@kofile/*is private on npm. Create a one-time Read-only npm access token (with@kofileorg membership) and runnpm config set //registry.npmjs.org/:_authToken=PASTE_TOKEN_HEREbefore installing. Guide: https://kofile.github.io/design-system/npm-token/
An MCP (Model Context Protocol) server that exposes the Neumo / GDS design system — components, design tokens, usage examples, and a suite of alignment/audit tools — as structured context for AI coding assistants (Claude Code, Cursor, VS Code, etc.).
In practice it acts as a guardrail: when an assistant generates UI code, it can ask this server for the real component API, the real token for a color, or whether a stylesheet drifts from the design system — instead of guessing.
Heads up — this server is not hosted. It runs locally over stdio. To use it you clone this monorepo, build the server once, and point your AI client at the built file. The whole setup is below and takes a couple of minutes.
Table of contents
- Quick start
- How it loads data (important)
- Resources
- Tool catalog
- Common workflows
- Using it alongside the components
- Troubleshooting
Quick start
Prerequisites
- Node.js ≥ 18
- A clone of this repository (
kofile/design-system) - An MCP-capable client — e.g. Claude Code or Cursor
1. Build the server (once)
From the monorepo root:
npm ci # install dependencies
npx nx run mcp-server:build # compiles TypeScript -> apps/mcp-server/dist/index.js
Rebuild (npx nx run mcp-server:build) whenever you pull changes to the server
or regenerate the component manifest.
2. Register the server with your AI client
MCP clients read a JSON config that tells them how to launch each server. The exact file depends on the client:
| Client | Config location |
|---|---|
| Claude Code | .mcp.json in your project root |
| Cursor | .cursor/mcp.json (or Settings → MCP) |
| VS Code (Copilot) | .vscode/mcp.json — note the servers key, not mcpServers |
| Claude Desktop | claude_desktop_config.json |
Pick the setup that matches your situation:
A. You're working inside this monorepo
The server's working directory is already the monorepo root, so the config is
simple. Add to .mcp.json:
{
"mcpServers": {
"neumo-ds": {
"command": "node",
"args": ["apps/mcp-server/dist/index.js"]
}
}
}
B. You're consuming it from another repo (React / Vue / .NET, etc.)
Install it straight from npm with npx — no clone, no working-directory
juggling. The design-system data (tokens + component manifest) is bundled into
the package and loaded relative to the module, so it runs from anywhere:
{
"mcpServers": {
"neumo-ds": {
"command": "npx",
"args": ["-y", "@kofile/neumo-mcp-server@latest"]
}
}
}
Pin a version for reproducibility (e.g. @kofile/neumo-mcp-server@1.0.0). The bundled
data is a snapshot from publish time, so the server's answers track the version
you install.
Not published to npm yet? Use Option A from a clone, or
npm packthe package and pointnpxat the resulting tarball path.
C. VS Code with GitHub Copilot (agent mode)
VS Code's MCP support lives in .vscode/mcp.json and uses a servers key
— not mcpServers like Claude Code / Cursor. First enable Copilot Chat →
Agent mode, then add:
{
"servers": {
"neumo-ds": {
"command": "npx",
"args": ["-y", "@kofile/neumo-mcp-server@latest"]
}
}
}
Working inside this monorepo instead? Use "command": "node" with
"args": ["apps/mcp-server/dist/index.js"]. You can also add it via the Command
Palette → MCP: Add Server. Open the Copilot Chat view, switch to Agent
mode, and the neumo-ds tools appear in the tools picker.
API keys / billing
This server makes no model or LLM calls and requires no API key — it just
reads local design-system data and computes. When your editor calls its tools,
that runs on your own Claude session and bills to your account, never the
publisher's. If a future tool ever needs an external key, it will be read from
your environment (e.g. "env": { "SOME_TOKEN": "${SOME_TOKEN}" } in your MCP
config) — never bundled into the package.
3. Verify the connection
Restart/reload your client and confirm the neumo-ds server connects (Claude
Code: /mcp). Then ask something like "list the Neumo components" — you
should get a list back. You're set.
4. Your first prompt (end-to-end)
A full round-trip — prompt → tool call → response — so you know what to expect:
You: "Give me the Neumo markup for a primary Save button."
Assistant → tool call:
get-usage-examplewith{ "tagName": "neumo-button" }Tool response:
{ "tagName": "neumo-button", "variant": "default", "description": "Primary button", "html": "<neumo-button variant=\"primary\">Save changes</neumo-button>" }Assistant: drops
<neumo-button variant="primary">Save changes</neumo-button>straight into your file.
Another everyday one — checking a color pair for accessibility:
You: "Does white text on
--color-primary-600pass WCAG AA?"Assistant → tool call:
check-contrastwith the foreground/background colorsTool response: the contrast ratio plus pass/fail per WCAG level — so the assistant can tell you whether it's compliant and, if not,
suggest-tokena passing alternative.
How it loads data (important)
On startup the server loads the component manifest + token JSON. It looks in two places, in order, so it works whether installed or run from a clone:
- Bundled data at
data/, resolved relative to the server module — this is what makesnpx/installed usage work from any directory. - Live monorepo files at
process.cwd()(packages/wc/custom-elements.json,packages/foundations/tokens/{Global,Light,Dark}.json) — used when running from a clone, so you always get current files.
Bundled data wins when present. The bundle is produced at build/publish time by
scripts/bundle-data.mjs, so the installed package's answers are a snapshot of
the design system at the version you installed.
This resolved the
cwd-relative gap previously tracked in UX-1856 — the server no longer needs acdwrapper to run from outside the monorepo.
custom-elements.json is generated by nx run wc:cem; in a clone, if it's
missing or stale, component tools will say so — regenerate it and rebuild.
Resources
Resources are read-only blobs the client can pull on demand:
| URI | Description |
|---|---|
neumo://components/manifest |
Full Custom Elements Manifest (every component's props, events, slots) |
neumo://tokens/global |
Global / primitive design tokens |
neumo://tokens/light |
Light-mode tokens |
neumo://tokens/dark |
Dark-mode tokens |
Tool catalog
Twenty tools, grouped by purpose. Inputs are shown as name (type) —
bold = required.
Discovery
list-components
List every public Neumo component with its tag name and description. Inputs: none.
"What components does Neumo have?" → a table of
neumo-*tags.
get-component
Full API for one component: props, events, slots, CSS parts.
Inputs: tagName (string) — e.g. neumo-button.
// request
{ "tagName": "neumo-button" }
// response (shape)
{ "tagName": "neumo-button", "attributes": [/* variant, disabled, … */],
"events": [/* ds-button-click … */], "slots": [/* … */], "cssParts": [/* … */] }
get-usage-example
A ready-to-paste snippet for a component, with realistic values — in web
components (@kofile/gds-wc, the default) or React (@kofile/gds-react).
Inputs: tagName (string), variant (string, optional — e.g.
"disabled", "dark", "error"), framework ("wc" | "react", optional —
default "wc").
// web-component HTML (default)
{ "tagName": "neumo-button", "variant": "disabled" }
// React JSX for @kofile/gds-react
{ "tagName": "neumo-button", "variant": "icon", "framework": "react" }
React examples cover every component that ships a React binding. For a WC-only part the tool returns the web-component markup with a note, so the assistant never invents a React API that doesn't exist.
The CSS-only grid is also available here under the key
gds-grid(it's@kofile/gds-grid, a framework-agnostic Bootstrap 5 grid — no custom element, so it doesn't appear inlist-components). Both frameworks return the same.container/.row/.col-*markup, differing only byclass/classNameand the one-time@import "@kofile/gds-grid"stylesheet load.
search-components
Fuzzy search across tag names, descriptions, slot/event/attribute names. Returns
a ranked list with match details.
Inputs: query (string) — e.g. "password", "change event".
Tokens
get-tokens
Search/filter design tokens. Returns a flat list of
{ name, cssVar, value, type, description }.
Inputs (all optional): category (string, e.g. "color", "spacing"),
query (string, fuzzy match), source ("global" | "light" | "dark").
{ "category": "color", "query": "primary", "source": "light" }
The next three answer "is this real, what is it, and what depends on it". Reach
for check-token-exists before writing any token name you have not read back
from get-tokens in the same session — a name that sounds right but does not
exist is the most common way design system code goes wrong.
All three accept a token in whatever spelling it appears in: spacing.md,
--spacing-md, var(--spacing-md), or {spacing.md}.
check-token-exists
Yes/no on a token name, with the closest real names when the answer is no.
Inputs: name (string), theme ("light" | "dark", optional).
{ "name": "color.primary.650" }
// → exists: false, suggestions: ["color.primary.600", "color.primary.100", …]
resolve-token
The literal value a token ends up as, following every alias hop. Returns one
entry per leaf, because composite tokens — all of Light and Dark, plus
component sizing in Global — are authored as objects (default, hover,
active, focus, fill). via lists the hops taken.
Inputs: name (string), theme ("light" | "dark", optional).
{ "name": "button.color.background.solid.primary", "theme": "dark" }
// → name: "button.dark.color.background.solid.primary"
// leaves: [{ part: "default", value: "#6640c2",
// via: ["color.primary.600", "primitive.purple.600"] }, …]
A leaf comes back with value: null and a problem rather than echoing raw
text: unknown-reference (the name does not exist), circular-reference, or
composite-reference (the target is real but is itself a composite, so there is
no single string to inline — its name is the last entry in via, resolve that
in turn).
get-token-aliases
What a token points at, and what points at it — the blast radius before you
rename or change a value. aliasOf flags any reference whose target does not
exist.
Inputs: name (string), theme ("light" | "dark", optional).
{ "name": "color.primary.600" }
// → aliasOf: [{ part: "", reference: "primitive.purple.600", exists: true }]
// aliasedBy: 23 tokens, each with the leaf the reference sits on
On themes. The theme is part of the token name here (
button.light.color…), not a per-file override of a shared name — Global and Light share zero names. Sothemeselects which name to look at, and a component name missing its theme segment is retried with it spliced in. Scoping keys on the source file rather than the name, which is what keeps the three Dark tokens that omit.dark.(switch.color.background.primaryand its border/outline siblings) reachable undertheme: "dark".
Audit & alignment
These analyze code/values and (for the audits) emit { total, matched, nearMatched } counts that feed directly into score-alignment.
eval-component
The one-call parity harness. Evaluate a component's markup + CSS against the
design system in a single pass: it composes audit-tokens, audit-spacing,
audit-typography, audit-a11y, and find-component-replacements, then folds
the measurable token dimensions (colors/spacing/typography) into a weighted
0–100 score via score-alignment. Returns { score, passesA11y, breakdown, failures, suggestedFixes, summary, recommendations, limitations } — a
deterministic, loop-friendly report where every failure names the offending
value and its fix, so an assistant can iterate until the score converges.
Inputs (at least one of): markup (string, HTML/JSX), css (string); plus
jsx (boolean), path (string), weights (object).
{ "css": ".btn{padding:15px;color:#ff00aa}", "markup": "<button>Go</button>", "jsx": true }
Accessibility is a gate, not a weighted score, and component usage is reported, not weighted — neither has a trustworthy pass ratio, so folding them into the number would mislead.
passesA11yturns false on any critical/serious violation;scoreisnullwhen no CSS is supplied (nothing to weigh — not the same as scoring 0).
audit-typography
Audit CSS typography (font-family, font-size, font-weight, line-height,
letter-spacing, and the font shorthand) against the type scale. Buckets each
value on-scale | off-scale-near | off-scale-far | wrong-family.
Inputs: css (string).
audit-spacing
Audit CSS spacing/sizing (padding, margin, gap, width/height, inset,
…) against the spacing scale, and border-radius against the radius scale.
Buckets each value on-scale | off-scale-near | off-scale-far | uses-token | ignored.
Inputs: css (string).
check-contrast
WCAG 2.1 contrast ratio between two hex colors, with AA/AAA pass/fail for normal
and large text.
Inputs: foreground (string), background (string) — hex.
{ "foreground": "#1a1a1a", "background": "#ffffff" }
suggest-token
Find the closest color token for a hex value; recommends use-existing vs
create-new based on RGB distance.
Inputs: hexValue (string), category (string, optional), threshold
(number, optional — default 15).
remap-variables
Map every custom-property value in a CSS block to its nearest token
(direct-map | near-map | no-match), and return a paste-ready :root migration
snippet.
Inputs: css (string).
score-alignment
Compute a 0–100 design-system alignment score from audit outputs. Accepts
partial input — pass whichever audits you ran. Returns a weighted overall score,
per-category breakdown, plain-English summary, and prioritized recommendations.
Inputs (all optional): colors, spacing, typography, components (each
{ total, matched, nearMatched }), weights (override the defaults — colors 30,
spacing 25, typography 25, components 20).
{
"typography": { "total": 12, "matched": 9, "nearMatched": 2 },
"spacing": { "total": 20, "matched": 16, "nearMatched": 3 }
}
Visual
visual-diff
Pixel-diff a component against a supplied baseline and return a match score
(0–1) plus a diff image. Two modes: pass a candidate PNG for a pure diff
(no browser — ideal in CI), or pass a render target (url, or html+css)
to screenshot the candidate with Playwright, then diff. The baseline is an
input, so it can be a live Figma frame (via the Figma MCP, for seat-holders)
or a bundled golden (seat-less). Rendering needs Playwright + a browser;
when absent, the tool returns available: false with guidance instead of
failing — heavy visual-regression belongs in CI, this is the local front door.
Inputs: baseline (string — data: URI, base64, or path), plus one of
candidate (string) or render ({ url | html, css?, selector?, viewport? });
threshold (number, default 0.1), passThreshold (number, default 0).
// CI-friendly pure diff (no browser)
{ "baseline": "data:image/png;base64,…", "candidate": "data:image/png;base64,…", "passThreshold": 0.01 }
// render + diff (needs a browser)
{ "baseline": "iVBORw0KG…", "render": { "html": "<button class=\"btn\">Go</button>", "css": ".btn{…}", "selector": ".btn" } }
Common workflows
Audit a stylesheet, then score it. Run audit-typography and
audit-spacing on a component's CSS, then pass their count outputs into
score-alignment for a single 0–100 number plus recommendations.
Find the token for a hand-picked color. Got #6b7280 in a design? Call
suggest-token to get the nearest token (or a "create a new one" nudge), then
check-contrast it against its background before committing.
Migrate a legacy :root. Paste a block of custom properties into
remap-variables to get a token-based replacement snippet.
Scaffold from a real component. Ask search-components to find the right
component, get-component for its exact API, then get-usage-example for a
working snippet to adapt.
Iterate a component to parity. Paste a component's markup + CSS into
eval-component for one score + a ranked list of specific fixes, apply them, and
re-run until the score converges and passesA11y is true. This is the one-call
loop that ties the individual audits together — reach for it first, and drop to
the individual audit-* tools when you need to drill into a single dimension.
Using it alongside the components
This server documents the components; you still install and render them from the
web-component package, @kofile/gds-wc (custom elements work in Vue,
Angular, Svelte, or plain HTML). Browse them live:
- Web Component Storybook —
https://kofile.github.io/design-system/wc/ - React Storybook —
https://kofile.github.io/design-system/react-bundle/
The typical loop for a consuming team: use the MCP tools to discover the right component and its API, drop in the usage example, and let the audit tools keep the surrounding styles on-system.
Troubleshooting
| Symptom | Cause / fix |
|---|---|
| Server won't connect | Build first (npx nx run mcp-server:build); confirm apps/mcp-server/dist/index.js exists and node is on PATH. |
| Component tools return nothing / "custom-elements.json not found" | The server isn't running from the monorepo root. Use the setup B cd … && node … wrapper, or run from the repo root. Regenerate the manifest with nx run wc:cem if it's missing. |
| Token tools return nothing | Same cwd issue — the tokens/*.json files aren't resolving. Check the working directory. |
| Changes to the server aren't reflected | Rebuild (npx nx run mcp-server:build) and reload the MCP client. |
get-usage-example says variant not found |
The response lists available variants — pick one of those, or omit variant for the default. |
Run it by hand
To sanity-check outside a client, start it from the monorepo root:
npx nx run mcp-server:start # or: node apps/mcp-server/dist/index.js
It communicates over stdio (no port). Clients launch it for you — manual runs are just for debugging that it boots and loads data.
Development
npx nx run mcp-server:build # tsc -> dist/
npm --prefix apps/mcp-server test # vitest (unit tests for the audit/score tools)
npm --prefix apps/mcp-server run smoke # end-to-end: every tool over stdio, answers checked
npm --prefix apps/mcp-server run smoke -- 0.2.1 # same, against a published version via npx
Run the smoke test before a release. Results and open findings: SMOKE_TEST.md.