Accessibility Testing

Automated WCAG testing with axe MCP -- analyze, remediate, fix, and verify

Overview

What It Does

Runs Deque axe analysis via MCP, provides remediation guidance, optionally auto-fixes source code.

1. Analyze

Runs axe analyze on the URL. Produces a violation table with rule IDs, impact levels, affected elements, and WCAG criteria.

2. Remediate

Calls axe remediate for each violation to get Deque’s recommended fix — not a guess, but axe’s own guidance.

3. Fix

With —fix, locates source files (HTL, JS, SCSS) and applies fixes following axe guidance and project accessibility patterns.

4. Verify

Re-runs analysis after fixes and produces a before/after comparison table.

Setup

Prerequisites

Node.js, an API key, a pinned Chromium, and the dx-core plugin.

RequirementWhy
Node.js 22.19.0+axe MCP Server runs on the host via npx -y axe-mcp-server — nothing to start beforehand
Chromium (pinned)The server drives a Playwright Chromium matching its own Playwright version
Axe DevTools API keyRequired by the axe MCP Server for analysis
dx-core pluginThe skill and MCP config live in this plugin

Step-by-Step Setup

1. Install the pinned Chromium (one-time, re-run after axe-mcp-server upgrades)
npx playwright@$(npm view axe-mcp-server dependencies.playwright) install chromium
2. Get an API key
# Axe Account Portal → API Keys → product "Axe MCP Server"
# Copy your API key
3. Export the API key (add to ~/.zshrc or ~/.bashrc)
export AXE_API_KEY=“your-key-here”
4. Reinstall the plugin to pick up MCP config
/plugin install dx-core@dx-aem-flow

Verify Setup

Run any /dx-axe command. If axe MCP tools load successfully, setup is complete. If you see “axe MCP Server setup” instructions, revisit the steps above.

Usage

Running Accessibility Tests

Analyze pages, auto-fix violations, and test against specific WCAG standards.

Command syntax
/dx-axe <URL> [—fix] [—standard wcag2aa|wcag21aa|best-practice]
ArgumentRequiredDefaultDescription
<URL>Yes—Page URL to test
—fixNooffAuto-apply fixes after analysis
—standardNowcag2aaWCAG standard to test against

Examples

Test against WCAG 2.1 AA
/dx-axe https://qa.example.com/en/products.html —standard wcag21aa
Pages

Accessing Different Environments

Local AEM, QA/Stage with basic auth, and public URLs.

Local AEM

Embed admin credentials in the URL. The server runs on your machine, so localhost works as-is.

/dx-axe http://admin:admin@localhost:4502/content/mysite/en/home.html?wcmmode=disabled

QA / Stage

Protected with HTTP Basic Auth. Add the site to the BASIC_AUTH_SITES environment variable (see the basic-auth rule); the browser then logs in automatically.

/dx-axe https://qa.example.com/content/mysite/en/home.html

Public URLs

No special handling needed.

/dx-axe https://www.example.com/products

Published rendering

Add ?wcmmode=disabled to test published rendering instead of the authoring UI.

Fix

Fix Priorities

How the skill chooses what to fix and how.

Fix Strategy

  • Semantic HTML over ARIA workarounds
  • Existing SCSS mixins for focus states
  • Project design tokens for color contrast
  • Third-party/vendor code is flagged, not modified

Output Report

Saves a11y-report.md to the spec directory with:

  • URL tested and date
  • WCAG standard used
  • Full violation table
  • Remediation actions taken (if —fix)
  • Before/after verification results
Config

MCP Server Configuration

The plugin starts the server on demand via npx.

Plugin .mcp.json (auto-configured)
{
"mcpServers": {
  "axe-mcp-server": {
    "type": "stdio",
    "command": "npx",
    "args": ["-y", "axe-mcp-server"]
  }
}
}

How It Works

npx downloads and runs the latest axe-mcp-server when the agent starts. The server inherits your shell environment, so an exported AXE_API_KEY reaches it with no “env” block in .mcp.json. It runs on your machine, so localhost URLs need no rewriting. Optional settings (AXE_SERVER_URL for EU/private instances, AXE_CHROME_PATH, proxy variables) are read from the environment the same way.

Help

Troubleshooting

Common issues and fixes.

"axe MCP Server setup" message

Node.js is older than 22.19.0 or AXE_API_KEY is not exported. Check node -v, then restart the agent from a shell where the key is set.

"Chromium is not installed"

The server needs the Chromium build matching its Playwright version. Run npx playwright@$(npm view axe-mcp-server dependencies.playwright) install chromium. A bare npx playwright install chromium can fetch an unsupported revision.

QA URL returns 401

Environment requires Basic Auth. Add its origin (scheme + host + port) to BASIC_AUTH_SITES.

API key error

Verify: echo $AXE_API_KEY. If empty, re-export and restart your terminal. If expired, get a new key from axe.deque.com/settings.

KAI by Dragan Filipovic