playwright-accessibility-mcp-server

playwright-accessibility-mcp-server

Enables accessibility testing using Playwright and Axe, allowing users to scan URLs, HTML content, and batches for violations, and summarize results.

Category
访问服务器

README

Playwright Accessibility MCP Server

Node.js <!-- Updated version --> Playwright <!-- Updated version --> Axe-Core <!-- Updated version --> Zod <!-- Updated version --> License

This project is an implementation of a Model Context Protocol (MCP) server for accessibility testing using Playwright and Axe. It provides tools to scan URLs, raw HTML, and batches of URLs for accessibility violations and summarize the results.

[!TIP] The simplest way to get started is to use the one-line installation: npx playwright-accessibility-mcp-server. This will automatically download and run the latest version without having to manually install the package.

Features

  • scan-url: Scans a single URL for accessibility violations.
  • scan-html: Scans raw HTML content for accessibility violations.
  • scan-batch: Scans multiple URLs for accessibility violations.
  • summarize-violations: Summarizes accessibility violations from Axe results.
  • write-violations-report: Writes accessibility violations report to the output directory.

Requirements

  • Node.js 18 or newer
  • VS Code, Cursor, Windsurf, Claude Desktop or any other MCP client

<!-- // Generate using: node utils/generate-links.js -->

Getting started

First, install the Playwright Accessibility MCP server with your client. A typical configuration looks like this:

{
  "mcpServers": {
    "playwright-accessibility": {
      "command": "npx",
      "args": [
        "playwright-accessibility-mcp-server@latest"
      ]
    }
  }
}

<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code"> <img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">

<details><summary><b>Install in VS Code</b></summary>

You can also install the Playwright Accessibility MCP server using the VS Code CLI:

# For VS Code
code --add-mcp '{"name":"playwright-accessibility","command":"npx","args":["playwright-accessibility-mcp-server@latest"]}'

After installation, the Playwright Accessibility MCP server will be available for use with your GitHub Copilot agent in VS Code.

</details>

<details> <summary><b>Install in Cursor</b></summary>

Go to Cursor Settings -> MCP -> Add new MCP Server. Name to your liking, use command type with the command npx playwright-accessibility-mcp-server. You can also verify config or add command like arguments via clicking Edit.

{
  "mcpServers": {
    "playwright-accessibility": {
      "command": "npx",
      "args": [
        "playwright-accessibility-mcp-server@latest"
      ]
    }
  }
}

</details>

<details> <summary><b>Install in Windsurf</b></summary>

Follow Windsuff MCP documentation. Use following configuration:

{
  "mcpServers": {
    "playwright-accessibility": {
      "command": "npx",
      "args": [
        "playwright-accessibility-mcp-server@latest"
      ]
    }
  }
}

</details>

<details> <summary><b>Install in Claude Desktop</b></summary>

Follow the MCP install guide, use following configuration:

{
  "mcpServers": {
    "playwright-accessibility": {
      "command": "npx",
      "args": [
        "playwright-accessibility-mcp-server@latest"
      ]
    }
  }
}

</details>

𝗪𝗵𝘆 𝗔𝗰𝗰𝗲𝘀𝘀𝗶𝗯𝗶𝗹𝗶𝘁𝘆 𝗧𝗲𝘀𝘁𝗶𝗻𝗴 𝗠𝗮𝘁𝘁𝗲𝗿𝘀:

Accessibility testing ensures that digital content is usable by people with disabilities. It promotes inclusivity and compliance with standards like WCAG. By integrating accessibility testing into your workflow, you can create a better user experience for everyone. 🌍

𝗪𝗵𝘆 𝗣𝗹𝗮𝘆𝘄𝗿𝗶𝗴𝗵𝘁 𝗔𝗰𝗰𝗲𝘀𝘀𝗶𝗯𝗶𝗹𝗶𝘁𝘆 𝗠𝗮𝘁𝘁𝗲𝗿𝘀:

Accessibility testing ensures that digital content is usable by people with disabilities. It promotes inclusivity and compliance with standards like WCAG. By integrating Playwright accessibility testing into your workflow, you can:

  • 📌𝗘𝗻𝗵𝗮𝗻𝗰𝗲 𝗨𝘀𝗲𝗿 𝗘𝘅𝗽𝗲𝗿𝗶𝗲𝗻𝗰𝗲: Make your applications usable for everyone, including people with disabilities.
  • 📌𝗘𝗻𝘀𝘂𝗿𝗲 𝗖𝗼𝗺𝗽𝗹𝗶𝗮𝗻𝗰𝗲: Meet legal and regulatory requirements for accessibility.
  • 📌𝗣𝗿𝗼𝗺𝗼𝘁𝗲 𝗜𝗻𝗰𝗹𝘂𝘀𝗶𝘃𝗶𝘁𝘆: Foster an inclusive digital environment where everyone can access and benefit from your content.

Installation

  1. Clone the repository:

    git clone https://github.com/deepakkamboj/playwright-accessibility-mcp-server.git
    cd playwright-accessibility-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Build the project:

    npm run build
    

🔧 Usage

Starting the Server

  1. Start the server:

    npm start
    
  2. Use the tools via the MCP protocol to perform accessibility testing.

Using as an MCP Server

This project implements the MCP protocol, allowing you to interact with the server using MCP-compatible clients. Below are the steps to use it as an MCP server:

  1. Start the MCP Server: Ensure the server is running by executing:

    npm start
    
  2. Connect to the Server: Use an MCP client to connect to the server. The default server runs on http://localhost:3000.

  3. Send MCP Requests: Use the following tools via MCP requests:

    • scan-url: Analyze a single URL for accessibility violations.
    • scan-html: Analyze raw HTML content for accessibility violations.
    • scan-batch: Analyze multiple URLs for accessibility violations.
    • summarize-violations: Summarize accessibility violations from Axe results.
    • write-violations-report: Write accessibility violations report to the output directory.
  4. Example MCP Request: Below is an example of an MCP request to write a violations report:

    {
      "tool": "write-violations-report",
      "input": {
        "violations": [
          {
            "id": "color-contrast",
            "impact": "serious",
            "description": "Ensures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds.",
            "helpUrl": "https://dequeuniversity.com/rules/axe/4.7/color-contrast",
            "nodes": [
              {
                "target": ["#example"],
                "failureSummary": "Fix this element's color contrast.",
                "html": "<div id='example' style='color: #fff; background-color: #fff;'>Example</div>"
              }
            ]
          }
        ]
      }
    }
    

    Send this request to the server using an MCP client, and the server will write the violations report to the output directory.

MCP (JSON‑RPC) Mode

For AI clients (e.g. Claude Desktop, Cursor, VS Code MCP extension), configure your <client>_config.json:

{
  "mcpServers": {
    "playwright-accessibility-mcp-server": {
      "command": "node",
      "args": ["${AbsolutePath}/build/index.js"]
    }
  }
}

Once the MCP server is running, you can invoke tools like:

  • scan-url (params: { "url": "https://google.com" })
  • scan-html (params: { "html": "<h1>Hello</h1>" })
  • scan-batch (params: { "urls": ["https://a.com","https://b.com"] })
  • summarize-violations (params: { "result": <axe result> })

MCP Local Dev Mode

For local development, configure your <client>_config.json as follows:

{
  "mcpServers": {
    "playwright-accessibility-mcp-server": {
      "command": "node",
      "args": ["${AbsolutePath}/build/index.js"]
    }
  }
}

Development

  • To run the server in development mode:

    npm run dev
    
  • To test the tools, export the server and use the MCP SDK.

🤝 Contributing

  1. Fork the repo.
  2. Create a branch (git checkout -b feature/xyz).
  3. Commit your changes.
  4. Open a Pull Request (PR).

License

This project is licensed under the MIT License.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选