mcp-accessibility-scanner 1.0.1 → 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 +0 -10
- package/build/accessibilityChecker.js +4 -5
- package/build/index.js +8 -3
- package/package.json +1 -1
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:
|
|
@@ -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",
|