accessibility-server-mcp 1.0.0
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/LICENSE +21 -0
- package/README.md +762 -0
- package/config/wcag-rules.json +252 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +437 -0
- package/dist/index.js.map +1 -0
- package/dist/test-manual.d.ts +6 -0
- package/dist/test-manual.d.ts.map +1 -0
- package/dist/test-manual.js +66 -0
- package/dist/test-manual.js.map +1 -0
- package/dist/tools/accessibility-tester.d.ts +56 -0
- package/dist/tools/accessibility-tester.d.ts.map +1 -0
- package/dist/tools/accessibility-tester.js +317 -0
- package/dist/tools/accessibility-tester.js.map +1 -0
- package/dist/tools/color-contrast.d.ts +49 -0
- package/dist/tools/color-contrast.d.ts.map +1 -0
- package/dist/tools/color-contrast.js +237 -0
- package/dist/tools/color-contrast.js.map +1 -0
- package/dist/tools/wcag-validator.d.ts +43 -0
- package/dist/tools/wcag-validator.d.ts.map +1 -0
- package/dist/tools/wcag-validator.js +249 -0
- package/dist/tools/wcag-validator.js.map +1 -0
- package/dist/tools/website-accessibility-tester.d.ts +103 -0
- package/dist/tools/website-accessibility-tester.d.ts.map +1 -0
- package/dist/tools/website-accessibility-tester.js +228 -0
- package/dist/tools/website-accessibility-tester.js.map +1 -0
- package/dist/types/accessibility.d.ts +172 -0
- package/dist/types/accessibility.d.ts.map +1 -0
- package/dist/types/accessibility.js +5 -0
- package/dist/types/accessibility.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/mcp.d.ts +70 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +5 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/utils/browser-manager.d.ts +83 -0
- package/dist/utils/browser-manager.d.ts.map +1 -0
- package/dist/utils/browser-manager.js +292 -0
- package/dist/utils/browser-manager.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +36 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +107 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/report-generator.d.ts +31 -0
- package/dist/utils/report-generator.d.ts.map +1 -0
- package/dist/utils/report-generator.js +252 -0
- package/dist/utils/report-generator.js.map +1 -0
- package/dist/utils/website-crawler.d.ts +66 -0
- package/dist/utils/website-crawler.d.ts.map +1 -0
- package/dist/utils/website-crawler.js +306 -0
- package/dist/utils/website-crawler.js.map +1 -0
- package/package.json +80 -0
package/README.md
ADDED
|
@@ -0,0 +1,762 @@
|
|
|
1
|
+
# Accessibility MCP Server
|
|
2
|
+
|
|
3
|
+
A comprehensive Model Context Protocol (MCP) server for web accessibility testing and WCAG compliance analysis. This server provides automated accessibility testing capabilities for web pages, HTML snippets, and specific accessibility checks, designed to integrate seamlessly with MCP-compatible host applications.
|
|
4
|
+
|
|
5
|
+
## ๐ Key Features
|
|
6
|
+
|
|
7
|
+
- **๐ URL Testing**: Test any public URL for accessibility issues using Puppeteer and axe-core
|
|
8
|
+
- **๐ท๏ธ Website-Wide Testing**: Crawl and test entire websites for comprehensive accessibility audits
|
|
9
|
+
- **๐ HTML Snippet Testing**: Analyze raw HTML strings for accessibility compliance
|
|
10
|
+
- **๐ WCAG Compliance**: Support for WCAG 2.0, 2.1, and 2.2 standards (A, AA, AAA levels)
|
|
11
|
+
- **๐จ Color Contrast Analysis**: Check color combinations for WCAG contrast requirements
|
|
12
|
+
- **โฟ ARIA Validation**: Validate proper usage of ARIA attributes and roles
|
|
13
|
+
- **๐ฑ Mobile Testing**: Orientation lock detection and mobile accessibility issues
|
|
14
|
+
- **๐ Comprehensive Reports**: Detailed accessibility reports with actionable recommendations
|
|
15
|
+
- **๐ Local Execution**: All testing happens locally - no external API calls or data transmission
|
|
16
|
+
- **๐๏ธ Enterprise Ready**: Built for CI/CD integration and production environments
|
|
17
|
+
|
|
18
|
+
## ๐ Integration with Host Applications
|
|
19
|
+
|
|
20
|
+
### Supported MCP Host Applications
|
|
21
|
+
|
|
22
|
+
This server is compatible with any application that supports the Model Context Protocol (MCP), including:
|
|
23
|
+
|
|
24
|
+
- **Claude Desktop** - Anthropic's desktop application
|
|
25
|
+
- **Cline VS Code Extension** - Development environment integration
|
|
26
|
+
- **Custom MCP Clients** - Any application using the `@modelcontextprotocol/sdk`
|
|
27
|
+
|
|
28
|
+
### Quick Integration Setup
|
|
29
|
+
|
|
30
|
+
#### For MCP Clients (like Claude Desktop, VS Code Extensions)
|
|
31
|
+
|
|
32
|
+
Add this configuration to your MCP client:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"command": "npx",
|
|
37
|
+
"args": ["-y", "accessibility-mcp-server"],
|
|
38
|
+
"env": {
|
|
39
|
+
"MCP_MODE": "true"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### For Local Development/Testing
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"command": "node",
|
|
49
|
+
"args": ["path/to/accessibility-mcp/dist/index.js"],
|
|
50
|
+
"env": {
|
|
51
|
+
"MCP_MODE": "true"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Simple Mode (faster startup, core features only)
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"command": "npx",
|
|
61
|
+
"args": ["-y", "accessibility-mcp-server", "--simple"],
|
|
62
|
+
"env": {
|
|
63
|
+
"MCP_MODE": "true"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
> **Note**: The server will be published to NPM as `accessibility-mcp-server` for easy npx usage.
|
|
69
|
+
|
|
70
|
+
#### For Claude Desktop
|
|
71
|
+
|
|
72
|
+
1. **Install the server:**
|
|
73
|
+
```bash
|
|
74
|
+
npm install -g accessibility-mcp-server
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
2. **Configure Claude Desktop** by adding to your `claude_desktop_config.json`:
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"mcpServers": {
|
|
81
|
+
"accessibility": {
|
|
82
|
+
"command": "accessibility-mcp",
|
|
83
|
+
"args": []
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
3. **Restart Claude Desktop** and the accessibility tools will be available.
|
|
90
|
+
|
|
91
|
+
#### For Cline VS Code Extension
|
|
92
|
+
|
|
93
|
+
1. **Install the server globally:**
|
|
94
|
+
```bash
|
|
95
|
+
npm install -g accessibility-mcp-server
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
2. **Configure in VS Code settings** or Cline configuration:
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"accessibility": {
|
|
103
|
+
"command": "accessibility-mcp",
|
|
104
|
+
"args": []
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### For Custom Applications
|
|
111
|
+
|
|
112
|
+
Install the package as a dependency:
|
|
113
|
+
```bash
|
|
114
|
+
npm install accessibility-mcp-server
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Then integrate programmatically:
|
|
118
|
+
```javascript
|
|
119
|
+
import { AccessibilityMCPServer } from 'accessibility-mcp-server';
|
|
120
|
+
|
|
121
|
+
// Create and start the server
|
|
122
|
+
const server = new AccessibilityMCPServer({
|
|
123
|
+
mode: 'full', // or 'simple' for basic features only
|
|
124
|
+
enableLogging: true
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
await server.run();
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## ๐ฆ Installation Options
|
|
131
|
+
|
|
132
|
+
### 1. NPM Package (Recommended for Host Integration)
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# For global command-line usage
|
|
136
|
+
npm install -g accessibility-mcp-server
|
|
137
|
+
|
|
138
|
+
# For local project integration
|
|
139
|
+
npm install accessibility-mcp-server
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 2. From Source (Development)
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Clone the repository
|
|
146
|
+
git clone https://github.com/nigamutkarsh/accessibility-mcp-server.git
|
|
147
|
+
cd AccessibilityMCP
|
|
148
|
+
|
|
149
|
+
# Install dependencies
|
|
150
|
+
npm install
|
|
151
|
+
|
|
152
|
+
# Build the project
|
|
153
|
+
npm run build
|
|
154
|
+
|
|
155
|
+
# Install globally
|
|
156
|
+
npm install -g .
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 3. Docker Deployment
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Build Docker image
|
|
163
|
+
docker build -t accessibility-mcp .
|
|
164
|
+
|
|
165
|
+
# Run container
|
|
166
|
+
docker run -d --name accessibility-mcp \
|
|
167
|
+
-p 3000:3000 \
|
|
168
|
+
accessibility-mcp
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## ๐ ๏ธ Available MCP Tools
|
|
172
|
+
|
|
173
|
+
The server provides four main tools for accessibility testing, with two operational modes:
|
|
174
|
+
|
|
175
|
+
### Simple Mode Tools (Basic Features)
|
|
176
|
+
- `test_accessibility` - Test URLs or HTML content
|
|
177
|
+
- `test_website_accessibility` - Test entire websites (crawl multiple pages)
|
|
178
|
+
- `check_color_contrast` - Validate color combinations
|
|
179
|
+
|
|
180
|
+
### Full Mode Tools (All Features)
|
|
181
|
+
- `test_accessibility` - Test URLs or HTML content
|
|
182
|
+
- `test_website_accessibility` - Test entire websites (crawl multiple pages)
|
|
183
|
+
- `check_color_contrast` - Validate color combinations
|
|
184
|
+
- `get_wcag_rules` - Retrieve WCAG rule information
|
|
185
|
+
|
|
186
|
+
### Tool Usage Examples
|
|
187
|
+
|
|
188
|
+
#### 1. Test Accessibility
|
|
189
|
+
|
|
190
|
+
Test a website or HTML content for accessibility issues:
|
|
191
|
+
|
|
192
|
+
**For URLs:**
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"name": "test_accessibility",
|
|
196
|
+
"arguments": {
|
|
197
|
+
"target": "https://example.com",
|
|
198
|
+
"type": "url",
|
|
199
|
+
"level": "basic",
|
|
200
|
+
"wcagLevel": "AA"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**For HTML snippets:**
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"name": "test_accessibility",
|
|
209
|
+
"arguments": {
|
|
210
|
+
"target": "<button>Click me</button><div>Content without proper contrast</div>",
|
|
211
|
+
"type": "html",
|
|
212
|
+
"level": "full",
|
|
213
|
+
"wcagLevel": "AAA"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### 2. Test Website Accessibility
|
|
219
|
+
|
|
220
|
+
Test entire websites by crawling multiple pages:
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"name": "test_website_accessibility",
|
|
225
|
+
"arguments": {
|
|
226
|
+
"baseUrl": "https://example.com",
|
|
227
|
+
"wcagLevel": "AA",
|
|
228
|
+
"maxPages": 20,
|
|
229
|
+
"maxDepth": 3,
|
|
230
|
+
"concurrency": 3,
|
|
231
|
+
"excludePatterns": ["/admin/", "/api/", ".pdf"],
|
|
232
|
+
"continueOnError": true,
|
|
233
|
+
"delay": 1000
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Key Features of Website Testing:**
|
|
239
|
+
- ๐ท๏ธ **Automatic Crawling**: Discovers pages by following links
|
|
240
|
+
- ๐ **Site-wide Reports**: Aggregated accessibility metrics across all pages
|
|
241
|
+
- ๐ฏ **Configurable Scope**: Control depth, page limits, and URL patterns
|
|
242
|
+
- โก **Parallel Testing**: Test multiple pages simultaneously
|
|
243
|
+
- ๐ **Common Issues**: Identifies violations that appear across multiple pages
|
|
244
|
+
|
|
245
|
+
> ๐ **For detailed website testing documentation, see [WEBSITE_TESTING.md](./WEBSITE_TESTING.md)**
|
|
246
|
+
|
|
247
|
+
#### 3. Check Color Contrast
|
|
248
|
+
|
|
249
|
+
Validate color combinations for WCAG compliance:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"name": "check_color_contrast",
|
|
254
|
+
"arguments": {
|
|
255
|
+
"foreground": "#333333",
|
|
256
|
+
"background": "#ffffff",
|
|
257
|
+
"fontSize": 16,
|
|
258
|
+
"isBold": false
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
#### 4. Get WCAG Rules (Full Mode Only)
|
|
264
|
+
|
|
265
|
+
Retrieve information about WCAG accessibility rules:
|
|
266
|
+
|
|
267
|
+
```json
|
|
268
|
+
{
|
|
269
|
+
"name": "get_wcag_rules",
|
|
270
|
+
"arguments": {
|
|
271
|
+
"wcagLevel": "AA",
|
|
272
|
+
"category": "color",
|
|
273
|
+
"search": "contrast",
|
|
274
|
+
"limit": 10
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## ๐ง MCP Client Integration
|
|
280
|
+
|
|
281
|
+
### Using with @modelcontextprotocol/sdk
|
|
282
|
+
|
|
283
|
+
```javascript
|
|
284
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
285
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
286
|
+
|
|
287
|
+
async function setupAccessibilityTesting() {
|
|
288
|
+
// Create transport to the accessibility server
|
|
289
|
+
const transport = new StdioClientTransport({
|
|
290
|
+
command: 'accessibility-mcp',
|
|
291
|
+
args: []
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// Create MCP client
|
|
295
|
+
const client = new Client({
|
|
296
|
+
name: 'my-accessibility-client',
|
|
297
|
+
version: '1.0.0'
|
|
298
|
+
}, {
|
|
299
|
+
capabilities: {}
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// Connect to the server
|
|
303
|
+
await client.connect(transport);
|
|
304
|
+
|
|
305
|
+
// List available tools
|
|
306
|
+
const tools = await client.listTools();
|
|
307
|
+
console.log('Available tools:', tools);
|
|
308
|
+
|
|
309
|
+
// Test a website
|
|
310
|
+
const result = await client.callTool('test_accessibility', {
|
|
311
|
+
target: 'https://example.com',
|
|
312
|
+
type: 'url',
|
|
313
|
+
level: 'basic',
|
|
314
|
+
wcagLevel: 'AA'
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
console.log('Accessibility test result:', result);
|
|
318
|
+
|
|
319
|
+
// Clean up
|
|
320
|
+
await client.close();
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
setupAccessibilityTesting().catch(console.error);
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Custom Host Application Integration
|
|
327
|
+
|
|
328
|
+
```javascript
|
|
329
|
+
import { spawn } from 'child_process';
|
|
330
|
+
import { EventEmitter } from 'events';
|
|
331
|
+
|
|
332
|
+
class AccessibilityMCPClient extends EventEmitter {
|
|
333
|
+
constructor() {
|
|
334
|
+
super();
|
|
335
|
+
this.process = null;
|
|
336
|
+
this.requestId = 0;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
async connect() {
|
|
340
|
+
// Start the accessibility MCP server
|
|
341
|
+
this.process = spawn('accessibility-mcp', [], {
|
|
342
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
// Handle server responses
|
|
346
|
+
this.process.stdout.on('data', (data) => {
|
|
347
|
+
const responses = data.toString().split('\n').filter(Boolean);
|
|
348
|
+
responses.forEach(response => {
|
|
349
|
+
try {
|
|
350
|
+
const parsed = JSON.parse(response);
|
|
351
|
+
this.emit('response', parsed);
|
|
352
|
+
} catch (error) {
|
|
353
|
+
console.error('Failed to parse response:', error);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
// Initialize the connection
|
|
359
|
+
await this.sendRequest('initialize', {
|
|
360
|
+
protocolVersion: '1.0.0',
|
|
361
|
+
capabilities: {},
|
|
362
|
+
clientInfo: {
|
|
363
|
+
name: 'custom-accessibility-client',
|
|
364
|
+
version: '1.0.0'
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
async sendRequest(method, params = {}) {
|
|
370
|
+
const request = {
|
|
371
|
+
jsonrpc: '2.0',
|
|
372
|
+
id: ++this.requestId,
|
|
373
|
+
method,
|
|
374
|
+
params
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
return new Promise((resolve, reject) => {
|
|
378
|
+
const timeout = setTimeout(() => {
|
|
379
|
+
reject(new Error('Request timeout'));
|
|
380
|
+
}, 30000);
|
|
381
|
+
|
|
382
|
+
const handler = (response) => {
|
|
383
|
+
if (response.id === request.id) {
|
|
384
|
+
clearTimeout(timeout);
|
|
385
|
+
this.removeListener('response', handler);
|
|
386
|
+
if (response.error) {
|
|
387
|
+
reject(new Error(response.error.message));
|
|
388
|
+
} else {
|
|
389
|
+
resolve(response.result);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
this.on('response', handler);
|
|
395
|
+
this.process.stdin.write(JSON.stringify(request) + '\n');
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
async testAccessibility(target, options = {}) {
|
|
400
|
+
return this.sendRequest('tools/call', {
|
|
401
|
+
name: 'test_accessibility',
|
|
402
|
+
arguments: {
|
|
403
|
+
target,
|
|
404
|
+
type: options.type || 'url',
|
|
405
|
+
level: options.level || 'basic',
|
|
406
|
+
wcagLevel: options.wcagLevel || 'AA'
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
async checkColorContrast(foreground, background, options = {}) {
|
|
412
|
+
return this.sendRequest('tools/call', {
|
|
413
|
+
name: 'check_color_contrast',
|
|
414
|
+
arguments: {
|
|
415
|
+
foreground,
|
|
416
|
+
background,
|
|
417
|
+
fontSize: options.fontSize || 16,
|
|
418
|
+
isBold: options.isBold || false
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
async close() {
|
|
424
|
+
if (this.process) {
|
|
425
|
+
this.process.kill();
|
|
426
|
+
this.process = null;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## โ๏ธ Configuration & Environment
|
|
433
|
+
|
|
434
|
+
### Server Modes
|
|
435
|
+
|
|
436
|
+
The server supports two operational modes:
|
|
437
|
+
|
|
438
|
+
**Simple Mode:**
|
|
439
|
+
- Basic accessibility testing
|
|
440
|
+
- Color contrast analysis
|
|
441
|
+
- Minimal resource usage
|
|
442
|
+
- Faster startup time
|
|
443
|
+
|
|
444
|
+
**Full Mode (Default):**
|
|
445
|
+
- Complete accessibility testing suite
|
|
446
|
+
- WCAG rules database access
|
|
447
|
+
- Advanced analysis features
|
|
448
|
+
- Comprehensive reporting
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
# Start in simple mode
|
|
452
|
+
accessibility-mcp --simple
|
|
453
|
+
|
|
454
|
+
# Start in full mode (default)
|
|
455
|
+
accessibility-mcp
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Environment Variables
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
# Server mode configuration
|
|
462
|
+
ACCESSIBILITY_MCP_MODE=full # or 'simple'
|
|
463
|
+
|
|
464
|
+
# Disable logging when running as MCP server
|
|
465
|
+
MCP_MODE=true
|
|
466
|
+
|
|
467
|
+
# Browser configuration
|
|
468
|
+
PUPPETEER_HEADLESS=true
|
|
469
|
+
PUPPETEER_TIMEOUT=30000
|
|
470
|
+
|
|
471
|
+
# Performance settings
|
|
472
|
+
NODE_ENV=production
|
|
473
|
+
LOG_LEVEL=error
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Host Application Configuration
|
|
477
|
+
|
|
478
|
+
Different host applications require different configuration approaches:
|
|
479
|
+
|
|
480
|
+
**Claude Desktop (`claude_desktop_config.json`):**
|
|
481
|
+
```json
|
|
482
|
+
{
|
|
483
|
+
"mcpServers": {
|
|
484
|
+
"accessibility": {
|
|
485
|
+
"command": "accessibility-mcp",
|
|
486
|
+
"args": ["--simple"]
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
**Cline/MCP Configuration:**
|
|
493
|
+
```json
|
|
494
|
+
{
|
|
495
|
+
"mcpServers": {
|
|
496
|
+
"accessibility-testing": {
|
|
497
|
+
"command": "accessibility-mcp",
|
|
498
|
+
"args": [],
|
|
499
|
+
"env": {
|
|
500
|
+
"ACCESSIBILITY_MCP_MODE": "full"
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
## ๐ Response Format
|
|
508
|
+
|
|
509
|
+
All tools return responses in a consistent format:
|
|
510
|
+
|
|
511
|
+
```typescript
|
|
512
|
+
interface ToolResponse<T> {
|
|
513
|
+
success: boolean;
|
|
514
|
+
data?: T;
|
|
515
|
+
error?: {
|
|
516
|
+
type: string;
|
|
517
|
+
message: string;
|
|
518
|
+
details?: any;
|
|
519
|
+
};
|
|
520
|
+
processingTime: number;
|
|
521
|
+
timestamp: string;
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### Sample Accessibility Test Response
|
|
526
|
+
|
|
527
|
+
```json
|
|
528
|
+
{
|
|
529
|
+
"success": true,
|
|
530
|
+
"data": {
|
|
531
|
+
"target": "https://example.com",
|
|
532
|
+
"type": "url",
|
|
533
|
+
"wcagLevel": "AA",
|
|
534
|
+
"violations": [
|
|
535
|
+
{
|
|
536
|
+
"id": "color-contrast",
|
|
537
|
+
"impact": "serious",
|
|
538
|
+
"description": "Elements must have sufficient color contrast",
|
|
539
|
+
"help": "Ensure the contrast ratio is at least 4.5:1",
|
|
540
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.8/color-contrast",
|
|
541
|
+
"nodes": [
|
|
542
|
+
{
|
|
543
|
+
"html": "<p style=\"color: #999; background: #fff;\">Low contrast text</p>",
|
|
544
|
+
"target": ["p"],
|
|
545
|
+
"failureSummary": "Fix any of the following:\n Element has insufficient color contrast"
|
|
546
|
+
}
|
|
547
|
+
]
|
|
548
|
+
}
|
|
549
|
+
],
|
|
550
|
+
"summary": {
|
|
551
|
+
"totalViolations": 1,
|
|
552
|
+
"violationsByImpact": {
|
|
553
|
+
"critical": 0,
|
|
554
|
+
"serious": 1,
|
|
555
|
+
"moderate": 0,
|
|
556
|
+
"minor": 0
|
|
557
|
+
},
|
|
558
|
+
"compliance": {
|
|
559
|
+
"A": false,
|
|
560
|
+
"AA": false,
|
|
561
|
+
"AAA": false
|
|
562
|
+
},
|
|
563
|
+
"score": 75
|
|
564
|
+
},
|
|
565
|
+
"metadata": {
|
|
566
|
+
"testDuration": 2500,
|
|
567
|
+
"pageTitle": "Example Website",
|
|
568
|
+
"viewport": { "width": 1920, "height": 1080 }
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
"processingTime": 2500,
|
|
572
|
+
"timestamp": "2024-12-01T10:30:00.000Z"
|
|
573
|
+
}
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
## ๐ Production Deployment
|
|
577
|
+
|
|
578
|
+
### Enterprise Environment Setup
|
|
579
|
+
|
|
580
|
+
1. **Install as system service:**
|
|
581
|
+
```bash
|
|
582
|
+
# Install globally
|
|
583
|
+
npm install -g accessibility-mcp-server
|
|
584
|
+
|
|
585
|
+
# Create systemd service (Linux)
|
|
586
|
+
sudo cat > /etc/systemd/system/accessibility-mcp.service << EOF
|
|
587
|
+
[Unit]
|
|
588
|
+
Description=Accessibility MCP Server
|
|
589
|
+
After=network.target
|
|
590
|
+
|
|
591
|
+
[Service]
|
|
592
|
+
Type=simple
|
|
593
|
+
User=accessibility
|
|
594
|
+
ExecStart=/usr/local/bin/accessibility-mcp
|
|
595
|
+
Restart=always
|
|
596
|
+
Environment=NODE_ENV=production
|
|
597
|
+
Environment=MCP_MODE=true
|
|
598
|
+
|
|
599
|
+
[Install]
|
|
600
|
+
WantedBy=multi-user.target
|
|
601
|
+
EOF
|
|
602
|
+
|
|
603
|
+
# Enable and start service
|
|
604
|
+
sudo systemctl enable accessibility-mcp
|
|
605
|
+
sudo systemctl start accessibility-mcp
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
2. **Docker Production Setup:**
|
|
609
|
+
```bash
|
|
610
|
+
# Production Dockerfile
|
|
611
|
+
FROM node:18-alpine
|
|
612
|
+
WORKDIR /app
|
|
613
|
+
COPY package*.json ./
|
|
614
|
+
RUN npm ci --only=production
|
|
615
|
+
COPY dist/ ./dist/
|
|
616
|
+
COPY config/ ./config/
|
|
617
|
+
EXPOSE 3000
|
|
618
|
+
USER node
|
|
619
|
+
CMD ["node", "dist/index.js"]
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
3. **CI/CD Integration:**
|
|
623
|
+
```yaml
|
|
624
|
+
# GitHub Actions example
|
|
625
|
+
name: Accessibility Testing
|
|
626
|
+
on: [push, pull_request]
|
|
627
|
+
|
|
628
|
+
jobs:
|
|
629
|
+
accessibility:
|
|
630
|
+
runs-on: ubuntu-latest
|
|
631
|
+
steps:
|
|
632
|
+
- uses: actions/checkout@v4
|
|
633
|
+
- uses: actions/setup-node@v4
|
|
634
|
+
with:
|
|
635
|
+
node-version: '18'
|
|
636
|
+
|
|
637
|
+
- name: Install Accessibility MCP Server
|
|
638
|
+
run: npm install -g accessibility-mcp-server
|
|
639
|
+
|
|
640
|
+
- name: Test Website Accessibility
|
|
641
|
+
run: |
|
|
642
|
+
# Note: CLI interface would need to be implemented for CI/CD
|
|
643
|
+
# This is a conceptual example
|
|
644
|
+
echo "Accessibility testing would run here"
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
## ๐ Security & Compliance
|
|
648
|
+
|
|
649
|
+
### Security Features
|
|
650
|
+
|
|
651
|
+
- **๐ Local Processing**: All accessibility testing happens locally - no external API calls
|
|
652
|
+
- **๐ก๏ธ Input Validation**: All inputs validated using Zod schemas
|
|
653
|
+
- **๐งน Resource Management**: Automatic cleanup of browser instances and memory
|
|
654
|
+
- **๐ฆ Sandboxed Execution**: Puppeteer runs in sandboxed mode
|
|
655
|
+
- **๐ซ No Data Transmission**: Zero data leaves the customer environment
|
|
656
|
+
|
|
657
|
+
### Privacy Compliance
|
|
658
|
+
|
|
659
|
+
- **GDPR Compliant**: No personal data processing or storage
|
|
660
|
+
- **SOC 2 Ready**: Designed for enterprise security requirements
|
|
661
|
+
- **Zero Trust**: No external dependencies or data transmission
|
|
662
|
+
- **Audit Trail**: Comprehensive logging for security auditing
|
|
663
|
+
|
|
664
|
+
## ๐ Troubleshooting
|
|
665
|
+
|
|
666
|
+
### Common Integration Issues
|
|
667
|
+
|
|
668
|
+
**Issue: MCP server not starting**
|
|
669
|
+
```bash
|
|
670
|
+
# Check if Node.js version is compatible
|
|
671
|
+
node --version # Should be 18.0.0 or higher
|
|
672
|
+
|
|
673
|
+
# Verify installation
|
|
674
|
+
accessibility-mcp --version
|
|
675
|
+
|
|
676
|
+
# Check for conflicting processes
|
|
677
|
+
ps aux | grep accessibility-mcp
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
**Issue: Tools not appearing in host application**
|
|
681
|
+
```bash
|
|
682
|
+
# Verify MCP server is properly configured
|
|
683
|
+
cat ~/.config/claude-desktop/claude_desktop_config.json
|
|
684
|
+
|
|
685
|
+
# Test server manually
|
|
686
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | accessibility-mcp
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
**Issue: Browser automation failures**
|
|
690
|
+
```bash
|
|
691
|
+
# Install required dependencies (Linux)
|
|
692
|
+
sudo apt-get install -y chromium-browser
|
|
693
|
+
|
|
694
|
+
# Check browser permissions
|
|
695
|
+
export PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
### Performance Optimization
|
|
699
|
+
|
|
700
|
+
**For high-volume testing:**
|
|
701
|
+
```bash
|
|
702
|
+
# Set environment variables for better performance
|
|
703
|
+
export PUPPETEER_HEADLESS=true
|
|
704
|
+
export NODE_ENV=production
|
|
705
|
+
export ACCESSIBILITY_MCP_MODE=simple
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
**Memory management:**
|
|
709
|
+
```bash
|
|
710
|
+
# Monitor memory usage
|
|
711
|
+
top -p $(pgrep -f accessibility-mcp)
|
|
712
|
+
|
|
713
|
+
# Restart server if memory usage is high
|
|
714
|
+
sudo systemctl restart accessibility-mcp
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
## ๐ API Reference
|
|
718
|
+
|
|
719
|
+
### Tool: `test_accessibility`
|
|
720
|
+
|
|
721
|
+
Tests websites or HTML content for accessibility violations.
|
|
722
|
+
|
|
723
|
+
**Parameters:**
|
|
724
|
+
- `target` (string, required): URL or HTML content to test
|
|
725
|
+
- `type` (enum): `"url"` | `"html"` (default: `"url"`)
|
|
726
|
+
- `level` (enum): `"basic"` | `"full"` (default: `"basic"`)
|
|
727
|
+
- `wcagLevel` (enum): `"A"` | `"AA"` | `"AAA"` (default: `"AA"`)
|
|
728
|
+
|
|
729
|
+
### Tool: `check_color_contrast`
|
|
730
|
+
|
|
731
|
+
Analyzes color combinations for WCAG compliance.
|
|
732
|
+
|
|
733
|
+
**Parameters:**
|
|
734
|
+
- `foreground` (string, required): Foreground color (hex, rgb, hsl, or named)
|
|
735
|
+
- `background` (string, required): Background color (hex, rgb, hsl, or named)
|
|
736
|
+
- `fontSize` (number): Font size in pixels (default: 16)
|
|
737
|
+
- `isBold` (boolean): Whether text is bold (default: false)
|
|
738
|
+
|
|
739
|
+
### Tool: `get_wcag_rules` (Full Mode Only)
|
|
740
|
+
|
|
741
|
+
Retrieves WCAG accessibility rule information.
|
|
742
|
+
|
|
743
|
+
**Parameters:**
|
|
744
|
+
- `wcagLevel` (enum, optional): `"A"` | `"AA"` | `"AAA"`
|
|
745
|
+
- `category` (string, optional): Rule category filter
|
|
746
|
+
- `search` (string, optional): Search term for rules
|
|
747
|
+
- `limit` (number, optional): Maximum rules to return (1-50, default: 20)
|
|
748
|
+
|
|
749
|
+
## ๐ License
|
|
750
|
+
|
|
751
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
752
|
+
|
|
753
|
+
## ๐ค Support & Contributing
|
|
754
|
+
|
|
755
|
+
- **Issues**: [GitHub Issues](https://github.com/nigamutkarsh/accessibility-mcp-server/issues)
|
|
756
|
+
- **Documentation**: Check the `/docs` folder for additional guides
|
|
757
|
+
- **Contributing**: Fork the repository and submit pull requests
|
|
758
|
+
- **Discussions**: Use GitHub Discussions for questions and feature requests
|
|
759
|
+
|
|
760
|
+
---
|
|
761
|
+
|
|
762
|
+
**Built with โค๏ธ for web accessibility and inclusive design**
|