Skip to main content
Glama

A11y Feedback MCP

为编码和设计智能体提供真正的可访问性反馈循环,而不是又一条“遵循 WCAG”的提醒。

a11y-feedback-mcp 在 Chromium 中渲染界面,运行 axe-core,并向任何 Model Context Protocol 客户端返回可操作的证据:违反的规则、影响、CSS 选择器、DOM 片段、计算样式、边界框、修复步骤以及满足数学对比度要求的候选值。

它可直接与 Codex 和 Claude Code 配合使用。对于 Claude Design,可靠的流程是将 Claude Code 同时连接到 Claude Design 的 MCP 服务器和本服务器,然后审计生成的 HTML 或实时预览,并通过设计工作流将更正发送回去。

这是一个自动化测试辅助工具,而非 WCAG 认证服务。它有意报告不完整的检查,并要求人工测试键盘、焦点、屏幕阅读器、缩放、动效、认知和内容质量。

“实时反馈”意味着什么

flowchart TD
    A["Agent creates or changes UI"] --> B["Render at target viewport"]
    B --> C["Run axe + contrast analysis"]
    C --> D["Return evidence and correction"]
    D --> E["Agent proposes or applies code fix"]
    E --> F["Re-run same audit"]
    F --> G["Human checks incomplete behavior"]

该服务器是只读的。它绝不会静默修改项目。连接的智能体会利用这些证据进行局部更改,然后重新运行审计以验证更改。

Related MCP server: Accessibility MCP Server

工具

工具

用途

audit_url

审计已渲染的公共或本地开发 URL

audit_html

在托管前审计生成的 HTML

audit_file

审计允许的项目根目录内的本地 .html/.htm 文件

check_contrast

计算颜色对和文本样式的 WCAG 对比度

suggest_contrast_fix

提出最小的黑色/白色定向颜色调整方案,使其通过

explain_issue

将 axe 规则 ID 转化为实现和验证指南

get_wcag_checklist

返回完整的 A/AA/AAA 成功准则集,包含 W3C 链接以及自动化/手动覆盖

所有工具都被标注为只读。服务器还提供一个 accessibility-fix-loop 提示词。

标准级别

审计工具支持 wcag2a、wcag2aa、wcag2aaa、wcag21aa、wcag21aaa、wcag22aa、wcag22aaa 和 best-practice。AA 级别包含所有必需的 A 级和 AA 级成功准则;AAA 级别包含 A、AA 和 AAA 级成功准则。wcag22aa 仍是默认值,因为 W3C 推荐使用最新的 WCAG 版本,并提醒不要将整个站点的 AAA 作为通用政策。将 AAA 作为明确的增强目标,并按成功准则级别报告进度。

axe 映射意味着部分自动化覆盖,绝不意味着完整的成功准则已被测试。get_wcag_checklist 公开了 WCAG 2.2 AA 所需的全部 55 项成功准则,或 WCAG 2.2 AAA 所需的全部 86 项成功准则,包括自动化无法完成的人工工作。

要求

  • Node.js 20 或更高版本

  • 推荐使用 Chrome 或 Edge

  • Windows、macOS 或 Linux

服务器会首先查找已安装的 Chrome/Edge。在受支持的 Linux 环境中,它可以回退到捆绑的 @sparticuz/chromium。您可以将 A11Y_MCP_BROWSER_PATH 设置为明确的浏览器可执行文件。默认情况下,Chromium 沙箱保持启用;仅在受限容器或 Lambda 风格的运行时无法以其他方式启动 Chrome 时,才设置 A11Y_MCP_NO_SANDBOX=true。

在 Windows 上安装

在您存放项目的文件夹中打开 PowerShell:

git clone https://github.com/aditya-ariosity/a11y-feedback-mcp.git
cd a11y-feedback-mcp
npm install
npm run build

如果仓库尚未在 GitHub 上,请先下载或复制此文件夹,然后在其中运行最后三条命令。

连接 Codex

在 PowerShell 中,使用构建后的入口点的绝对路径:

codex mcp add a11y-feedback -- node "C:\full\path\to\a11y-feedback-mcp\dist\index.js"

或者将等效配置添加到 ~/.codex/config.toml:

[mcp_servers.a11y_feedback]
command = "node"
args = ["C:\\full\\path\\to\\a11y-feedback-mcp\\dist\\index.js"]
startup_timeout_sec = 30
tool_timeout_sec = 90

[mcp_servers.a11y_feedback.env]
A11Y_MCP_ALLOWED_ROOT = "C:\\full\\path\\to\\your-projects"

重启 Codex,然后询问:

以 1440×900 和 390×844 审计此页面。修复关键和严重问题,重新运行两次审计,并列出剩余的人工检查。

有关验证和故障排除,请参阅 docs/codex.md。

连接 Claude Code

claude mcp add --scope user a11y-feedback -- node "C:\full\path\to\a11y-feedback-mcp\dist\index.js"

运行 claude mcp list 以确认连接。有关 Claude Design 桥接工作流,请参阅 docs/claude-code-and-design.md。

开发

npm install
npm run check
npm test
npm run test:e2e
npm run build

npm test 涵盖颜色数学、网络保护、修复和 MCP 契约。npm run test:e2e 会启动 Chromium 并审计特意设计为不可访问的测试夹具。

启动本地 stdio 服务器:

npm run dev

启动可选的 Streamable HTTP 传输:

npm run build
npm run start:http

端点为 http://127.0.0.1:3000/mcp;健康检查为 http://127.0.0.1:3000/health。HTTP 默认绑定到 127.0.0.1。

环境变量

变量

默认值

含义

A11Y_MCP_BROWSER_PATH

自动检测

Chrome/Chromium/Edge 可执行文件的绝对路径

A11Y_MCP_ALLOWED_ROOT

服务器工作目录

仅可审计此根目录下的本地 HTML

A11Y_MCP_ALLOW_PRIVATE

stdio 上为 true,HTTP 上为 false

允许 localhost/专用网络 URL 目标

A11Y_MCP_ENABLE_FILE_AUDIT

HTTP 上为 false

在根目录限制后允许通过 HTTP 进行本地文件审计

A11Y_MCP_BROWSER_CONCURRENCY

2

最大并发 Chromium 审计

A11Y_MCP_AUDIT_TIMEOUT_MS

25000

axe 审计阶段的截止时间

A11Y_MCP_NO_SANDBOX

false

仅当运行时需要时才在无沙箱的情况下启动 Chromium

HOST / A11Y_MCP_HOST

127.0.0.1

HTTP 绑定地址

A11Y_MCP_ALLOWED_HOSTS

localhost 名称

HTTP 模式接受的逗号分隔的 Host 头

A11Y_MCP_BODY_LIMIT

4mb

HTTP JSON 请求体限制;必须保持在 audit_html 架构限制以上

PORT

3000

HTTP 传输端口

请勿将参考 HTTP 服务器直接暴露到公共互联网。在其前面设置身份验证、TLS、速率限制、请求大小限制和租户隔离。请阅读 docs/security.md。

当前范围

MVP 涵盖已渲染的 Web UI 和确定性的对比度计算。它尚不检查原生移动应用、PDF、画布、视频字幕或原始 Claude Design 像素。计划中的适配器可以在不更改 MCP 契约的情况下添加框架感知的补丁、截图/OCR 辅助、设计令牌集成、CI 注释和一流的画布连接器。

项目文档

许可证

MIT

Available Tools

7 tools
audit_fileAudit a local HTML fileA
Read-onlyIdempotent

Render a local .html or .htm file beneath the configured allowed root and return accessibility findings and corrections. Read-only.

Inputs: filePath (required), width, height, standard, +2 more.

audit_htmlAudit an HTML documentA
Read-onlyIdempotent

Render supplied HTML in an isolated headless browser and return WCAG findings plus evidence and suggested corrections. Use for generated UI before it is hosted. Read-only.

Inputs: html (required), width, height, baseUrl, +3 more.

audit_urlAudit a rendered URLA
Read-onlyIdempotent

Load a public or local web page in headless Chromium, run axe-core, and return prioritized WCAG findings, DOM evidence, computed styles, and contrast corrections. Read-only.

Inputs: url (required), width, height, standard, +2 more.

check_contrastCheck a color pairA
Read-onlyIdempotent

Calculate the WCAG contrast ratio for foreground and background colors and determine whether the pair passes for the supplied text size and weight.

Inputs: background (required), foreground (required), level, fontSizePx, +1 more.

explain_issueExplain an accessibility ruleA
Read-onlyIdempotent

Return implementation-focused remediation steps and the axe rule reference for a rule ID found in an audit.

Inputs: ruleId (required).

get_wcag_checklistGet the complete WCAG requirement checklistA
Read-onlyIdempotent

Return every success criterion required by a WCAG 2.0, 2.1, or 2.2 A/AA/AAA profile, with W3C references, axe rule mappings, and explicit automated-partial versus manual coverage. Use this to plan the checks that a browser audit cannot complete.

Inputs: standard, principle, evaluation.

suggest_contrast_fixSuggest a passing colorA
Read-onlyIdempotent

Find the nearest black-or-white-directed foreground or background adjustment that reaches the selected WCAG contrast threshold. Returns a mathematical candidate, not an automatic edit.

Inputs: background (required), foreground (required), level, adjust, +2 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool targets a clear and distinct task: three different methods for auditing (by URL, HTML string, or file), a contrast checker, a contrast fix suggester, an issue explainer, and a checklist retriever. There is no overlap or ambiguity among them.

    Naming Consistency4/5

    Tool names mostly follow a verb_noun pattern (audit_url, audit_html, audit_file, check_contrast, explain_issue, get_wcag_checklist). The only minor deviation is 'suggest_contrast_fix', which is a verb_verb_noun but still clear and consistent in style.

    Tool Count5/5

    7 tools is an ideal number for this domain. Each tool covers a necessary function without unnecessary redundancy: three audit entry points, two contrast helpers, one explainer, and one checklist reference. The scope is well-scoped and focused on WCAG accessibility.

    Completeness5/5

    The tool set provides a complete lifecycle for accessibility auditing: multiple ways to ingest content for auditing, contrast analysis and remediation, issue explanation, and a checklist for manual coverage. There are no obvious gaps for the intended use case of assessing and fixing WCAG compliance.

    Maintenance

    ActivityNo data
    ResponsivenessSyncing

    Related MCP Connectors

    Related MCP Servers