Skip to main content
Glama

dslens

An MCP server that audits a React design system for the bugs that make a component library unpredictable to build on: state that silently duplicates a prop, colors and spacing that bypass your design tokens, and the handful of accessibility gaps that are both common and mechanically detectable.

I built this after repeatedly running into the same shape of bug in production analytics and design system work: the same kind of mistake, copying a value into local state, or reaching for a raw hex color instead of a token, shows up over and over across a codebase, in places a human reviewer eventually stops catching. A tool that reads the whole codebase every time doesn't get tired of looking.

It's exposed as an MCP server, so Claude (or any other MCP client) can point it at a repo and ask for a report, rather than you running a CLI and pasting the output back in.

What it catches

Props copied into state. The classic useState(props.value) bug: a component takes a snapshot of a prop on mount, and silently stops reflecting that prop if the parent ever updates it. This is flagged specifically, not every useState call, so it stays useful instead of noisy.

Hardcoded design tokens. A literal hex color or a bare 12px, sitting in an inline style={{...}} object or a styled-components template, where a theme value or a CSS custom property should be. It skips anything that already references ${...} or var(--...).

Accessibility gaps, three specific, mechanically checkable ones: an <img> with no alt, an <input> with no accessible name and nothing for a <label> to target, and a clickable element (a <button>, or anything with an onClick) with no visible text and no aria-label, usually an icon button nobody labeled.

Each of these was chosen because it's a specific, defensible claim, not a vague "this looks off." A static checker that flags everything it's unsure about stops being useful quickly.

Related MCP server: polish

Screenshots of the actual issue

If the project you're auditing has Storybook running, run_full_audit can screenshot each flagged component directly from its story, and for the accessibility checks, draw a highlight around the specific element that's the problem, so the report shows the issue, not just a file and line number.

This needs Storybook actually running (storybookUrl, default http://localhost:6006) and a story whose title ends in the component's name. Without Storybook, run_full_audit still runs every check, it just skips the screenshot step and says so in the result.

Screenshots use Playwright, which needs its browser installed once:

npx playwright install chromium

Installing

npm install
npm run build

Using it as an MCP server

Add it to your MCP client's config (for Claude Desktop, claude_desktop_config.json):

{
  "mcpServers": {
    "dslens": {
      "command": "node",
      "args": ["/absolute/path/to/dslens/dist/index.js"]
    }
  }
}

Tools it exposes

Tool

What it does

scan_components

Lists every .tsx/.jsx file under a directory that dslens will consider

audit_tokens

Just the hardcoded-token check

audit_props_to_state

Just the props-copied-into-state check

audit_accessibility

Just the three accessibility checks

run_full_audit

Everything above, optional screenshots, writes a Markdown report to <rootDir>/audit-report/report.md

Trying it without a real codebase

fixtures/Panel.tsx is a small file with one of every issue dslens catches, used to sanity-check the checks themselves. Point run_full_audit at the fixtures/ folder to see what a report looks like.

Full example with Storybook screenshots

storybook-demo/ is a small standalone React + Storybook project with eight components, one for each check dslens runs (and one clean control with no issues, to confirm it doesn't false-positive). See storybook-demo/README.md for how to run it and get a report with real screenshots of each flagged element.

What this deliberately doesn't do (yet)

  • Vue and Svelte aren't supported. The checks are JSX-specific; a Vue SFC needs a different parser (@vue/compiler-sfc), which is a real project on its own, not a quick addition.

  • The token check is a heuristic over inline styles and styled-components templates, not a full CSS parser. Tailwind arbitrary values (bg-[#fff123]) aren't covered yet.

  • The props-to-state check only catches the direct useState(props.x) / useState(x) shape, not every indirect way a component can end up shadowing a prop.

License

MIT

Available Tools

5 tools
audit_accessibilityAudit accessibility gapsC

Flags with no alt, with no accessible name, and icon-only clickable elements with no accessible name.

Inputs: rootDir (required).

audit_props_to_stateAudit props copied into stateB

Flags useState(props.x) style initializers, the classic bug where a component's local state silently goes stale when its parent's prop changes.

Inputs: rootDir (required).

audit_tokensAudit hardcoded design tokensC

Flags hardcoded colors and raw pixel spacing in inline styles and styled-components templates, instead of design tokens.

Inputs: rootDir (required).

run_full_auditRun the full dslens auditA

Runs every check, optionally screenshots each issue against a running Storybook instance, and writes a Markdown report.

Inputs: rootDir (required), screenshots, storybookUrl.

scan_componentsScan for component filesA

Lists every .tsx/.jsx file dslens will consider a component, under the given directory.

Inputs: rootDir (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool maps to a distinct action+scope: one discovery tool (scan_components), three narrowly-named rule-specific auditors, and one orchestrator. run_full_audit intentionally subsumes the audit_* tools, but its description makes that relationship explicit, so misselection risk is low.

    Naming Consistency4/5

    Names follow a clear verb_noun convention (scan_components, audit_tokens, audit_props_to_state, audit_accessibility) with a consistent audit_ prefix for the check family. run_full_audit deviates slightly with a verb+qualifier+noun shape, but remains readable and predictable.

    Tool Count5/5

    Five tools is well-scoped for a component-auditing server: discovery, three discrete checks, and an aggregate runner. Every tool earns its place with no redundancy or filler.

    Completeness4/5

    The surface covers discovery, individual rule checks, and a report-generating full run, which is a complete workflow for this domain. Minor gaps: no tool to scope an audit to a single file, no machine-readable/JSON output option, and no way to list or configure which rules exist.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Self-hosted design audit MCP server that reviews UI code against Nielsen's heuristics and an accessibility rubric, returning scores and fixable findings. It also enables verifying previously flagged issues against updated code.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables coding agents and CI to verify rendered web UIs against design token usage, layout constraints, and accessibility rules, returning concise pass/fail verdicts with actionable findings.
      12 npm
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables MCP clients to open websites, capture screenshots at multiple breakpoints, and run automated design audits for issues like overflow, small tap targets, low contrast, missing alt text, tiny text, and clipped content.
      9
      1
      MIT