a11y-test-mcp 1.1.0 → 1.1.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 CHANGED
@@ -1,16 +1,17 @@
1
1
  # a11y test MCP
2
+
2
3
  An MCP (Model Context Protocol) server for performing a11y test on webpages using playwright axe-core. The results are then used in an agent loop with your favorite AI assistant (Cline/Cursor/GH Copilot) to find problems with a11y and suggest improvements.
3
4
 
4
5
  ## Features
5
6
 
6
- * Perform detailed accessibility testing on any web pages
7
- * Get an overview of accessibility issues
8
- * Violations
9
- * Provides information on which DOM was at fault
10
- * Passes
11
- * Incomplete
12
- * Inapplicable
13
- * Can specify specific WCAG criteria(Default WCAG 2.0 level A, WCAG 2.0 level AA, WCAG 2.1 level A, WCAG 2.1 level AA)
7
+ - Perform detailed accessibility testing on any web pages
8
+ - Get an overview of accessibility issues
9
+ - Violations
10
+ - Provides information on which DOM was at fault
11
+ - Passes
12
+ - Incomplete
13
+ - Inapplicable
14
+ - Can specify specific WCAG criteria(Default WCAG 2.0 level A, WCAG 2.0 level AA, WCAG 2.1 level A, WCAG 2.1 level AA)
14
15
 
15
16
  ## Installation
16
17
 
@@ -18,4 +18,4 @@ exports.WCAG_TAG_MAP = {
18
18
  /** Allow prefixes or tags */
19
19
  exports.ALLOWED_PREFIXES_OR_TAGS = ['wcag', 'best-practice', 'section508'];
20
20
  /** default WCAG tags */
21
- exports.DEFAULT_WCAG_TAGS = ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"];
21
+ exports.DEFAULT_WCAG_TAGS = ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'];
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.convertTestResultToText = exports.execTest = void 0;
7
- const playwright_1 = __importDefault(require("playwright"));
8
- const playwright_2 = __importDefault(require("@axe-core/playwright"));
7
+ const playwright_1 = __importDefault(require("@axe-core/playwright"));
8
+ const playwright_2 = require("playwright");
9
9
  const constants_1 = require("./constants");
10
10
  /**
11
11
  * Enhance WCAG tag conversion
@@ -45,7 +45,7 @@ const formatViolation = (v) => {
45
45
  * @returns {AccessibilityTestOutput[]} - Results of the accessibility tests
46
46
  */
47
47
  const execTest = async (urls, wcagStandards) => {
48
- const browser = await playwright_1.default.chromium.launch();
48
+ const browser = await playwright_2.chromium.launch();
49
49
  const context = await browser.newContext();
50
50
  const tagsToUse = (wcagStandards && wcagStandards.length > 0)
51
51
  ? convertWcagTag(wcagStandards)
@@ -56,7 +56,7 @@ const execTest = async (urls, wcagStandards) => {
56
56
  try {
57
57
  page = await context.newPage();
58
58
  await page.goto(url, { waitUntil: 'networkidle' });
59
- const axeBuilder = new playwright_2.default({ page });
59
+ const axeBuilder = new playwright_1.default({ page });
60
60
  axeBuilder.withTags(tagsToUse);
61
61
  const axeResults = await axeBuilder.analyze();
62
62
  const summarizedViolations = axeResults.violations.map(v => ({
@@ -64,7 +64,7 @@ const execTest = async (urls, wcagStandards) => {
64
64
  impact: v.impact === null ? undefined : v.impact,
65
65
  description: v.description,
66
66
  helpUrl: v.helpUrl,
67
- nodes: v.nodes
67
+ nodes: v.nodes,
68
68
  }));
69
69
  return {
70
70
  url: url,
package/build/index.js CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  "use strict";
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
@@ -15,8 +14,8 @@ server.tool('exec-a11y-test', 'Obtains a list of specified list of URL and a lis
15
14
  return {
16
15
  content: [{
17
16
  type: 'text',
18
- text: (0, functions_1.convertTestResultToText)(structuredResults)
19
- }]
17
+ text: (0, functions_1.convertTestResultToText)(structuredResults),
18
+ }],
20
19
  };
21
20
  });
22
21
  /**
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "a11y-test-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.1.3",
4
4
  "main": "build/index.js",
5
5
  "scripts": {
6
6
  "postinstall": "npx -y playwright install",
7
- "build": "tsc && chmod 755 build/index.js",
7
+ "build": "tsgo && chmod 755 build/index.js",
8
8
  "start": "node build/index.js",
9
- "lint": "eslint .",
10
- "format": "npm run lint -- --fix"
9
+ "lint": "npm run lint:e && npm run lint:d",
10
+ "lint:e": "eslint .",
11
+ "lint:d": "dprint check",
12
+ "format": "dprint fmt"
11
13
  },
12
14
  "bin": {
13
15
  "a11y-test-mcp": "build/index.js"
@@ -43,6 +45,8 @@
43
45
  "devDependencies": {
44
46
  "@eslint/js": "^9.25.1",
45
47
  "@types/node": "^22.15.2",
48
+ "@typescript/native-preview": "^7.0.0-dev.20250523.1",
49
+ "dprint": "^0.49.1",
46
50
  "eslint": "^9.25.1",
47
51
  "eslint-config-flat-gitignore": "^2.1.0",
48
52
  "typescript": "^5.8.3",
@@ -1,6 +0,0 @@
1
- /** WCAG tag map */
2
- export declare const WCAG_TAG_MAP: Record<string, string>;
3
- /** Allow prefixes or tags */
4
- export declare const ALLOWED_PREFIXES_OR_TAGS: string[];
5
- /** default WCAG tags */
6
- export declare const DEFAULT_WCAG_TAGS: string[];
@@ -1,14 +0,0 @@
1
- import type { AccessibilityTestOutput } from './types';
2
- /**
3
- * Execute a11y test
4
- * @param {string[]} urls - URLs
5
- * @param {string[] | undefined} wcagStandards - WCAG standards to apply
6
- * @returns {AccessibilityTestOutput[]} - Results of the accessibility tests
7
- */
8
- export declare const execTest: (urls: string[], wcagStandards: string[] | undefined) => Promise<AccessibilityTestOutput[]>;
9
- /**
10
- * Convert structured results to text format
11
- * @param {AccessibilityTestOutput[]} structuredResults - Structured results from the tests
12
- * @returns {string} - Text representation of the results
13
- */
14
- export declare const convertTestResultToText: (structuredResults: AccessibilityTestOutput[]) => string;
package/build/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/build/types.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import type { NodeResult } from 'axe-core';
2
- export interface ViolationSummary {
3
- id: string;
4
- impact?: 'minor' | 'moderate' | 'serious' | 'critical';
5
- description: string;
6
- helpUrl: string;
7
- nodes: NodeResult[];
8
- }
9
- /** Update the main output structure */
10
- export interface AccessibilityTestOutput {
11
- url: string;
12
- violations?: ViolationSummary[];
13
- passesCount?: number;
14
- incompleteCount?: number;
15
- inapplicableCount?: number;
16
- error?: string;
17
- }
package/build/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });