mcp-accessibility-scanner 1.0.11 → 1.1.1
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/NOTICE.md +21 -0
- package/Readme.md +155 -125
- package/cli.js +18 -0
- package/package.json +42 -13
- package/build/accessibilityChecker.js +0 -379
- package/build/index.js +0 -958
- package/build/server.js +0 -50
package/NOTICE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# NOTICE
|
|
2
|
+
|
|
3
|
+
## mcp-accessibility-scanner
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2024 Justas Monkev
|
|
6
|
+
|
|
7
|
+
This project is licensed under the MIT License.
|
|
8
|
+
|
|
9
|
+
## Third-Party Code Attribution
|
|
10
|
+
|
|
11
|
+
This project includes code adapted from:
|
|
12
|
+
|
|
13
|
+
### Microsoft Playwright MCP
|
|
14
|
+
- Copyright (c) Microsoft Corporation
|
|
15
|
+
- Licensed under the Apache License, Version 2.0
|
|
16
|
+
- Original source: https://github.com/microsoft/playwright-mcp
|
|
17
|
+
|
|
18
|
+
Adapted code has been modified to:
|
|
19
|
+
- Convert from ESM to CommonJS module format
|
|
20
|
+
- Integrate with axe-core accessibility scanning
|
|
21
|
+
- Work with existing Playwright instances rather than spawning new ones
|
package/Readme.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
[](https://mseep.ai/app/justasmonkev-mcp-accessibility-scanner)
|
|
2
1
|
|
|
3
2
|
# MCP Accessibility Scanner 🔍
|
|
4
3
|
|
|
4
|
+
[](https://mseep.ai/app/justasmonkev-mcp-accessibility-scanner)
|
|
5
|
+
|
|
6
|
+
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.
|
|
5
7
|
A powerful Model Context Protocol (MCP) server that provides automated web accessibility scanning and browser automation using Playwright and Axe-core. This server enables LLMs to perform WCAG compliance checks, interact with web pages, manage persistent browser sessions, and generate detailed accessibility reports with visual annotations.
|
|
6
8
|
|
|
7
9
|
## Features
|
|
@@ -13,16 +15,18 @@ A powerful Model Context Protocol (MCP) server that provides automated web acces
|
|
|
13
15
|
🎯 Support for specific violation categories (color contrast, ARIA, forms, keyboard navigation, etc.)
|
|
14
16
|
|
|
15
17
|
### Browser Automation
|
|
16
|
-
🖱️ Click
|
|
17
|
-
⌨️ Type text
|
|
18
|
-
🔍
|
|
19
|
-
📸
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
🌐
|
|
25
|
-
|
|
18
|
+
🖱️ Click, hover, and drag elements using accessibility snapshots
|
|
19
|
+
⌨️ Type text and handle keyboard inputs
|
|
20
|
+
🔍 Capture page snapshots to discover all interactive elements
|
|
21
|
+
📸 Take screenshots and save PDFs
|
|
22
|
+
🎯 Support for both element-based and coordinate-based interactions
|
|
23
|
+
|
|
24
|
+
### Advanced Features
|
|
25
|
+
📑 Tab management for multi-page workflows
|
|
26
|
+
🌐 Monitor console messages and network requests
|
|
27
|
+
⏱️ Wait for dynamic content to load
|
|
28
|
+
📁 Handle file uploads and browser dialogs
|
|
29
|
+
🔄 Navigate through browser history
|
|
26
30
|
|
|
27
31
|
## Installation
|
|
28
32
|
|
|
@@ -33,25 +37,6 @@ Using npm:
|
|
|
33
37
|
npm install -g mcp-accessibility-scanner
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
### Docker Installation
|
|
37
|
-
|
|
38
|
-
The project includes a Dockerfile that sets up all necessary dependencies including Node.js v22 and Python 3.13.
|
|
39
|
-
|
|
40
|
-
1. Build the Docker image:
|
|
41
|
-
```bash
|
|
42
|
-
docker build -t mcp-server .
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
2. Run the container:
|
|
46
|
-
```bash
|
|
47
|
-
docker run -it -e MCP_PROXY_DEBUG=true mcp-server
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
You can also run it in the background:
|
|
51
|
-
```bash
|
|
52
|
-
docker run -d -p 3000:3000 mcp-server
|
|
53
|
-
```
|
|
54
|
-
|
|
55
40
|
### Installation in VS Code
|
|
56
41
|
|
|
57
42
|
Install the Accessibility Scanner in VS Code using the VS Code CLI:
|
|
@@ -83,108 +68,189 @@ Here's the Claude Desktop configuration:
|
|
|
83
68
|
|
|
84
69
|
## Available Tools
|
|
85
70
|
|
|
86
|
-
The MCP server
|
|
71
|
+
The MCP server provides comprehensive browser automation and accessibility scanning tools:
|
|
87
72
|
|
|
88
|
-
### Accessibility
|
|
73
|
+
### Core Accessibility Tool
|
|
89
74
|
|
|
90
|
-
#### `
|
|
91
|
-
Performs a comprehensive accessibility scan on
|
|
75
|
+
#### `scan_page`
|
|
76
|
+
Performs a comprehensive accessibility scan on the current page using Axe-core.
|
|
92
77
|
|
|
93
78
|
**Parameters:**
|
|
94
|
-
- `
|
|
95
|
-
- `violationsTag`: Array of WCAG/violation tags to check (required)
|
|
96
|
-
- `viewport`: Optional viewport size (default: 1920x1080)
|
|
97
|
-
- `shouldRunInHeadless`: Optional headless mode control (default: true)
|
|
79
|
+
- `violationsTag`: Array of WCAG/violation tags to check
|
|
98
80
|
|
|
99
81
|
**Supported Violation Tags:**
|
|
100
|
-
- WCAG
|
|
82
|
+
- WCAG standards: `wcag2a`, `wcag2aa`, `wcag2aaa`, `wcag21a`, `wcag21aa`, `wcag21aaa`, `wcag22a`, `wcag22aa`, `wcag22aaa`
|
|
101
83
|
- Section 508: `section508`
|
|
102
|
-
- Categories: `cat.
|
|
84
|
+
- Categories: `cat.aria`, `cat.color`, `cat.forms`, `cat.keyboard`, `cat.language`, `cat.name-role-value`, `cat.parsing`, `cat.semantics`, `cat.sensory-and-visual-cues`, `cat.structure`, `cat.tables`, `cat.text-alternatives`, `cat.time-and-media`
|
|
103
85
|
|
|
104
|
-
###
|
|
86
|
+
### Navigation Tools
|
|
87
|
+
|
|
88
|
+
#### `browser_navigate`
|
|
89
|
+
Navigate to a URL.
|
|
90
|
+
- Parameters: `url` (string)
|
|
91
|
+
|
|
92
|
+
#### `browser_navigate_back`
|
|
93
|
+
Go back to the previous page.
|
|
94
|
+
|
|
95
|
+
#### `browser_navigate_forward`
|
|
96
|
+
Go forward to the next page.
|
|
97
|
+
|
|
98
|
+
### Page Interaction Tools
|
|
99
|
+
|
|
100
|
+
#### `browser_snapshot`
|
|
101
|
+
Capture accessibility snapshot of the current page (better than screenshot for analysis).
|
|
102
|
+
|
|
103
|
+
#### `browser_click`
|
|
104
|
+
Perform click on a web page element.
|
|
105
|
+
- Parameters: `element` (description), `ref` (element reference), `doubleClick` (optional)
|
|
106
|
+
|
|
107
|
+
#### `browser_type`
|
|
108
|
+
Type text into editable element.
|
|
109
|
+
- Parameters: `element`, `ref`, `text`, `submit` (optional), `slowly` (optional)
|
|
110
|
+
|
|
111
|
+
#### `browser_hover`
|
|
112
|
+
Hover over element on page.
|
|
113
|
+
- Parameters: `element`, `ref`
|
|
114
|
+
|
|
115
|
+
#### `browser_drag`
|
|
116
|
+
Perform drag and drop between two elements.
|
|
117
|
+
- Parameters: `startElement`, `startRef`, `endElement`, `endRef`
|
|
118
|
+
|
|
119
|
+
#### `browser_select_option`
|
|
120
|
+
Select an option in a dropdown.
|
|
121
|
+
- Parameters: `element`, `ref`, `values` (array)
|
|
122
|
+
|
|
123
|
+
#### `browser_press_key`
|
|
124
|
+
Press a key on the keyboard.
|
|
125
|
+
- Parameters: `key` (e.g., 'ArrowLeft' or 'a')
|
|
126
|
+
|
|
127
|
+
### Screenshot & Visual Tools
|
|
128
|
+
|
|
129
|
+
#### `browser_take_screenshot`
|
|
130
|
+
Take a screenshot of the current page.
|
|
131
|
+
- Parameters: `raw` (optional), `filename` (optional), `element` (optional), `ref` (optional)
|
|
105
132
|
|
|
106
|
-
#### `
|
|
107
|
-
|
|
108
|
-
- Parameters: `
|
|
133
|
+
#### `browser_pdf_save`
|
|
134
|
+
Save page as PDF.
|
|
135
|
+
- Parameters: `filename` (optional, defaults to `page-{timestamp}.pdf`)
|
|
109
136
|
|
|
110
|
-
|
|
111
|
-
Clicks elements by their visible text content.
|
|
112
|
-
- Parameters: `url`, `text`, `elementType` (optional), `viewport`, `shouldRunInHeadless`
|
|
137
|
+
### Browser Management
|
|
113
138
|
|
|
114
|
-
#### `
|
|
115
|
-
|
|
116
|
-
- Parameters: `url`, `selector`, `text`, `viewport`, `shouldRunInHeadless`
|
|
139
|
+
#### `browser_close`
|
|
140
|
+
Close the page.
|
|
117
141
|
|
|
118
|
-
#### `
|
|
119
|
-
|
|
120
|
-
- Parameters: `
|
|
142
|
+
#### `browser_resize`
|
|
143
|
+
Resize the browser window.
|
|
144
|
+
- Parameters: `width`, `height`
|
|
121
145
|
|
|
122
|
-
|
|
123
|
-
Analyzes page to identify all interactive elements.
|
|
124
|
-
- Parameters: `url`, `viewport`, `shouldRunInHeadless`
|
|
125
|
-
- Returns: Lists of all buttons, links, and inputs on the page
|
|
146
|
+
### Tab Management
|
|
126
147
|
|
|
127
|
-
|
|
148
|
+
#### `browser_tab_list`
|
|
149
|
+
List all open browser tabs.
|
|
128
150
|
|
|
129
|
-
#### `
|
|
130
|
-
|
|
131
|
-
- Parameters: `
|
|
132
|
-
- Sessions auto-expire after 3 minutes of inactivity
|
|
151
|
+
#### `browser_tab_new`
|
|
152
|
+
Open a new tab.
|
|
153
|
+
- Parameters: `url` (optional)
|
|
133
154
|
|
|
134
|
-
#### `
|
|
135
|
-
|
|
136
|
-
- Parameters: `
|
|
155
|
+
#### `browser_tab_select`
|
|
156
|
+
Select a tab by index.
|
|
157
|
+
- Parameters: `index`
|
|
137
158
|
|
|
138
|
-
#### `
|
|
139
|
-
|
|
159
|
+
#### `browser_tab_close`
|
|
160
|
+
Close a tab.
|
|
161
|
+
- Parameters: `index` (optional, closes current tab if not provided)
|
|
140
162
|
|
|
141
|
-
|
|
142
|
-
Type text within a session.
|
|
163
|
+
### Information & Monitoring Tools
|
|
143
164
|
|
|
144
|
-
#### `
|
|
145
|
-
|
|
165
|
+
#### `browser_console_messages`
|
|
166
|
+
Returns all console messages from the page.
|
|
146
167
|
|
|
147
|
-
#### `
|
|
148
|
-
|
|
168
|
+
#### `browser_network_requests`
|
|
169
|
+
Returns all network requests since loading the page.
|
|
149
170
|
|
|
150
|
-
|
|
151
|
-
Close a browser session.
|
|
171
|
+
### Utility Tools
|
|
152
172
|
|
|
153
|
-
#### `
|
|
154
|
-
|
|
173
|
+
#### `browser_wait_for`
|
|
174
|
+
Wait for text to appear/disappear or time to pass.
|
|
175
|
+
- Parameters: `time` (optional), `text` (optional), `textGone` (optional)
|
|
176
|
+
|
|
177
|
+
#### `browser_handle_dialog`
|
|
178
|
+
Handle browser dialogs (alerts, confirms, prompts).
|
|
179
|
+
- Parameters: `accept` (boolean), `promptText` (optional)
|
|
180
|
+
|
|
181
|
+
#### `browser_file_upload`
|
|
182
|
+
Upload files to the page.
|
|
183
|
+
- Parameters: `paths` (array of absolute file paths)
|
|
184
|
+
|
|
185
|
+
### Vision Mode Tools (Coordinate-based Interaction)
|
|
186
|
+
|
|
187
|
+
#### `browser_screen_capture`
|
|
188
|
+
Take a screenshot for coordinate-based interaction.
|
|
189
|
+
|
|
190
|
+
#### `browser_screen_move_mouse`
|
|
191
|
+
Move mouse to specific coordinates.
|
|
192
|
+
- Parameters: `element`, `x`, `y`
|
|
193
|
+
|
|
194
|
+
#### `browser_screen_click`
|
|
195
|
+
Click at specific coordinates.
|
|
196
|
+
- Parameters: `element`, `x`, `y`
|
|
197
|
+
|
|
198
|
+
#### `browser_screen_drag`
|
|
199
|
+
Drag from one coordinate to another.
|
|
200
|
+
- Parameters: `element`, `startX`, `startY`, `endX`, `endY`
|
|
201
|
+
|
|
202
|
+
#### `browser_screen_type`
|
|
203
|
+
Type text (coordinate-independent).
|
|
204
|
+
- Parameters: `text`, `submit` (optional)
|
|
155
205
|
|
|
156
206
|
## Usage Examples
|
|
157
207
|
|
|
158
208
|
### Basic Accessibility Scan
|
|
159
209
|
```
|
|
160
|
-
|
|
210
|
+
1. Navigate to example.com using browser_navigate
|
|
211
|
+
2. Run scan_page with violationsTag: ["wcag21aa"]
|
|
161
212
|
```
|
|
162
213
|
|
|
163
214
|
### Color Contrast Check
|
|
164
215
|
```
|
|
165
|
-
|
|
216
|
+
1. Use browser_navigate to go to example.com
|
|
217
|
+
2. Run scan_page with violationsTag: ["cat.color"]
|
|
166
218
|
```
|
|
167
219
|
|
|
168
|
-
### Multi-step Workflow
|
|
220
|
+
### Multi-step Workflow
|
|
169
221
|
```
|
|
170
|
-
1.
|
|
171
|
-
2.
|
|
172
|
-
3.
|
|
173
|
-
4.
|
|
174
|
-
5.
|
|
222
|
+
1. Navigate to example.com with browser_navigate
|
|
223
|
+
2. Take a browser_snapshot to see available elements
|
|
224
|
+
3. Click the "Sign In" button using browser_click
|
|
225
|
+
4. Type "user@example.com" using browser_type
|
|
226
|
+
5. Run scan_page on the login page
|
|
227
|
+
6. Take a browser_take_screenshot to capture the final state
|
|
175
228
|
```
|
|
176
229
|
|
|
177
230
|
### Page Analysis
|
|
178
231
|
```
|
|
179
|
-
|
|
232
|
+
1. Navigate to example.com
|
|
233
|
+
2. Use browser_snapshot to capture all interactive elements
|
|
234
|
+
3. Review console messages with browser_console_messages
|
|
235
|
+
4. Check network activity with browser_network_requests
|
|
180
236
|
```
|
|
181
237
|
|
|
182
|
-
###
|
|
238
|
+
### Tab Management
|
|
183
239
|
```
|
|
184
|
-
|
|
240
|
+
1. Open a new tab with browser_tab_new
|
|
241
|
+
2. Navigate to different pages in each tab
|
|
242
|
+
3. Switch between tabs using browser_tab_select
|
|
243
|
+
4. List all tabs with browser_tab_list
|
|
185
244
|
```
|
|
186
245
|
|
|
187
|
-
|
|
246
|
+
### Waiting for Dynamic Content
|
|
247
|
+
```
|
|
248
|
+
1. Navigate to a page
|
|
249
|
+
2. Use browser_wait_for to wait for specific text to appear
|
|
250
|
+
3. Interact with the dynamically loaded content
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Note:** Most interaction tools require element references from browser_snapshot. Always capture a snapshot before attempting to interact with page elements.
|
|
188
254
|
|
|
189
255
|
## Development
|
|
190
256
|
|
|
@@ -195,42 +261,6 @@ cd mcp-accessibility-scanner
|
|
|
195
261
|
npm install
|
|
196
262
|
```
|
|
197
263
|
|
|
198
|
-
Start the TypeScript compiler in watch mode:
|
|
199
|
-
```bash
|
|
200
|
-
npm run watch
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
Test the MCP server locally:
|
|
204
|
-
```bash
|
|
205
|
-
npm run inspector
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### Docker Development
|
|
209
|
-
|
|
210
|
-
For development using Docker:
|
|
211
|
-
|
|
212
|
-
1. Build the development image:
|
|
213
|
-
```bash
|
|
214
|
-
docker build -t mcp-server-dev .
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
2. Run with volume mounting for live code changes:
|
|
218
|
-
```bash
|
|
219
|
-
docker run -it -v $(pwd):/app -p 3000:3000 -e MCP_PROXY_DEBUG=true mcp-server-dev
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
## Project Structure
|
|
223
|
-
|
|
224
|
-
```
|
|
225
|
-
├── src/ # Source code
|
|
226
|
-
│ ├── index.ts # MCP server setup and tool definitions
|
|
227
|
-
│ └── scanner.ts # Core scanning functionality
|
|
228
|
-
├── build/ # Compiled JavaScript output
|
|
229
|
-
├── Dockerfile # Docker configuration for containerized setup
|
|
230
|
-
├── package.json # Project configuration and dependencies
|
|
231
|
-
└── tsconfig.json # TypeScript configuration
|
|
232
|
-
```
|
|
233
|
-
|
|
234
264
|
## License
|
|
235
265
|
|
|
236
266
|
MIT
|
package/cli.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import './lib/program.js';
|
package/package.json
CHANGED
|
@@ -1,31 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-accessibility-scanner",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"mcpName": "io.github.JustasMonkev/mcp-accessibility-scanner",
|
|
4
5
|
"description": "A Model Context Protocol (MCP) server for performing automated accessibility scans of web pages using Playwright and Axe-core",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
"./package.json": "./package.json",
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"default": "./index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
7
14
|
"bin": {
|
|
8
|
-
"mcp-
|
|
15
|
+
"mcp-server-playwright": "cli.js"
|
|
9
16
|
},
|
|
10
17
|
"files": [
|
|
11
|
-
"
|
|
18
|
+
"lib/**/*",
|
|
12
19
|
"README.md",
|
|
13
|
-
"LICENSE"
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"NOTICE.md"
|
|
14
22
|
],
|
|
15
23
|
"scripts": {
|
|
16
|
-
"build": "tsc
|
|
17
|
-
"
|
|
24
|
+
"build": "tsc --project tsconfig.json",
|
|
25
|
+
"lint": "npm run update-readme && eslint . && tsc --noEmit",
|
|
26
|
+
"update-readme": "node utils/update-readme.js",
|
|
18
27
|
"watch": "tsc --watch",
|
|
19
|
-
"
|
|
28
|
+
"run-server": "node lib/browserServer.js",
|
|
29
|
+
"clean": "rm -rf lib",
|
|
30
|
+
"npm-publish": "npm run clean && npm run build && npm publish"
|
|
20
31
|
},
|
|
21
32
|
"dependencies": {
|
|
22
33
|
"@axe-core/playwright": "^4.10.2",
|
|
23
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
24
|
-
"
|
|
34
|
+
"@modelcontextprotocol/sdk": "^1.16.0",
|
|
35
|
+
"commander": "^14.0.0",
|
|
36
|
+
"debug": "^4.4.1",
|
|
37
|
+
"mime": "^4.0.7",
|
|
38
|
+
"playwright": "^1.54.1",
|
|
39
|
+
"playwright-core": "^1.54.1",
|
|
40
|
+
"ws": "^8.18.3",
|
|
41
|
+
"zod-to-json-schema": "^3.24.6"
|
|
25
42
|
},
|
|
26
43
|
"devDependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
44
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
45
|
+
"@eslint/js": "^9.31.0",
|
|
46
|
+
"@playwright/test": "^1.54.1",
|
|
47
|
+
"@stylistic/eslint-plugin": "^5.2.0",
|
|
48
|
+
"@types/chrome": "^0.1.1",
|
|
49
|
+
"@types/debug": "^4.1.12",
|
|
50
|
+
"@types/node": "^24.0.15",
|
|
51
|
+
"@types/ws": "^8.18.1",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^8.37.0",
|
|
53
|
+
"@typescript-eslint/parser": "^8.37.0",
|
|
54
|
+
"@typescript-eslint/utils": "^8.37.0",
|
|
55
|
+
"eslint": "^9.31.0",
|
|
56
|
+
"eslint-plugin-import": "^2.32.0",
|
|
57
|
+
"eslint-plugin-notice": "^1.0.0",
|
|
29
58
|
"ts-node": "^10.9.2",
|
|
30
59
|
"typescript": "^5.8.3"
|
|
31
60
|
},
|