uswds-mcp
Integrates with VS Code via GitHub Copilot MCP support to provide USWDS guidance, component retrieval, and validation within the editor.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@uswds-mcp generate a USWDS service page for a permit application"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
uswds-mcp
Make AI-generated government UI actually USWDS-compliant.
An MCP server that gives Claude, Cursor, Copilot, Windsurf and any other MCP client the official U.S. Web Design System markup, a validator that knows every real USWDS class, and a page composer that outputs accessible, validated pages.
Unofficial and independent. Not affiliated with, endorsed by, or maintained by GSA, TTS, or the official USWDS team. See NOTICE.md.
The problem
LLMs write USWDS from memory. They invent usa-btn, forget the usa-overlay that makes the mobile menu work, put usa-card markup without its container, and wire up accordions to nothing. The result looks plausible and is subtly broken.
uswds-mcp closes that loop:
recommend_uswds_structure → get_component_markup → compose_uswds_page → validate_uswds_markup
(what to use) (official HTML) (accessible page) (fix until 0 errors)Without | With uswds-mcp |
Class names recalled from memory | Official HTML rendered from the |
"Looks right" | Validator rejects any |
Missing structure goes unnoticed | BEM, required children, ARIA wiring, form control structure, header overlay, scripts, heading order, duplicate ids, link/image/button names |
Stock template output |
|
What a validator finding looks like
{
"severity": "error",
"rule": "unknown-class",
"message": "\"usa-alrt\" is not a class defined by USWDS.",
"selector": "div.usa-alrt",
"snippet": "<div class=\"usa-alrt usa-alert--eror\">",
"suggestion": "Did you mean \"usa-alert\"?"
}Findings carry the offending element, a fix suggestion, the component to look up, and a docs link, so the model can repair its own output.
Related MCP server: Basecoat UI MCP
Quick start
npx -y uswds-mcpAdd it to your MCP client:
{
"mcpServers": {
"uswds": { "command": "npx", "args": ["-y", "uswds-mcp"] }
}
}Claude Code: claude mcp add uswds -- npx -y uswds-mcp
Setup for Claude Desktop, Cursor, VS Code, Windsurf and others: docs/CLIENTS.md. Ready-made configs are in examples/.
No network, API key, or ingest step needed: the data ships in the package.
Tools
Tool | Use |
| Official HTML for a component/page template and its variants ( |
| Build a full page from structured sections: hero, content, alert, summary box, cards, process list, step indicator, accordion, table, form, contact. |
| Validate fragments or full pages: real class names, component structure, forms, ARIA, accessibility basics. |
| Look up real classes, including utilities and responsive variants ( |
| Quick start from free-text requirements; returns an editable section spec, bracketed placeholders, and its own validation. |
| USWDS-first structure for a service or page. |
| Search docs, accessibility and usage guidance (with synonym expansion). |
| Structured guidance, plus the canonical markup for components. |
| Framework setup for Next.js, Vite/React, static HTML, Rails, Drupal. |
| Catch wrong CSS import paths, missing scripts, CDN use, copied |
All tools are read-only. See docs/TOOLS.md for arguments and recommended sequences.
Resources: uswds://component/{slug}, uswds://pattern/{slug}, uswds://template/{slug}, uswds://token/{category}, uswds://package/{name}
Prompts: build_agency_website, build_service_page, audit_uswds_page, convert_page_to_uswds, integrate_uswds_in_project
Example
"Build a page where residents renew a fishing permit: eligibility, fees table, steps, FAQ, contact."
The model calls compose_uswds_page and gets back a complete page with banner, skipnav, header (with usa-overlay), breadcrumbs, summary box, striped table with caption and scoped headers, process list, accordion, contact details, slim footer and identifier, plus a list of the placeholders that still need real content, and a validation result.
Prefer to see it first? Run the scorecard:
npm run evalscenario unknown classes errors warnings axe violations
'Apply for housing assistance' 0 0 0 0
'Renew a fishing permit' 0 0 0 0
...Does it help?
In a small test (5 tasks, same model, with and without the server) pages built with uswds-mcp had 0 validator errors on 5 of 5 pages, versus 1 of 5 without it. The model did not invent class names in either case; what it missed without the tools was structure, such as the header overlay that makes the mobile menu work, banner internals, and accordion button types. It is a small, single-run sample, so see the caveats and method in docs/COMPARISON.md.
How it works
Ingest (
npm run ingest): renders every official@uswds/uswdstwig template with its JSON fixtures into canonical HTML, extracts all class names from the official stylesheet, and indexes the official docs (uswds-site).Validate against ground truth: the validator is tested against every official snippet (they must pass) and against a corpus of 30 typical LLM mistakes (they must be caught).
Stay current: docs and markup come from the same USWDS version (enforced by a test), and a monthly workflow re-ingests and opens a PR.
Current data: USWDS 3.14.0.
Limits
Static analysis. It cannot judge color contrast, reading order on rendered pages, or real screen-reader behavior. USWDS components do not by themselves make a site Section 508 compliant; keep testing with axe, keyboard and screen readers.
Custom (non-
usa-) classes are allowed and not validated.Upstream fixture text in angle brackets (e.g.
<Project title>) is placeholder content.
Develop
npm install
npm test # unit, self-consistency over official markup, MCP end-to-end, axe-core
npm run eval
npm run ingest # refresh from upstreamSee CONTRIBUTING.md and the CHANGELOG.
License
MIT. See NOTICE.md for USWDS attribution and the licensing notes for indexed USWDS material.
Available Tools
9 toolsgenerate_uswds_pageGenerate USWDS PageC
Generate framework-neutral USWDS HTML and framework adaptation notes.
Inputs: page_type (required), agency_context (required), content_requirements (required), framework.
get_componentGet USWDS ComponentC
Return structured component guidance, package metadata, accessibility guidance, examples, and source links.
Inputs: slug_or_name (required).
get_patternGet USWDS PatternC
Return structured pattern guidance and related implementation notes.
Inputs: slug_or_name (required).
get_templateGet USWDS TemplateC
Return structured template guidance and markup references.
Inputs: slug_or_name (required).
get_uswds_integration_recipeGet USWDS Integration RecipeC
Return framework-specific USWDS setup guidance for npm, assets, JavaScript, CSS, and migration.
Inputs: framework (required), no_cdn, migration_scope.
recommend_uswds_structureRecommend USWDS StructureC
Recommend a USWDS-first page or site structure for an agency service.
Inputs: audience (required), agency_type (required), service_goal (required), framework, +1 more.
search_uswdsSearch USWDSC
Search structured USWDS docs and implementation records.
Inputs: query (required), limit, types.
validate_uswds_markupValidate USWDS MarkupC
Static validation for common USWDS markup, accessibility, and token-usage issues.
Inputs: html (required), page_context.
validate_uswds_project_setupValidate USWDS Project SetupC
Check provided project files for common USWDS framework integration issues such as import paths, assets, scripts, CDN usage, and global CSS risk.
Inputs: files, no_cdn, framework, file_paths, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a clearly distinct purpose: validation of project setup vs markup, search, retrieval of component/pattern/template details, recommendation, page generation, and integration recipes. No overlap in intent.
All tools follow a consistent verb_noun pattern in snake_case (e.g., validate_uswds_project_setup, get_component). Naming is predictable and uniform.
9 tools is well-scoped for the USWDS domain, covering validation, search, component/pattern/template guidance, structure recommendation, page generation, and integration without being excessive.
The tool surface covers core USWDS tasks: setup validation, markup validation, search, component guidance, page generation, and integration recipes. Minor gap: no tool for listing all components or managing versions.
Maintenance
Related MCP Connectors
Serves your design system and coding standards to coding agents, so they stop guessing.
Design systems your AI agent builds with and you reshape, plus standalone React components.
Live React design-system APIs, patterns, and code validation so AI agents build real UI, not slop.
Run accessibility, contrast, and design token audits and file QA issues from your AI coding tool.
Related MCP Servers
- AlicenseBqualityDmaintenanceIntegrates Korea's government digital design system (KRDS) with AI assistants, enabling users to search components, validate code compliance, and access design tokens for Korean government digital services.91ISC
- AlicenseAqualityDmaintenanceProvides access to 77 pre-built, accessible Basecoat CSS UI components across forms, navigation, feedback, interactive, and layout categories, enabling AI assistants to retrieve HTML components and usage documentation for building user interfaces.74MIT
- AlicenseAqualityDmaintenanceProvides AI coding assistants with on-demand access to component specs, test scenarios, accessibility requirements, and build guides from the Web UI Component Specification.10MIT
- AlicenseNot gradedqualityCmaintenanceProvides design systems, UI prompts, and layout variation guidance to AI coding tools for generating better user interfaces.373 npm2,273MIT