
Unofficial MCP Server for USWDS
io.github.bibekpdlv0.2.0更新於 Oct 9, 2026
Unofficial USWDS MCP: official markup, class-aware validator, and page composer for AI tools.
概覽
為助理提供官方 USWDS 元件標記、可辨識類別的驗證器與頁面產生器,用來打造合規的美國政府網頁。
- 功能
- 提供隨套件附帶的官方美國網頁設計系統(USWDS)標記與指引。工具可回傳元件與範本 HTML、依結構化區塊組裝完整頁面、查詢真實類別與工具類別,並檢索 USWDS 文件與無障礙指引。驗證器會檢查片段或整頁中不存在的 usa- 類別、必要結構、ARIA 連結、表單結構、標題層級與重複 id,並提供修正建議。所有工具皆為唯讀。
- 適用情境
- 當助理撰寫或審查以 USWDS 為基礎的介面,且你希望標記來自官方範本而非模型記憶時使用。適合建置服務頁面、稽核現有 USWDS 標記,以及檢查 CSS 匯入與指令碼等專案整合問題。
- 執行需求
- 透過 stdio 在本機執行,通常以 npx uswds-mcp 啟動,需要 Node.js 與 npm。資料隨套件提供,不需要網路存取、API 金鑰或資料匯入步驟。僅支援桌面版 MCP 用戶端。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Unofficial MCP Server for USWDS,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
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:
What a validator finding looks like
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.
Quick start
Add it to your MCP client:
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
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:
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
See CONTRIBUTING.md and the CHANGELOG.
License
MIT. See NOTICE.md for USWDS attribution and the licensing notes for indexed USWDS material.
來源:README.md,提交 6424844
工具
0版本歷史
1- v0.2.0最新Oct 9, 2026


