这是一个使用 axe-core 和 Puppeteer 提供网页可访问性分析能力的 MCP(模型上下文协议)服务器。
<a href="https://glama.ai/mcp/servers/mya2mkxy9a"><img width="380" height="200" src="https://gips0.baidu.com/it/u=901959025,2225219083&fm=3081&app=3081&f=PNG?w=760&h=400" alt="Web 可访问性服务器 MCP 服务器" /></a>
要通过 Smithery 自动安装 Web 可访问性 MCP 服务器到 Claude Desktop:
npx -y @smithery/cli install @bilhasry-deriv/mcp-web-a11y --client claude
git clone [repository-url]
cd mcp-web-a11y
npm install
npm run build
将服务器添加到您的 MCP 设置文件中(通常位于 ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json):
{
"mcpServers": {
"web-a11y": {
"command": "node",
"args": ["/path/to/mcp-web-a11y/build/index.js"],
"disabled": false,
"autoApprove": [],
"env": {
"MCP_OUTPUT_DIR": "/path/to/output/directory"
}
}
}
}
MCP_OUTPUT_DIR:截图输出保存的目录
simulate_colorblind 工具是必需的./output该服务器提供了两个工具:check_accessibility 用于分析网页可访问性,simulate_colorblind 用于模拟色盲。
使用 axe-core 检查给定 URL 的可访问性。
url(必需):要分析的 URLwaitForSelector(可选):在分析之前等待的 CSS 选择器userAgent(可选):请求的自定义用户代理字符串<use_mcp_tool>
<server_name>mcp-web-a11y</server_name>
<tool_name>check_accessibility</tool_name>
<arguments>
{
"url": "https://example.com",
"waitForSelector": ".main-content",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
}
</arguments>
</use_mcp_tool>
使用颜色矩阵变换模拟网页对不同类型的色盲用户的显示效果。
该工具支持三种类型的色盲模拟:
红绿色盲(红盲) - 使用矩阵:
0.567, 0.433, 0
0.558, 0.442, 0
0, 0.242, 0.758
绿黄色盲(绿盲) - 使用矩阵:
0.625, 0.375, 0
0.7, 0.3, 0
0, 0.3, 0.7
蓝黄色盲(蓝盲) - 使用矩阵:
0.95, 0.05, 0
0, 0.433, 0.567
0, 0.475, 0.525
url(必需):要捕获的 URLtype(必需):要模拟的色盲类型('protanopia'、'deuteranopia' 或 'tritanopia')outputPath(可选):截图输出的自定义路径userAgent(可选):请求的自定义用户代理字符串<use_mcp_tool>
<server_name>mcp-web-a11y</server_name>
<tool_name>simulate_colorblind</tool_name>
<arguments>
{
"url": "https://example.com",
"type": "deuteranopia",
"outputPath": "colorblind_simulation.png"
}
</arguments>
</use_mcp_tool>
{
"url": "analyzed-url",
"timestamp": "ISO-timestamp",
"violations": [
{
"impact": "serious|critical|moderate|minor",
"description": "违规描述",
"help": "解释问题的帮助文本",
"helpUrl": "详细文档的 URL",
"nodes": [
{
"html": "受影响元素的 HTML",
"failureSummary": "需要修复的总结"
}
]
}
],
"passes": 42,
"inapplicable": 45,
"incomplete": 3
}
{
"url": "analyzed-url",
"type": "colorblind-type",
"outputPath": "path/to/screenshot.png",
"timestamp": "ISO-timestamp",
"message": "[type] 模拟的截图已保存"
}
该服务器包括针对常见情况的全面错误处理:
错误响应将包含详细的诊断信息。
mcp-web-a11y/
├── src/
│ └── index.ts # 主服务器实现
├── build/ # 编译后的 JavaScript
├── output/ # 生成的截图
├── package.json # 项目依赖项和脚本
└── tsconfig.json # TypeScript 配置
npm run build
这将:
build 目录中该服务器包括可以在控制台输出中观察到的详细调试日志。这包括:
超时错误
DNS 解析错误
选择器未找到
颜色模拟问题
此项目根据 MIT 许可证发布 - 查看 LICENSE 文件以获取详细信息。