mcp-accessibility-scanner 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +41 -28
- package/build/accessibilityChecker.js +4 -5
- package/build/index.js +8 -3
- package/package.json +1 -1
package/Readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# MCP Accessibility Scanner
|
|
1
|
+
# MCP Accessibility Scanner 🔍
|
|
2
2
|
|
|
3
|
-
A Model Context Protocol (MCP) server
|
|
3
|
+
A Model Context Protocol (MCP) server that provides automated web accessibility scanning using Playwright and Axe-core. This server enables LLMs to perform WCAG compliance checks, capture annotated screenshots, and generate detailed accessibility reports.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -10,30 +10,37 @@ A Model Context Protocol (MCP) server for performing automated accessibility sca
|
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
|
+
You can install the package using any of these methods:
|
|
14
|
+
|
|
15
|
+
Using npm:
|
|
13
16
|
```bash
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
cd mcp-accessibility-scanner
|
|
17
|
+
npm install -g mcp-accessibility-scanner
|
|
18
|
+
```
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
### Installation in VS Code
|
|
21
|
+
|
|
22
|
+
Install the Accessibility Scanner in VS Code using the VS Code CLI:
|
|
23
|
+
|
|
24
|
+
For VS Code:
|
|
25
|
+
```bash
|
|
26
|
+
code --add-mcp '{"name":"accessibility-scanner","command":"npx","args":["mcp-accessibility-scanner"]}'
|
|
27
|
+
```
|
|
20
28
|
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
For VS Code Insiders:
|
|
30
|
+
```bash
|
|
31
|
+
code-insiders --add-mcp '{"name":"accessibility-scanner","command":"npx","args":["mcp-accessibility-scanner"]}'
|
|
23
32
|
```
|
|
24
33
|
|
|
25
|
-
##
|
|
34
|
+
## Configuration
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
Here's the Claude Desktop configuration:
|
|
28
37
|
|
|
29
38
|
```json
|
|
30
39
|
{
|
|
31
40
|
"mcpServers": {
|
|
32
|
-
"accessibility-
|
|
33
|
-
"command": "
|
|
34
|
-
"args": [
|
|
35
|
-
"path/build/server.js"
|
|
36
|
-
]
|
|
41
|
+
"accessibility-scanner": {
|
|
42
|
+
"command": "npx",
|
|
43
|
+
"args": ["-y", "mcp-accessibility-scanner"]
|
|
37
44
|
}
|
|
38
45
|
}
|
|
39
46
|
}
|
|
@@ -44,7 +51,7 @@ Add the following to your Claude Desktop settings to enable the Accessibility Sc
|
|
|
44
51
|
The scanner exposes a single tool `scan_accessibility` that accepts:
|
|
45
52
|
|
|
46
53
|
- `url`: The webpage URL to scan
|
|
47
|
-
- `violationsTag`: Array of accessibility violation tags to check
|
|
54
|
+
- `violationsTag`: Array of accessibility violation tags to check (optional)
|
|
48
55
|
|
|
49
56
|
Example usage in Claude:
|
|
50
57
|
```
|
|
@@ -53,6 +60,13 @@ Could you scan example.com for accessibility issues related to color contrast?
|
|
|
53
60
|
|
|
54
61
|
## Development
|
|
55
62
|
|
|
63
|
+
Clone and set up the project:
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/JustasMonkev/mcp-accessibility-scanner.git
|
|
66
|
+
cd mcp-accessibility-scanner
|
|
67
|
+
npm install
|
|
68
|
+
```
|
|
69
|
+
|
|
56
70
|
Start the TypeScript compiler in watch mode:
|
|
57
71
|
```bash
|
|
58
72
|
npm run watch
|
|
@@ -65,17 +79,16 @@ npm run inspector
|
|
|
65
79
|
|
|
66
80
|
## Project Structure
|
|
67
81
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
```
|
|
83
|
+
├── src/ # Source code
|
|
84
|
+
│ ├── index.ts # MCP server setup and tool definitions
|
|
85
|
+
│ └── scanner.ts # Core scanning functionality
|
|
86
|
+
├── build/ # Compiled JavaScript output
|
|
87
|
+
├── package.json # Project configuration and dependencies
|
|
88
|
+
└── tsconfig.json # TypeScript configuration
|
|
89
|
+
```
|
|
74
90
|
|
|
75
|
-
##
|
|
91
|
+
## License
|
|
76
92
|
|
|
77
|
-
|
|
78
|
-
1. A visual report with numbered violations highlighted on the page
|
|
79
|
-
2. A detailed JSON report of all found violations
|
|
80
|
-
3. A full-page screenshot saved to Downloads
|
|
93
|
+
MIT
|
|
81
94
|
|
|
@@ -50,11 +50,11 @@ const playwright_1 = require("playwright");
|
|
|
50
50
|
const playwright_2 = require("@axe-core/playwright");
|
|
51
51
|
const node_path_1 = __importDefault(require("node:path"));
|
|
52
52
|
const os = __importStar(require("node:os"));
|
|
53
|
-
function scanViolations(
|
|
54
|
-
return __awaiter(this,
|
|
53
|
+
function scanViolations(url_1, violationsTag_1) {
|
|
54
|
+
return __awaiter(this, arguments, void 0, function* (url, violationsTag, viewport = { width: 1920, height: 1080 }, shouldRunInHeadless = true, downloadsDir = node_path_1.default.join(os.homedir(), 'Downloads')) {
|
|
55
55
|
var _a;
|
|
56
56
|
const browser = yield playwright_1.chromium.launch({
|
|
57
|
-
headless:
|
|
57
|
+
headless: shouldRunInHeadless,
|
|
58
58
|
args: [
|
|
59
59
|
'--disable-blink-features=AutomationControlled',
|
|
60
60
|
'--disable-dev-shm-usage',
|
|
@@ -63,7 +63,7 @@ function scanViolations(url, violationsTag) {
|
|
|
63
63
|
]
|
|
64
64
|
});
|
|
65
65
|
const context = yield browser.newContext({
|
|
66
|
-
viewport
|
|
66
|
+
viewport,
|
|
67
67
|
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
|
|
68
68
|
});
|
|
69
69
|
const page = yield context.newPage();
|
|
@@ -170,7 +170,6 @@ function scanViolations(url, violationsTag) {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
const downloadsDir = node_path_1.default.join(os.homedir(), 'Downloads');
|
|
174
173
|
const filePath = node_path_1.default.join(downloadsDir, `a11y-report-${Date.now()}.png`);
|
|
175
174
|
const screenshot = yield page.screenshot({
|
|
176
175
|
path: filePath,
|
package/build/index.js
CHANGED
|
@@ -18,9 +18,14 @@ const server = new mcp_js_1.McpServer({
|
|
|
18
18
|
});
|
|
19
19
|
server.tool("scan_accessibility", {
|
|
20
20
|
url: zod_1.z.string().url(),
|
|
21
|
-
violationsTag: zod_1.z.array(zod_1.z.string())
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
violationsTag: zod_1.z.array(zod_1.z.string()),
|
|
22
|
+
viewport: zod_1.z.object({
|
|
23
|
+
width: zod_1.z.number().default(1920),
|
|
24
|
+
height: zod_1.z.number().default(1080)
|
|
25
|
+
}).optional(),
|
|
26
|
+
shouldRunInHeadless: zod_1.z.boolean().default(true)
|
|
27
|
+
}, (_a) => __awaiter(void 0, [_a], void 0, function* ({ url, violationsTag, viewport, shouldRunInHeadless }) {
|
|
28
|
+
const { report, base64Screenshot } = yield (0, accessibilityChecker_1.scanViolations)(url, violationsTag, viewport, shouldRunInHeadless);
|
|
24
29
|
return {
|
|
25
30
|
content: [
|
|
26
31
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-accessibility-scanner",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A Model Context Protocol (MCP) server for performing automated accessibility scans of web pages using Playwright and Axe-core",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|