a11y-test-mcp 1.0.4 → 1.0.7

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
@@ -10,7 +10,7 @@ An MCP (Model Context Protocol) server for performing a11y test on webpages usin
10
10
  * Passes
11
11
  * Incomplete
12
12
  * Inapplicable
13
- * Can specify specific WCAG criteria
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)
14
14
 
15
15
  ## Installation
16
16
 
@@ -52,22 +52,17 @@ const execTest = async (urls, wcagStandards) => {
52
52
  const results = [];
53
53
  const browser = await playwright_1.default.chromium.launch();
54
54
  const context = await browser.newContext();
55
+ const tagsToUse = (wcagStandards && wcagStandards.length > 0)
56
+ ? convertWcagTag(wcagStandards)
57
+ : ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"];
55
58
  try {
56
59
  for (const url of urls) {
57
- let page;
60
+ let page = null;
58
61
  try {
59
62
  page = await context.newPage();
60
63
  await page.goto(url, { waitUntil: 'networkidle' });
61
64
  const axeBuilder = new playwright_2.default({ page });
62
- const tagsToUse = (wcagStandards && wcagStandards.length > 0)
63
- ? convertWcagTag(wcagStandards)
64
- : ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"];
65
- if (tagsToUse.length > 0) {
66
- axeBuilder.withTags(tagsToUse);
67
- }
68
- else {
69
- console.warn("No valid WCAG tags specified, running Axe with default rules.");
70
- }
65
+ axeBuilder.withTags(tagsToUse);
71
66
  const axeResults = await axeBuilder.analyze();
72
67
  // Summarize results, handling null impact
73
68
  const summarizedViolations = axeResults.violations.map(v => ({
@@ -93,7 +88,7 @@ const execTest = async (urls, wcagStandards) => {
93
88
  });
94
89
  }
95
90
  finally {
96
- if (page) {
91
+ if (page !== null) {
97
92
  await page.close();
98
93
  }
99
94
  }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "a11y-test-mcp",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "main": "build/index.js",
5
5
  "scripts": {
6
+ "postinstall": "npx -y playwright install",
6
7
  "build": "tsc && chmod 755 build/index.js",
7
8
  "start": "node build/index.js",
8
9
  "lint": "eslint .",