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
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
{
|
|
2
|
+
"wcagRules": {
|
|
3
|
+
"2.0": {
|
|
4
|
+
"level": {
|
|
5
|
+
"A": [
|
|
6
|
+
"color-contrast",
|
|
7
|
+
"image-alt",
|
|
8
|
+
"label",
|
|
9
|
+
"link-name",
|
|
10
|
+
"button-name"
|
|
11
|
+
],
|
|
12
|
+
"AA": [
|
|
13
|
+
"color-contrast-enhanced",
|
|
14
|
+
"focus-order-semantics",
|
|
15
|
+
"heading-order",
|
|
16
|
+
"html-has-lang"
|
|
17
|
+
],
|
|
18
|
+
"AAA": [
|
|
19
|
+
"color-contrast-enhanced",
|
|
20
|
+
"focus-order-semantics"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"2.1": {
|
|
25
|
+
"level": {
|
|
26
|
+
"A": [
|
|
27
|
+
"color-contrast",
|
|
28
|
+
"image-alt",
|
|
29
|
+
"label",
|
|
30
|
+
"link-name",
|
|
31
|
+
"button-name",
|
|
32
|
+
"aria-allowed-attr",
|
|
33
|
+
"aria-required-attr",
|
|
34
|
+
"aria-valid-attr-value",
|
|
35
|
+
"aria-valid-attr"
|
|
36
|
+
],
|
|
37
|
+
"AA": [
|
|
38
|
+
"color-contrast-enhanced",
|
|
39
|
+
"focus-order-semantics",
|
|
40
|
+
"heading-order",
|
|
41
|
+
"html-has-lang",
|
|
42
|
+
"region",
|
|
43
|
+
"page-has-heading-one"
|
|
44
|
+
],
|
|
45
|
+
"AAA": [
|
|
46
|
+
"color-contrast-enhanced",
|
|
47
|
+
"focus-order-semantics",
|
|
48
|
+
"target-size"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"2.2": {
|
|
53
|
+
"level": {
|
|
54
|
+
"A": [
|
|
55
|
+
"color-contrast",
|
|
56
|
+
"image-alt",
|
|
57
|
+
"label",
|
|
58
|
+
"link-name",
|
|
59
|
+
"button-name",
|
|
60
|
+
"aria-allowed-attr",
|
|
61
|
+
"aria-required-attr",
|
|
62
|
+
"aria-valid-attr-value",
|
|
63
|
+
"aria-valid-attr",
|
|
64
|
+
"focus-order-semantics"
|
|
65
|
+
],
|
|
66
|
+
"AA": [
|
|
67
|
+
"color-contrast-enhanced",
|
|
68
|
+
"focus-order-semantics",
|
|
69
|
+
"heading-order",
|
|
70
|
+
"html-has-lang",
|
|
71
|
+
"region",
|
|
72
|
+
"page-has-heading-one",
|
|
73
|
+
"target-size"
|
|
74
|
+
],
|
|
75
|
+
"AAA": [
|
|
76
|
+
"color-contrast-enhanced",
|
|
77
|
+
"focus-order-semantics",
|
|
78
|
+
"target-size-enhanced"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"categories": {
|
|
84
|
+
"color": [
|
|
85
|
+
"color-contrast",
|
|
86
|
+
"color-contrast-enhanced",
|
|
87
|
+
"link-in-text-block"
|
|
88
|
+
],
|
|
89
|
+
"keyboard": [
|
|
90
|
+
"accesskeys",
|
|
91
|
+
"focus-order-semantics",
|
|
92
|
+
"focusable-content",
|
|
93
|
+
"tabindex"
|
|
94
|
+
],
|
|
95
|
+
"images": [
|
|
96
|
+
"image-alt",
|
|
97
|
+
"image-redundant-alt",
|
|
98
|
+
"object-alt",
|
|
99
|
+
"input-image-alt"
|
|
100
|
+
],
|
|
101
|
+
"headings": [
|
|
102
|
+
"heading-order",
|
|
103
|
+
"page-has-heading-one",
|
|
104
|
+
"empty-heading"
|
|
105
|
+
],
|
|
106
|
+
"landmarks": [
|
|
107
|
+
"region",
|
|
108
|
+
"landmark-banner-is-top-level",
|
|
109
|
+
"landmark-complementary-is-top-level",
|
|
110
|
+
"landmark-contentinfo-is-top-level",
|
|
111
|
+
"landmark-main-is-top-level",
|
|
112
|
+
"landmark-no-duplicate-banner",
|
|
113
|
+
"landmark-no-duplicate-contentinfo",
|
|
114
|
+
"landmark-one-main"
|
|
115
|
+
],
|
|
116
|
+
"forms": [
|
|
117
|
+
"label",
|
|
118
|
+
"label-title-only",
|
|
119
|
+
"form-field-multiple-labels",
|
|
120
|
+
"select-name"
|
|
121
|
+
],
|
|
122
|
+
"links": [
|
|
123
|
+
"link-name",
|
|
124
|
+
"link-in-text-block"
|
|
125
|
+
],
|
|
126
|
+
"tables": [
|
|
127
|
+
"table-caption",
|
|
128
|
+
"td-headers-attr",
|
|
129
|
+
"th-has-data-cells",
|
|
130
|
+
"table-duplicate-name"
|
|
131
|
+
],
|
|
132
|
+
"aria": [
|
|
133
|
+
"aria-allowed-attr",
|
|
134
|
+
"aria-allowed-role",
|
|
135
|
+
"aria-dpub-role-fallback",
|
|
136
|
+
"aria-hidden-body",
|
|
137
|
+
"aria-hidden-focus",
|
|
138
|
+
"aria-input-field-name",
|
|
139
|
+
"aria-required-attr",
|
|
140
|
+
"aria-required-children",
|
|
141
|
+
"aria-required-parent",
|
|
142
|
+
"aria-roledescription",
|
|
143
|
+
"aria-roles",
|
|
144
|
+
"aria-valid-attr-value",
|
|
145
|
+
"aria-valid-attr"
|
|
146
|
+
],
|
|
147
|
+
"structure": [
|
|
148
|
+
"bypass",
|
|
149
|
+
"document-title",
|
|
150
|
+
"html-has-lang",
|
|
151
|
+
"html-lang-valid",
|
|
152
|
+
"html-xml-lang-mismatch",
|
|
153
|
+
"valid-lang"
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
"ruleDescriptions": {
|
|
157
|
+
"color-contrast": {
|
|
158
|
+
"title": "Color Contrast",
|
|
159
|
+
"description": "Ensures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds",
|
|
160
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/color-contrast",
|
|
161
|
+
"successCriteria": "1.4.3"
|
|
162
|
+
},
|
|
163
|
+
"image-alt": {
|
|
164
|
+
"title": "Images must have alternate text",
|
|
165
|
+
"description": "Ensures <img> elements have alternate text or a role of none or presentation",
|
|
166
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/image-alt",
|
|
167
|
+
"successCriteria": "1.1.1"
|
|
168
|
+
},
|
|
169
|
+
"label": {
|
|
170
|
+
"title": "Form elements must have labels",
|
|
171
|
+
"description": "Ensures every form element has a label",
|
|
172
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/label",
|
|
173
|
+
"successCriteria": "1.3.1, 3.3.2, 4.1.2"
|
|
174
|
+
},
|
|
175
|
+
"link-name": {
|
|
176
|
+
"title": "Links must have discernible text",
|
|
177
|
+
"description": "Ensures links have discernible text",
|
|
178
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/link-name",
|
|
179
|
+
"successCriteria": "2.4.4, 4.1.2"
|
|
180
|
+
},
|
|
181
|
+
"button-name": {
|
|
182
|
+
"title": "Buttons must have discernible text",
|
|
183
|
+
"description": "Ensures buttons have discernible text",
|
|
184
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/button-name",
|
|
185
|
+
"successCriteria": "4.1.2"
|
|
186
|
+
},
|
|
187
|
+
"heading-order": {
|
|
188
|
+
"title": "Heading levels should only increase by one",
|
|
189
|
+
"description": "Ensures the order of headings is semantically correct",
|
|
190
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/heading-order",
|
|
191
|
+
"successCriteria": "1.3.1"
|
|
192
|
+
},
|
|
193
|
+
"html-has-lang": {
|
|
194
|
+
"title": "<html> element must have a lang attribute",
|
|
195
|
+
"description": "Ensures every HTML document has a lang attribute",
|
|
196
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/html-has-lang",
|
|
197
|
+
"successCriteria": "3.1.1"
|
|
198
|
+
},
|
|
199
|
+
"aria-allowed-attr": {
|
|
200
|
+
"title": "ARIA attributes must conform to valid names",
|
|
201
|
+
"description": "Ensures ARIA attributes are allowed for an element's role",
|
|
202
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/aria-allowed-attr",
|
|
203
|
+
"successCriteria": "4.1.2"
|
|
204
|
+
},
|
|
205
|
+
"aria-required-attr": {
|
|
206
|
+
"title": "Required ARIA attributes must be provided",
|
|
207
|
+
"description": "Ensures elements with ARIA roles have required ARIA attributes",
|
|
208
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/aria-required-attr",
|
|
209
|
+
"successCriteria": "4.1.2"
|
|
210
|
+
},
|
|
211
|
+
"region": {
|
|
212
|
+
"title": "All page content should be contained by landmarks",
|
|
213
|
+
"description": "Ensures all page content is contained by landmarks",
|
|
214
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/region",
|
|
215
|
+
"successCriteria": "1.3.1"
|
|
216
|
+
},
|
|
217
|
+
"target-size": {
|
|
218
|
+
"title": "Ensure touch targets have sufficient size and spacing",
|
|
219
|
+
"description": "Ensures touch targets are at least 24px by 24px",
|
|
220
|
+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.6/target-size",
|
|
221
|
+
"successCriteria": "2.5.8"
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"defaultSettings": {
|
|
225
|
+
"wcagLevel": "AA",
|
|
226
|
+
"wcagVersions": ["2.1"],
|
|
227
|
+
"includeExperimentalRules": false,
|
|
228
|
+
"timeout": 30000,
|
|
229
|
+
"viewport": {
|
|
230
|
+
"width": 1920,
|
|
231
|
+
"height": 1080
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"contrastRequirements": {
|
|
235
|
+
"AA": {
|
|
236
|
+
"normal": 4.5,
|
|
237
|
+
"large": 3.0
|
|
238
|
+
},
|
|
239
|
+
"AAA": {
|
|
240
|
+
"normal": 7.0,
|
|
241
|
+
"large": 4.5
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"targetSizeRequirements": {
|
|
245
|
+
"2.2": {
|
|
246
|
+
"AA": {
|
|
247
|
+
"minSize": 24,
|
|
248
|
+
"spacing": 24
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
type ServerMode = 'simple' | 'full';
|
|
3
|
+
interface ServerConfig {
|
|
4
|
+
mode: ServerMode;
|
|
5
|
+
enableLogging: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Unified MCP server class for accessibility testing
|
|
9
|
+
* Supports both simple and full modes
|
|
10
|
+
*/
|
|
11
|
+
export declare class AccessibilityMCPServer {
|
|
12
|
+
private readonly server;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
private readonly browserManager;
|
|
15
|
+
private readonly config;
|
|
16
|
+
private accessibilityTester?;
|
|
17
|
+
private colorContrastTester?;
|
|
18
|
+
private wcagValidator?;
|
|
19
|
+
private websiteAccessibilityTester?;
|
|
20
|
+
constructor(config?: ServerConfig);
|
|
21
|
+
/**
|
|
22
|
+
* Get or create accessibility tester (lazy loading)
|
|
23
|
+
*/
|
|
24
|
+
private getAccessibilityTester;
|
|
25
|
+
/**
|
|
26
|
+
* Get or create color contrast tester (lazy loading)
|
|
27
|
+
*/
|
|
28
|
+
private getColorContrastTester;
|
|
29
|
+
/**
|
|
30
|
+
* Get or create WCAG validator (lazy loading)
|
|
31
|
+
*/
|
|
32
|
+
private getWCAGValidator;
|
|
33
|
+
/**
|
|
34
|
+
* Get or create website accessibility tester (lazy loading)
|
|
35
|
+
*/
|
|
36
|
+
private getWebsiteAccessibilityTester;
|
|
37
|
+
/**
|
|
38
|
+
* Centralized error handling for all operations
|
|
39
|
+
*/
|
|
40
|
+
private executeWithErrorHandling;
|
|
41
|
+
/**
|
|
42
|
+
* Set up MCP request handlers
|
|
43
|
+
*/
|
|
44
|
+
private setupHandlers;
|
|
45
|
+
/**
|
|
46
|
+
* Set up graceful shutdown handling
|
|
47
|
+
*/
|
|
48
|
+
private setupGracefulShutdown;
|
|
49
|
+
/**
|
|
50
|
+
* Start the MCP server
|
|
51
|
+
*/
|
|
52
|
+
run(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Clean up resources
|
|
55
|
+
*/
|
|
56
|
+
cleanup(): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAuBA,KAAK,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpC,UAAU,YAAY;IACpB,IAAI,EAAE,UAAU,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;CACxB;AAsCD;;;GAGG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IAGtC,OAAO,CAAC,mBAAmB,CAAC,CAAsB;IAClD,OAAO,CAAC,mBAAmB,CAAC,CAAsB;IAClD,OAAO,CAAC,aAAa,CAAC,CAAgB;IACtC,OAAO,CAAC,0BAA0B,CAAC,CAA6B;gBAEpD,MAAM,GAAE,YAAoD;IAwBxE;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAOrC;;OAEG;YACW,wBAAwB;IA8CtC;;OAEG;IACH,OAAO,CAAC,aAAa;IA8OrB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA0B7B;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAW1B;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAS/B"}
|