### Build and Run a11y-mcp Server from Source Source: https://context7.com/ronantakizawa/a11ymcp/llms.txt Steps to install dependencies, build the TypeScript code to JavaScript, and start the a11y-mcp server from its source code. ```bash npm install npm run build # compiles TypeScript → dist/ npm start # runs dist/index.js via stdio ``` -------------------------------- ### Test Accessibility with Mobile Viewport Source: https://github.com/ronantakizawa/a11ymcp/blob/main/README.md Use the 'test_accessibility' tool to check a given URL for accessibility issues against WCAG 2.0 AA standards. This example specifies a mobile viewport size, simulating an iPhone 12/13. ```json { "url": "https://example.com", "tags": ["wcag2aa"], "width": 390, "height": 844 } ``` -------------------------------- ### Test Accessibility with Default Viewport Source: https://github.com/ronantakizawa/a11ymcp/blob/main/README.md Use the 'test_accessibility' tool to check a given URL for accessibility issues against WCAG 2.0 AA standards. This example uses the default desktop viewport dimensions. ```json { "url": "https://example.com", "tags": ["wcag2aa"] } ``` -------------------------------- ### Example Accessibility Test Response Source: https://github.com/ronantakizawa/a11ymcp/blob/main/README.md This JSON structure represents the typical response format for accessibility test results, detailing violations, passes, and other metrics. ```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": "
Low contrast text
", "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" } } ``` -------------------------------- ### Get All Available Rules Source: https://github.com/ronantakizawa/a11ymcp/blob/main/README.md Retrieve all available accessibility rules without any filtering. This is useful for understanding the full scope of checks provided by the API. ```json {} ``` -------------------------------- ### Verify Claude Code MCP Server Registration Source: https://github.com/ronantakizawa/a11ymcp/blob/main/README.md List all registered MCP servers in Claude Code to verify that the A11y MCP server has been successfully added. This command helps confirm the installation. ```bash claude mcp list ``` -------------------------------- ### Build and Run a11y-mcp Server with Docker Source: https://context7.com/ronantakizawa/a11ymcp/llms.txt Instructions for building a Docker image for the a11y-mcp server and running it. This is suitable for headless Chrome environments. ```bash docker build -t a11y-mcp . docker run --rm a11y-mcp ``` -------------------------------- ### get_rules Source: https://context7.com/ronantakizawa/a11ymcp/llms.txt Lists available Axe-core accessibility rules, optionally filtered by WCAG tag. Returns metadata for each rule including ID, description, help text, help URL, and tags. ```APIDOC ## Tool: `get_rules` — List available Axe-core accessibility rules Returns metadata for all Axe-core rules, optionally filtered by WCAG tag. Each rule entry includes its ID, description, help text, help URL, and associated tags. Useful for discovering which rules are active for a given compliance level before running a full test. ### Request Example (Get all rules tagged wcag21aa) ```json { "tool": "get_rules", "arguments": { "tags": ["wcag21aa"] } } ``` ### Response Example (Excerpt) ```json { "rules": [ { "ruleId": "color-contrast", "description": "Ensures 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", "tags": ["cat.color", "wcag2aa", "wcag21aa", "wcag143", "TTv5", "TT13.c", "EN-301-549", "ACT"] }, { "ruleId": "label", "description": "Ensures every form element has a label", "help": "Form elements must have labels", "helpUrl": "https://dequeuniversity.com/rules/axe/4.10/label", "tags": ["cat.forms", "wcag2a", "wcag21aa", "wcag412", "section508", "section508.22.n"] } ] } ``` ### Request Example (Get all rules without filtering) ```json { "tool": "get_rules", "arguments": {} } ``` ``` -------------------------------- ### Test a live URL for WCAG violations Source: https://context7.com/ronantakizawa/a11ymcp/llms.txt Use this tool to audit a live website for accessibility issues. It launches a headless browser, navigates to the URL, and runs Axe-core. Configure WCAG tags and viewport dimensions for specific testing scenarios. ```json { "tool": "test_accessibility", "arguments": { "url": "https://example.com", "tags": ["wcag2aa"], "width": 1280, "height": 800 } } ``` ```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": "

Low contrast text

", "target": ["p"], "failureSummary": "Fix any of the following: Element has insufficient color contrast of 1.98" } ] } ], "passes": 38, "incomplete": 2, "inapplicable": 14, "timestamp": "2025-01-15T10:23:45.123Z", "url": "https://example.com", "testEngine": { "name": "axe-core", "version": "4.10.3" } } ``` ```json // Mobile viewport test (iPhone 12/13) { "tool": "test_accessibility", "arguments": { "url": "https://example.com", "tags": ["wcag21aa"], "width": 390, "height": 844 } } ``` -------------------------------- ### Check Color Contrast Source: https://github.com/ronantakizawa/a11ymcp/blob/main/README.md Verify if a foreground and background color combination meets WCAG contrast requirements. Optional parameters include font size and boldness. ```json { "foreground": "#777777", "background": "#EEEEEE", "fontSize": 16, "isBold": false } ``` -------------------------------- ### Test HTML String with Default Viewport Source: https://github.com/ronantakizawa/a11ymcp/blob/main/README.md Use this to test HTML content for accessibility issues within a default 1280x800 viewport. Specify WCAG tags for targeted testing. ```json { "html": "
", "tags": ["wcag2aa"] } ``` -------------------------------- ### check_color_contrast Source: https://github.com/ronantakizawa/a11ymcp/blob/main/README.md Checks if a foreground and background color combination meets WCAG contrast requirements, considering font size and weight. ```APIDOC ## check_color_contrast ### Description Check if a foreground and background color combination meets WCAG contrast requirements. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **foreground** (string) - Required - Foreground color (e.g., `"#000000"`, `"rgb(0,0,0)"`) - **background** (string) - Required - Background color (e.g., `"#FFFFFF"`, `"rgb(255,255,255)"`) - **fontSize** (integer) - Optional - Font size in pixels (default: 16) - **isBold** (boolean) - Optional - Whether the text is bold (default: false) ### Request Example ```json { "foreground": "#777777", "background": "#EEEEEE", "fontSize": 16, "isBold": false } ``` ### Response #### Success Response (200) (See general Response Format below) #### Response Example (See general Response Format below) ``` -------------------------------- ### test_html_string Source: https://context7.com/ronantakizawa/a11ymcp/llms.txt Tests raw HTML markup for accessibility issues by loading the HTML string into a headless browser and running Axe-core against it. Supports WCAG tag filters and viewport customization, making it ideal for testing components or generated markup. ```APIDOC ## Tool: `test_html_string` — Test raw HTML markup for accessibility issues Accepts an HTML string, loads it into a headless browser via `page.setContent()`, and runs Axe-core against it. Ideal for testing components, templates, or generated markup before deployment. Supports the same WCAG tag filters and viewport customization as `test_accessibility`. ### Request Example (Test a form component) ```json { "tool": "test_html_string", "arguments": { "html": "
", "tags": ["wcag2aa"] } } ``` ### Response Example (Label not associated with input) ```json { "violations": [ { "id": "label", "impact": "critical", "description": "Ensures every form element has a label", "help": "Form elements must have labels", "helpUrl": "https://dequeuniversity.com/rules/axe/4.10/label", "affectedNodes": [ { "html": "", "target": ["input"], "failureSummary": "Fix any of the following: Form element does not have an implicit (wrapped)