Labsco
ronantakizawa logo

Web Accessibility Testing (A11y MCP)

โ˜… 88

from ronantakizawa

Test web pages and HTML for accessibility issues and WCAG compliance using Axe-core and Puppeteer.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

Web Accessibility-Testing MCP Server (A11y MCP)

Web Accessibility Testing MCP - Give LLMs access to web accessibility testing APIs | Product Hunt

MseeP.ai Security Assessment Badge

https://github.com/user-attachments/assets/316c6d44-e677-433e-b4d5-63630b4bab2b

A11y MCP is an MCP (Model Context Protocol) server that gives LLMs access to web accessibility testing APIs.

This server uses the Deque Axe-core API and Puppeteer to allow LLMs to analyze web content for WCAG compliance and identify accessibility issues.

Note: This is not an official MCP server from Deque Labs.

Features

  • Test web pages: Test any public URL for accessibility issues with customizable viewport dimensions
  • Test HTML snippets: Test raw HTML strings for accessibility issues
  • WCAG compliance testing: Check content against various WCAG standards (2.0, 2.1, 2.2)
  • Customizable tests: Specify which accessibility tags/standards to test against
  • Rule exploration: Get information about available accessibility rules
  • Color contrast analysis: Check color combinations for WCAG compliance
  • ARIA validation: Test proper usage of ARIA attributes
  • Orientation lock detection: Identify content that forces specific screen orientations

Available Tools

test_accessibility

Tests a URL for accessibility issues.

Parameters:

ParameterRequiredDescription
urlYesThe URL of the web page to test
tagsNoArray of WCAG tags to test against (e.g., ["wcag2aa"])
widthNoViewport width in pixels (default: 1280)
heightNoViewport height in pixels (default: 800)

Example โ€” desktop viewport (default):

{
  "url": "https://example.com",
  "tags": ["wcag2aa"]
}

Example โ€” mobile viewport (iPhone 12/13):

{
  "url": "https://example.com",
  "tags": ["wcag2aa"],
  "width": 390,
  "height": 844
}

test_html_string

Tests an HTML string for accessibility issues.

Parameters:

ParameterRequiredDescription
htmlYesThe HTML content to test
tagsNoArray of WCAG tags to test against (e.g., ["wcag2aa"])
widthNoViewport width in pixels (default: 1280)
heightNoViewport height in pixels (default: 800)

Example โ€” default viewport:

{
  "html": "<div><img src='image.jpg'></div>",
  "tags": ["wcag2aa"]
}

Example โ€” mobile viewport:

{
  "html": "<div><img src='image.jpg'></div>",
  "tags": ["wcag2aa"],
  "width": 375,
  "height": 812
}

get_rules

Get information about available accessibility rules with optional filtering. Returns an array of rule objects, each containing ruleId, description, help, helpUrl, and tags.

Parameters:

ParameterRequiredDescription
tagsNoFilter rules by tags (e.g., ["wcag2a", "wcag2aa", "best-practice"])

Example โ€” filter rules by WCAG 2.1 AA:

{
  "tags": ["wcag21aa"]
}

Example โ€” get all rules (no filter):

{}

check_color_contrast

Check if a foreground and background color combination meets WCAG contrast requirements.

Parameters:

ParameterRequiredDescription
foregroundYesForeground color (e.g., "#000000", "rgb(0,0,0)")
backgroundYesBackground color (e.g., "#FFFFFF", "rgb(255,255,255)")
fontSizeNoFont size in pixels (default: 16)
isBoldNoWhether the text is bold (default: false)

Example:

{
  "foreground": "#777777",
  "background": "#EEEEEE",
  "fontSize": 16,
  "isBold": false
}

check_aria_attributes

Check if ARIA attributes are used correctly in HTML.

Parameters:

ParameterRequiredDescription
htmlYesHTML content to test for ARIA attribute usage

Example:

{
  "html": "<div role='button' aria-pressed='false'>Click me</div>"
}

check_orientation_lock

Check if content forces a specific orientation.

Parameters:

ParameterRequiredDescription
htmlYesHTML content to test for orientation lock issues

Example:

{
  "html": "<html><head><meta name='viewport' content='width=device-width, orientation=portrait'></head><body>Content</body></html>"
}

Response Format

The server returns accessibility test results in structured JSON:

{
  "violations": [
    {
      "id": "color-contrast",
      "impact": "serious",
      "description": "Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds",
      "help": "Elements must meet minimum color contrast ratio thresholds",
      "helpUrl": "https://dequeuniversity.com/rules/axe/4.10/color-contrast",
      "affectedNodes": [
        {
          "html": "<div style=\"color: #aaa; background-color: #eee;\">Low contrast text</div>",
          "target": ["div"],
          "failureSummary": "Fix any of the following: Element has insufficient color contrast of 1.98 (foreground color: #aaa, background color: #eee, font size: 12.0pt, font weight: normal)"
        }
      ]
    }
  ],
  "passes": 1,
  "incomplete": 0,
  "inapplicable": 2,
  "timestamp": "2025-04-25T16:45:33.655Z",
  "url": "about:blank",
  "testEngine": {
    "name": "axe-core",
    "version": "4.10.3"
  }
}

WCAG Tags Reference

Common tags you can use with the tags parameter:

TagDescription
wcag2aWCAG 2.0 Level A
wcag2aaWCAG 2.0 Level AA
wcag2aaaWCAG 2.0 Level AAA
wcag21aWCAG 2.1 Level A
wcag21aaWCAG 2.1 Level AA
wcag22aaWCAG 2.2 Level AA
best-practiceBest practices (not strictly WCAG)

Dependencies