Metadata-Version: 2.4
Name: mcp-axe
Version: 0.1.4
Summary: MCP plugin for accessibility testing using Axe-core
Author: Manoj Kumar
Author-email: Manoj Kumar <your-email@example.com>
License: MIT License
        
        Copyright (c) 2025 Manoj Kumar
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.15.2
Requires-Dist: fastapi>=0.115.12
Requires-Dist: uvicorn[standard]>=0.34.2
Requires-Dist: selenium>=4.31.0
Requires-Dist: playwright>=1.51.0
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: toml>=0.10.2
Requires-Dist: requests>=2.32.3
Requires-Dist: mcp>=1.6.0
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest>=8.3.5; extra == "dev"
Requires-Dist: pytest-asyncio>=0.26.0; extra == "dev"
Requires-Dist: pytest-cov>=6.1.1; extra == "dev"
Requires-Dist: pytest-httpx>=0.35.0; extra == "dev"
Requires-Dist: pytest-playwright>=0.7.0; extra == "dev"
Requires-Dist: httpx>=0.28.1; extra == "dev"
Requires-Dist: sseclient-py>=1.8.0; extra == "dev"
Requires-Dist: flake8>=7.2.0; extra == "dev"
Requires-Dist: black>=25.1.0; extra == "dev"
Requires-Dist: isort>=6.0.1; extra == "dev"
Requires-Dist: mypy>=1.15.0; extra == "dev"
Requires-Dist: pre-commit>=4.2.0; extra == "dev"
Dynamic: author
Dynamic: license-file
Dynamic: requires-python

# mcp-axe

[![PyPI version](https://img.shields.io/pypi/v/mcp-axe.svg)](https://pypi.org/project/mcp-axe/)

# 🧪 mcp-axe: Accessibility Testing Plugin using Axe-core

`mcp-axe` is an MCP-compatible plugin for automated accessibility scanning using Deque's [axe-core](https://github.com/dequelabs/axe-core). It supports 
both **Selenium** and **Playwright** engines and provides a CLI and FastAPI interface for scanning URLs, 
raw HTML content, and batches.


## 📦 Installation

### PyPI
You could use mcp-axe from pypi package
`https://pypi.org/project/mcp-axe/`

## CLI Usage

### Scan a URL
```bash
mcp-axe scan-url https://broken-workshop.dequelabs.com --engine selenium --no-headless --save --output-json --output-html
```

### Scan a local HTML file
```bash
mcp-axe scan-html path/to/your/file.html --browser chrome --no-headless --save --output-json --output-html
```

### Batch scan multiple URLs:
```bash
mcp-axe batch-scan "https://broken-workshop.dequelabs.com,https://google.com" --engine selenium --browser chrome --headless --save --output-json
```

### Summarize a saved report:
```bash
mcp-axe summarize report_selenium_chrome.json --output-json --save
```

## API Usage
Clone this repo and install in editable mode:

```bash
#optional
#git clone https://github.com/yourname/mcp-axe.git
#cd mcp-axe

python3 -m venv .venv && source .venv/bin/activate
pip install -e .
```

### Run the FastAPI server For local development:
```bash
make run
#uvicorn mcp_axe.api:app --reload --app-dir src
```

### Available Endpoints:

| Endpoint           | Description             |
|--------------------|--------------------------|
| `POST /scan/url`   | Scan a live URL          |
| `POST /scan/html`  | Scan raw HTML content    |
| `POST /scan/batch` | Scan multiple URLs       |
| `POST /scan/summarise` | Summarize violations |

### Run CLI
```bash
curl -X POST http://localhost:9788/scan/url \
  -H "Content-Type: application/json" \
  -d '{
        "url": "https://broken-workshop.dequelabs.com",
        "engine": "selenium",
        "browser": "chrome",
        "headless": true
      }'
```

```bash
curl -X POST http://localhost:9788/scan/html \
  -H "Content-Type: application/json" \
  -d '{
        "html": "<!DOCTYPE html><html><body><h1>Test</h1><p>Hello World</p></body></html>",
        "browser": "chrome",
        "headless": true
      }'
```


```bash 
curl -X POST http://localhost:9788/scan/batch \
  -H "Content-Type: application/json" \
  -d '{
        "urls": [
          "https://broken-workshop.dequelabs.com",
          "https://google.com"
        ],
        "engine": "selenium",
        "browser": "firefox",
        "headless": true
      }'
```
```bash
Run Test:
make test
```

