Cursor A11y MCP 是一个模型上下文协议(MCP)服务器,具备辅助功能测试能力。它能够帮助识别网页应用程序中的可访问性问题,借助 axe - core 和 Puppeteer 开展测试工作。
Cursor A11y MCP 可帮助你轻松对网页应用程序进行可访问性测试。以下是启动项目和运行测试的基本步骤:
npm install
接着安装测试站点依赖项:
cd test-site
npm install
cd ..
npm run build
npm start
npm run start:test-site
测试站点将在 http://localhost:5000 可用。
npm install
cd test-site
npm install
cd ..
npm run build
npm start
npm run start:test-site
该工具接受两种输入类型:
http://localhost:5000 的相对路径src/ - MCP 服务器和辅助功能测试工具的源代码。test - site/ - 一个带有故意可访问性问题的 React 应用程序,用于测试。build/ - 源代码的编译版本。@modelcontextprotocol/sdk: ^1.4.1puppeteer: ^24.1.1zod: ^3.24.1react: ^18.2.0react - dom: ^18.2.0react - scripts: 5.0.1src/ 目录进行修改。npm run build 编译更改。npm start 启动服务器。要在 Cursor 的 MCP 服务器设置中添加此可访问性测试工具,可按以下步骤操作:
a11ycommandnode path/to/cursor - a11y - mcp/index/file/in/build/folder(将 path/to/cursor - a11y - mcp/index/file/in/build/folder 替换为构建文件夹中 index.js 文件的绝对路径。)添加在 Cursor 的 Composer 中使用可访问性测试工具,步骤如下:
npm run start:test - site
这将启动测试站点,地址为 http://localhost:5000。
2. 在 Cursor 的 Composer 中输入 use a11y tool。
3. Composer 会提示您运行该工具。
4. 运行工具后,您将在响应中看到可访问性违规,并显示修复违规的代码操作项。
5. Composer 可能会提示您再次运行工具以确认违规已修复。
该项目在 MIT License 下许可 - 有关详细信息,请参阅 LICENSE 文件。
当前版本:2.0.1