neumo-mcp-server

v0.3.0
@kofile/neumo-mcp-server Checked 2 days ago Published 1 month ago

MCP server for the Neumo / GDS design system

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list-components

List all public Neumo web components with their tag names and descriptions.

get-component

Get full details for a single component: props, events, slots, CSS parts.

ParameterTypeDescription
tagName *stringThe custom element tag name, e.g. neumo-button

get-a11y-guidance

Explain WHY a component is accessible, not just what props it has. Returns the WCAG success criteria the component satisfies on its own, the ARIA pattern it implements, and what the consumer is still responsible for (usually the accessible name). Sourced from @wcag / @aria / @consumer JSDoc tags on the component class. Distinguishes 'undocumented' from 'has no accessibility characteristics' — an empty result means nobody has documented it yet, not that it is fine.

ParameterTypeDescription
tagName *stringThe custom element tag name, e.g. neumo-checkbox

get-usage-example

Get a usage example for a Neumo component. Returns a ready-to-use snippet with realistic values. Choose the framework: web components (`@kofile/gds-wc`, the default) or React (`@kofile/gds-react`).

ParameterTypeDescription
tagName *stringThe custom element tag name, e.g. neumo-button
frameworkstringWhich binding to render: "wc" (web component HTML, default) or "react" (JSX for @kofile/gds-react). If a React example is not authored for the component, the web-component snippet is returned with a n…
variantstringOptional variant name, e.g. "disabled", "dark", "error". Omit for the default example.

search-components

Fuzzy-search Neumo components by any term. Matches against tag name, description, slot names, event names, and attribute names. Returns a ranked list with relevance details.

ParameterTypeDescription
query *stringSearch term, e.g. "label", "change event", "password", "tooltip". Case-insensitive.

get-tokens

Search and filter Neumo design tokens. Returns a flat list of { name, cssVar, value, type, description } objects sourced from Style Dictionary output.

ParameterTypeDescription
categorystringOptional top-level category to filter by, e.g. "color", "spacing", "button", "input". Must match a top-level key in the token files.
querystringOptional fuzzy search string matched against token name, CSS variable, value, and description. E.g. "primary", "danger-600", "1rem".
sourcestringOptional source file to restrict results to: "global" (mode-agnostic primitives), "light", or "dark". Omit to search all sources.

score-alignment

Compute a 0–100 design system alignment score from audit results. Accepts partial input — pass whichever audits you have run. Returns a weighted overall score, per-category breakdown, a plain-English summary, and prioritised recommendations.

ParameterTypeDescription
colorsobjectOutput counts from audit-tokens (color audit).
componentsobjectOutput counts from find-component-replacements.
spacingobjectOutput counts from audit-spacing.
typographyobjectOutput counts from audit-typography.
weightsobjectOverride default category weights (colors 30, spacing 25, typography 25, components 20). Values are relative; they are normalised to the categories present.

remap-variables

Analyse a block of CSS and map every custom property value to the nearest Neumo design token. Returns per-variable mappings (recommendation: direct-map | near-map | no-match) and a ready-to-paste :root migration snippet.

ParameterTypeDescription
css *stringCSS text containing one or more custom property declarations, e.g. the contents of a :root block or a component stylesheet.

check-contrast

Check the WCAG 2.1 contrast ratio between two hex colors. Returns the ratio and pass/fail results at AA and AAA levels for normal and large text.

ParameterTypeDescription
background *stringBackground hex color, e.g. #ffffff or #fff.
foreground *stringForeground (text) hex color, e.g. #1a1a1a or #000.

suggest-token

Find the closest Neumo design token for any hex color value. Returns the nearest match, its RGB delta, and a recommendation to use the existing token or create a new one.

ParameterTypeDescription
hexValue *stringA hex color value to look up, e.g. #6b7280 or #fff.
categorystringOptional token category to restrict the search, e.g. "color". Omit to search all color tokens.
thresholdnumberRGB Euclidean distance threshold for the use-token recommendation. Defaults to 15. Values above this threshold return create-token.

check-token-exists

Answer whether a Neumo design token exists, before you write it into code. Returns exists:true with the token, or exists:false with the closest real names. Use this whenever you are about to reference a token you have not read from get-tokens in this session — a name that sounds right but does not exist is the single most common way design system code goes wrong.

ParameterTypeDescription
name *stringThe token to check. Accepts any spelling it appears in: "color.primary.600", "--color-primary-600", "var(--color-primary-600)", or "{color.primary.600}".
themestringOptional theme to scope the check to. Theme-agnostic (Global) tokens are always in scope. With a theme set, a component token name missing its theme segment is also tried with it spliced in — "badge…

resolve-token

Resolve a Neumo design token to the literal value it ends up as, following every alias hop. Composite tokens (all of Light and Dark, plus component sizing in Global) return one entry per leaf — default, hover, active, focus, fill — because that is how they are authored. Reports unresolvable and circular references rather than echoing the raw text, so a broken token reads as broken.

ParameterTypeDescription
name *stringThe token to resolve. Accepts a dotted name, a CSS custom property, a var() call, or an "{alias}" reference.
themestringOptional theme. The theme is part of the token name in this system rather than a per-file override, so this both scopes the lookup and lets you ask for "button.color.background.primary" and get the li…

get-token-aliases

Show what a Neumo token points at and what points at it. aliasOf is the outgoing references per leaf, each flagged if its target does not exist; aliasedBy is every token referencing this one — the blast radius of renaming or changing it. Use before editing a token value, and to trace a component token back to the primitive it bottoms out at.

ParameterTypeDescription
name *stringThe token to inspect. Accepts a dotted name, a CSS custom property, a var() call, or an alias reference.
themestringOptional theme to scope the lookup to, as with resolve-token.

audit-typography

Audit CSS typography declarations against the Neumo type scale. Covers font-family, font-size, font-weight, line-height, letter-spacing, and the `font` shorthand. Returns per-declaration buckets (on-scale | off-scale-near | off-scale-far | wrong-family) plus aggregate counts that feed score-alignment's `typography` input.

ParameterTypeDescription
css *stringCSS text containing typography declarations to audit, e.g. a component stylesheet or a :root block.

audit-spacing

Audit CSS spacing/sizing declarations against the Neumo spacing scale (and border-radius properties against the radius scale). Covers padding, margin, gap, width, height, inset, border-radius, etc.; splits shorthands; handles rem/em, var() token usage, and skips calc()/percentages/keywords. Returns per-value buckets (on-scale | off-scale-near | off-scale-far | uses-token | ignored) plus aggregate counts that feed score-alignment's `spacing` input.

ParameterTypeDescription
css *stringCSS text containing spacing/sizing declarations to audit, e.g. a component stylesheet.

audit-tokens

Audit CSS color declarations against the Neumo color-token catalog. Scans color, background, border, outline, fill, stroke, box-shadow, etc.; extracts colors from shorthands; understands hex (3/6/8-digit), rgb()/rgba(), hsl()/hsla(), and var() token usage; skips keywords like transparent/currentColor. Each color is matched to its nearest token (same distance metric as suggest-token) and bucketed (direct-match | near-match | no-match | uses-token | ignored). Returns per-value detail plus aggregate counts that feed score-alignment's `colors` input.

ParameterTypeDescription
css *stringCSS text containing color declarations to audit, e.g. a component stylesheet or a :root block.

find-component-replacements

Scan React (JSX/TSX) source for off-system elements that could be replaced with Neumo (@kofile/gds-react) components. AST-parses the source, matches intrinsic HTML elements (and ARIA-role patterns like role="tablist") to their Neumo equivalents, and estimates swap effort (simple | medium | complex). Returns a ranked list (quick wins first) of { file, line, candidate, suggestedComponent, package, effort, rationale } plus counts by effort. Pass `files` (array of { path, code }) for a codebase, or a single `code` string.

ParameterTypeDescription
codestringSingle-file convenience: JSX/TSX source to scan.
filesarraySource files to scan.
pathstringOptional filename for `code` (defaults to input.tsx).

audit-a11y

Scan HTML or JSX markup for WCAG 2.2 violations using axe-core (structural rules) plus static checks for color-contrast (1.4.3, cross-referenced with check-contrast on inline styles) and target-size (2.5.8). Returns violations grouped by Success Criterion with severity, occurrence count, and remediation, plus a summary and the analysis limitations. Static-only: runtime ARIA states and class/stylesheet colors are not evaluated.

ParameterTypeDescription
markup *stringThe HTML or JSX markup to audit (a component snippet or a full document).
jsxbooleanSet true if `markup` is JSX (applies className→class etc. normalization). Defaults to false.

visual-diff

Pixel-diff a component against a supplied baseline image and return a match score + diff image. Two modes: (1) pass `candidate` (a PNG) for a pure diff — no browser needed, ideal in CI; (2) pass `render` (a URL or html+css) to screenshot the candidate with Playwright, then diff. The `baseline` is an INPUT so it can come from anywhere — a live Figma frame (via the Figma MCP) or a bundled golden snapshot. Rendering needs Playwright + a browser; when absent the tool returns `available:false` with guidance rather than failing. Baseline/candidate accept a data: URI, raw base64, or a file path.

ParameterTypeDescription
baseline *stringThe reference PNG to compare against — a data: URI, raw base64, or a file path. From Figma (seat) or a bundled golden (seat-less).
candidatestringThe PNG to compare (same formats). When provided, no browser is used — this is the CI-friendly pure-diff mode.
passThresholdnumberMax fraction of differing pixels that still counts as a pass (0–1). Default 0 (exact).
renderobjectHow to render the candidate when no `candidate` image is given (requires Playwright + a browser).
thresholdnumberPer-pixel color threshold (0–1, lower = stricter). Default 0.1.

eval-component

Evaluate a component's markup + CSS against the Neumo design system in one pass. Composes audit-tokens, audit-spacing, audit-typography, audit-a11y, and find-component-replacements, and folds the measurable token dimensions (colors/spacing/typography) into a weighted 0–100 alignment score via score-alignment. Returns { score, passesA11y, breakdown, failures, suggestedFixes, summary, recommendations, limitations } — a deterministic, loop-friendly report where each failure names the offending value and its fix. Accessibility acts as a pass/fail gate and component-usage is reported, not folde…

ParameterTypeDescription
cssstringComponent CSS. Drives the color, spacing, and typography audits. Optional if you only have markup.
jsxbooleanSet true if `markup` is JSX. Defaults to false.
markupstringComponent markup (HTML, or JSX when `jsx` is true). Drives the accessibility and component-usage checks. Optional if you only have CSS.
pathstringOptional label (e.g. file name) used in component-replacement finding locations.
weightsobjectOverride the score weights (colors 30, spacing 25, typography 25). Values are relative; normalised to the dimensions present.