mcp-accessibility-scanner 1.0.1 → 1.0.3
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 +11 -12
- package/build/accessibilityChecker.js +4 -5
- package/build/index.js +8 -3
- package/build/server.js +1 -0
- package/package.json +6 -4
package/Readme.md
CHANGED
|
@@ -17,16 +17,6 @@ Using npm:
|
|
|
17
17
|
npm install -g mcp-accessibility-scanner
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Using mcp-get:
|
|
21
|
-
```bash
|
|
22
|
-
npx @michaellatman/mcp-get@latest install mcp-accessibility-scanner
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Using Smithery (for Claude Desktop):
|
|
26
|
-
```bash
|
|
27
|
-
npx -y @smithery/cli install mcp-accessibility-scanner --client claude
|
|
28
|
-
```
|
|
29
|
-
|
|
30
20
|
### Installation in VS Code
|
|
31
21
|
|
|
32
22
|
Install the Accessibility Scanner in VS Code using the VS Code CLI:
|
|
@@ -60,14 +50,23 @@ Here's the Claude Desktop configuration:
|
|
|
60
50
|
|
|
61
51
|
The scanner exposes a single tool `scan_accessibility` that accepts:
|
|
62
52
|
|
|
63
|
-
- `url`: The webpage URL to scan
|
|
64
|
-
- `violationsTag`: Array of accessibility violation tags to check (
|
|
53
|
+
- `url`: The webpage URL to scan (required)
|
|
54
|
+
- `violationsTag`: Array of accessibility violation tags to check (required)
|
|
55
|
+
- `viewport`: Optional object to customize the viewport size
|
|
56
|
+
- `width`: number (default: 1920)
|
|
57
|
+
- `height`: number (default: 1080)
|
|
58
|
+
- `shouldRunInHeadless`: Optional boolean to control headless mode (default: true)
|
|
65
59
|
|
|
66
60
|
Example usage in Claude:
|
|
67
61
|
```
|
|
68
62
|
Could you scan example.com for accessibility issues related to color contrast?
|
|
69
63
|
```
|
|
70
64
|
|
|
65
|
+
Advanced example with custom options:
|
|
66
|
+
```
|
|
67
|
+
Could you scan example.com for accessibility issues with a viewport of 1280x720 and show the browser window?
|
|
68
|
+
```
|
|
69
|
+
|
|
71
70
|
## Development
|
|
72
71
|
|
|
73
72
|
Clone and set up the project:
|
|
@@ -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/build/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-accessibility-scanner",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mcp-accessibility-scanner": "./build/server.js"
|
|
9
|
+
},
|
|
7
10
|
"files": [
|
|
8
11
|
"build/**/*",
|
|
9
12
|
"README.md",
|
|
10
13
|
"LICENSE"
|
|
11
14
|
],
|
|
12
15
|
"scripts": {
|
|
13
|
-
"build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"",
|
|
16
|
+
"build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755') && require('fs').chmodSync('build/server.js', '755')\"",
|
|
14
17
|
"prepare": "npm run build",
|
|
15
18
|
"watch": "tsc --watch",
|
|
16
19
|
"inspector": "npx @modelcontextprotocol/inspector build/index.js"
|
|
17
20
|
},
|
|
18
21
|
"dependencies": {
|
|
19
22
|
"@axe-core/playwright": "^4.10.1",
|
|
20
|
-
"@modelcontextprotocol/sdk": "^1.4.1"
|
|
21
|
-
"mcp-accessibility-scanner": "file:"
|
|
23
|
+
"@modelcontextprotocol/sdk": "^1.4.1"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
24
26
|
"@playwright/test": "^1.49.1",
|