mcp-web-validator 1.3.54 → 1.3.55
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/CHANGELOG.md +16 -0
- package/README.md +8 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +75 -22
- package/dist/index.js.map +1 -1
- package/dist/modules/browser-ux/axe-review.d.ts +18 -0
- package/dist/modules/browser-ux/axe-review.js +40 -0
- package/dist/modules/browser-ux/axe-review.js.map +1 -0
- package/dist/modules/browser-ux/wcag-interactions.d.ts +3 -0
- package/dist/modules/browser-ux/wcag-interactions.js +40 -1
- package/dist/modules/browser-ux/wcag-interactions.js.map +1 -1
- package/dist/presentation.js +18 -8
- package/dist/presentation.js.map +1 -1
- package/dist/screenshot.d.ts +3 -1
- package/dist/screenshot.js +16 -2
- package/dist/screenshot.js.map +1 -1
- package/dist/seo-auditor.js +7 -1
- package/dist/seo-auditor.js.map +1 -1
- package/dist/stylelint-validator.d.ts +6 -0
- package/dist/stylelint-validator.js +64 -0
- package/dist/stylelint-validator.js.map +1 -0
- package/dist/visual-diff.d.ts +15 -0
- package/dist/visual-diff.js +91 -0
- package/dist/visual-diff.js.map +1 -0
- package/dist/w3c-validator.d.ts +4 -2
- package/dist/w3c-validator.js +94 -37
- package/dist/w3c-validator.js.map +1 -1
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ All notable changes to this project are documented here. The project follows [Se
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [1.3.55] - 2026-11-23
|
|
8
|
+
|
|
9
|
+
### Reliability and optional engines
|
|
10
|
+
|
|
11
|
+
- Add a private loopback Nu Checker fallback for transient HTML validation failures,
|
|
12
|
+
including an explicit local-only mode that never uploads markup.
|
|
13
|
+
- Introduce an offline Stylelint quality option on the existing local CSS tool.
|
|
14
|
+
- Add an optional axe-core WCAG 2.2 automated rule sample to existing inert
|
|
15
|
+
keyboard checks; unavailable checks never indicate conformance.
|
|
16
|
+
- Compare existing screenshot capture output with an optional PNG baseline using
|
|
17
|
+
pixelmatch; missing or incomplete evidence stays inconclusive.
|
|
18
|
+
- Retry a fixed second public Nu endpoint on bounded hosted transient errors,
|
|
19
|
+
preserving the original total timeout, safety checks and partial statuses.
|
|
20
|
+
- Provide capped, separately opted-in SiteOne/Unlighthouse CLI comparisons;
|
|
21
|
+
do not auto-install or start heavy crawlers, and do not increase MCP tool counts.
|
|
22
|
+
|
|
7
23
|
## [1.3.54] - 2026-11-23
|
|
8
24
|
|
|
9
25
|
### Fixed
|
package/README.md
CHANGED
|
@@ -38,6 +38,14 @@ https://web-validator-mcp.digestseo.com/mcp
|
|
|
38
38
|
|
|
39
39
|
## Requirements
|
|
40
40
|
|
|
41
|
+
- Optional reliability upgrades for local Nu Checker fallback, offline
|
|
42
|
+
Stylelint CSS checks, axe-core accessibility diagnostics, pixelmatch
|
|
43
|
+
screenshot comparisons, and capped independent SiteOne/Unlighthouse
|
|
44
|
+
experiments are documented in
|
|
45
|
+
[Reliability engines](docs/reliability-engines-20261123.md).
|
|
46
|
+
They extend existing tool inputs without adding MCP tools. External
|
|
47
|
+
crawler/browser engines are never enabled in the MCP by default.
|
|
48
|
+
|
|
41
49
|
- Node.js 22.12.0 or newer
|
|
42
50
|
- An MCP client that supports stdio, or a client that supports Streamable HTTP for the hosted endpoint
|
|
43
51
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
3
3
|
import { auditSeoMetadata, auditSeoMetadataDetailed, checkBrokenLinks, validateSchemaMarkup, validateSchemaMarkupDetailed } from "./seo-auditor.js";
|
|
4
4
|
import { type ValidationReport } from "./report.js";
|
|
5
5
|
import { readTextFile } from "./network.js";
|
|
6
|
-
import { validateCssContent, validateCssContentDetailed, validateHtmlContent, validateHtmlContentDetailed } from "./w3c-validator.js";
|
|
6
|
+
import { type HtmlCheckerMode, validateCssContent, validateCssContentDetailed, validateHtmlContent, validateHtmlContentDetailed } from "./w3c-validator.js";
|
|
7
7
|
export declare const SERVER_VERSION: string;
|
|
8
8
|
interface ValidationReportDependencies {
|
|
9
9
|
readTextFile: typeof readTextFile;
|
|
@@ -21,9 +21,10 @@ export interface GenerateValidationReportOptions {
|
|
|
21
21
|
htmlFilePath: string;
|
|
22
22
|
cssFilePath?: string;
|
|
23
23
|
baseUrl?: string;
|
|
24
|
+
htmlChecker?: HtmlCheckerMode;
|
|
24
25
|
}
|
|
25
26
|
/** Runs independent validation checks without discarding successful results when another check fails. */
|
|
26
|
-
export declare function generateValidationReport({ htmlFilePath, cssFilePath, baseUrl }: GenerateValidationReportOptions, dependencies?: ValidationReportDependencies): Promise<ValidationReport>;
|
|
27
|
+
export declare function generateValidationReport({ htmlFilePath, cssFilePath, baseUrl, htmlChecker }: GenerateValidationReportOptions, dependencies?: ValidationReportDependencies): Promise<ValidationReport>;
|
|
27
28
|
export declare function createServer(): McpServer;
|
|
28
29
|
export declare function run(): Promise<void>;
|
|
29
30
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
6
6
|
import { boundedMcpArray, boundedMcpIssues, boundedMcpReport } from "./mcp-bounds.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { load as loadCheerio } from "cheerio";
|
|
9
|
-
import { captureScreenshots, PartialScreenshotCaptureError } from "./screenshot.js";
|
|
9
|
+
import { captureScreenshots, defaultScreenshotBrowserRuntime, PartialScreenshotCaptureError } from "./screenshot.js";
|
|
10
10
|
import { reviewMediaHtml, emptyMediaDiagnostics, MAX_MEDIA_HTML_BYTES, MAX_MEDIA_ELEMENTS, MAX_MEDIA_FINDINGS, } from "./modules/browser-ux/media-diagnostics.js";
|
|
11
11
|
import { reviewWcagInteractions, emptyWcagReview, MAX_WCAG_HTML_BYTES, MAX_WCAG_CONTROLS, MAX_WCAG_TAB_STEPS, MAX_WCAG_FINDINGS, WCAG_FINDING_CODES, WCAG_EVIDENCE_TYPES, } from "./modules/browser-ux/wcag-interactions.js";
|
|
12
12
|
import { analyzeRawRendered, emptyRawRenderedReview, MAX_RENDER_HTML_BYTES, MAX_RENDER_FINDINGS, RENDER_FINDING_CODES, } from "./modules/browser-ux/raw-rendered-diff.js";
|
|
@@ -64,6 +64,7 @@ import { fetchOfficialGoogleCommonRanges } from "./modules/change-regression/goo
|
|
|
64
64
|
import { analyzeProductionChange, emptyProductionChangeReview, MAX_CHANGE_HTML_BYTES, MAX_CHANGE_FINDINGS, CHANGE_STATUSES, CHANGE_FINDING_CODES, } from "./modules/change-regression/production-change-comparison.js";
|
|
65
65
|
import { previewRegressionAlerts, emptyMonitorPreview, MONITOR_RULES, MONITOR_DECISIONS, MONITOR_STATUSES, MONITOR_REASON_CODES, } from "./modules/change-regression/regression-alerts.js";
|
|
66
66
|
import { getW3CMessageSeverity, MAX_CSS_VALIDATION_BYTES, validateCssContent, validateCssContentDetailed, validateHtmlContent, validateHtmlContentDetailed, } from "./w3c-validator.js";
|
|
67
|
+
import { lintCssLocally } from "./stylelint-validator.js";
|
|
67
68
|
export const SERVER_VERSION = PACKAGE_VERSION;
|
|
68
69
|
const HTML_MAX_BYTES = 2_000_000;
|
|
69
70
|
const CSS_MAX_BYTES = MAX_CSS_VALIDATION_BYTES;
|
|
@@ -553,6 +554,13 @@ const screenshotSchema = z.object({
|
|
|
553
554
|
height: z.number().int(),
|
|
554
555
|
outputPath: z.string(),
|
|
555
556
|
incompleteAssetCount: z.number().int().nonnegative().optional(),
|
|
557
|
+
visualDiff: z.object({
|
|
558
|
+
status: z.enum(["compared", "missing_baseline", "dimension_mismatch",
|
|
559
|
+
"over_budget", "incomplete_capture", "unavailable"]),
|
|
560
|
+
changed_pixels: z.number().int().nonnegative().optional(),
|
|
561
|
+
pixels_compared: z.number().int().nonnegative().optional(),
|
|
562
|
+
changed_percent: z.number().min(0).max(100).optional(),
|
|
563
|
+
}).optional(),
|
|
556
564
|
});
|
|
557
565
|
const viewportSummaryOutputSchema = z.object({
|
|
558
566
|
width: z.number().int().min(320).max(1_440),
|
|
@@ -929,6 +937,19 @@ const wcagReviewOutputSchema = {
|
|
|
929
937
|
message: z.string().max(320),
|
|
930
938
|
})).max(MAX_WCAG_FINDINGS),
|
|
931
939
|
findings_truncated: z.boolean(),
|
|
940
|
+
axe: z.object({
|
|
941
|
+
status: z.enum(["complete", "unavailable"]),
|
|
942
|
+
engine_version: z.string().optional(),
|
|
943
|
+
violations: z.number().int().nonnegative(),
|
|
944
|
+
incomplete: z.number().int().nonnegative(),
|
|
945
|
+
rules: z.array(z.object({
|
|
946
|
+
rule: z.string().max(60),
|
|
947
|
+
impact: z.enum(["minor", "moderate", "serious", "critical", "unknown"]),
|
|
948
|
+
nodes: z.number().int().nonnegative(),
|
|
949
|
+
})).max(12),
|
|
950
|
+
rules_truncated: z.boolean(),
|
|
951
|
+
coverage_limited: z.literal(true),
|
|
952
|
+
}).optional(),
|
|
932
953
|
error: z.string().optional(),
|
|
933
954
|
};
|
|
934
955
|
const mediaReviewOutputSchema = {
|
|
@@ -1695,7 +1716,7 @@ const validationReportDependencies = {
|
|
|
1695
1716
|
checkBrokenLinks,
|
|
1696
1717
|
};
|
|
1697
1718
|
/** Runs independent validation checks without discarding successful results when another check fails. */
|
|
1698
|
-
export async function generateValidationReport({ htmlFilePath, cssFilePath, baseUrl }, dependencies = validationReportDependencies) {
|
|
1719
|
+
export async function generateValidationReport({ htmlFilePath, cssFilePath, baseUrl, htmlChecker = "auto" }, dependencies = validationReportDependencies) {
|
|
1699
1720
|
const htmlMediaType = localHtmlValidationMediaType(htmlFilePath);
|
|
1700
1721
|
const html = await dependencies.readTextFile(htmlFilePath, HTML_MAX_BYTES, htmlMediaType);
|
|
1701
1722
|
const failedChecks = [];
|
|
@@ -1716,8 +1737,8 @@ export async function generateValidationReport({ htmlFilePath, cssFilePath, base
|
|
|
1716
1737
|
}
|
|
1717
1738
|
}
|
|
1718
1739
|
const htmlValidation = dependencies.validateHtmlContentDetailed
|
|
1719
|
-
? dependencies.validateHtmlContentDetailed(html, htmlMediaType)
|
|
1720
|
-
: dependencies.validateHtmlContent(html, htmlMediaType).then((messages) => {
|
|
1740
|
+
? dependencies.validateHtmlContentDetailed(html, htmlMediaType, htmlChecker)
|
|
1741
|
+
: dependencies.validateHtmlContent(html, htmlMediaType, htmlChecker).then((messages) => {
|
|
1721
1742
|
const counts = { error: 0, warning: 0, info: 0 };
|
|
1722
1743
|
for (const message of messages)
|
|
1723
1744
|
counts[getW3CMessageSeverity(message)] += 1;
|
|
@@ -1811,25 +1832,29 @@ export function createServer() {
|
|
|
1811
1832
|
});
|
|
1812
1833
|
server.registerTool("html.local", {
|
|
1813
1834
|
title: "Validate local HTML",
|
|
1814
|
-
description: "
|
|
1835
|
+
description: "Validates local HTML/XHTML through W3C Nu, or an explicitly configured loopback Nu checker. Auto mode uses local fallback only for remote transport/transient failures; local mode keeps markup on the machine.",
|
|
1815
1836
|
inputSchema: {
|
|
1816
1837
|
filePath: filePathSchema.describe("Absolute or workspace-relative path to an HTML or .xhtml file."),
|
|
1838
|
+
checker: z.enum(["auto", "remote", "local"]).default("auto")
|
|
1839
|
+
.describe("Default auto: W3C remote, optional configured local fallback. local: never sends file markup remotely."),
|
|
1817
1840
|
},
|
|
1818
1841
|
outputSchema: {
|
|
1819
1842
|
errors: z.array(w3cMessageSchema),
|
|
1820
1843
|
totalMessages: z.number().int().nonnegative(),
|
|
1821
1844
|
truncated: z.boolean(),
|
|
1845
|
+
checker: z.enum(["w3c_remote", "nu_local"]).optional(),
|
|
1822
1846
|
error: z.string().optional(),
|
|
1823
1847
|
},
|
|
1824
1848
|
annotations: externalReadOnlyAnnotations,
|
|
1825
|
-
}, async ({ filePath }) => {
|
|
1849
|
+
}, async ({ filePath, checker }) => {
|
|
1826
1850
|
try {
|
|
1827
1851
|
const htmlMediaType = localHtmlValidationMediaType(filePath);
|
|
1828
1852
|
const html = await readTextFile(filePath, HTML_MAX_BYTES, htmlMediaType);
|
|
1829
|
-
const validation = await validateHtmlContentDetailed(html, htmlMediaType);
|
|
1853
|
+
const validation = await validateHtmlContentDetailed(html, htmlMediaType, checker);
|
|
1830
1854
|
const messages = boundedMcpArray(validation.messages);
|
|
1831
1855
|
const truncated = validation.truncated || messages.length < validation.messages.length;
|
|
1832
|
-
return result({ errors: messages, totalMessages: validation.total, truncated
|
|
1856
|
+
return result({ errors: messages, totalMessages: validation.total, truncated,
|
|
1857
|
+
checker: validation.checker ?? "w3c_remote" }, htmlValidationContent(messages, undefined, validation.total, validation.counts));
|
|
1833
1858
|
}
|
|
1834
1859
|
catch (cause) {
|
|
1835
1860
|
const error = getErrorMessage(cause);
|
|
@@ -1841,16 +1866,19 @@ export function createServer() {
|
|
|
1841
1866
|
description: "Fetches a bounded public HTTP(S) page, then sends its markup to the W3C Nu HTML Checker. Private, reserved, credentialed, and nonstandard-port destinations are rejected.",
|
|
1842
1867
|
inputSchema: {
|
|
1843
1868
|
url: publicUrlSchema.describe("Public HTTP(S) URL on port 80 or 443."),
|
|
1869
|
+
checker: z.enum(["auto", "remote", "local"]).default("auto")
|
|
1870
|
+
.describe("Choose Nu remote, local loopback, or auto failover; URL retrieval is still public."),
|
|
1844
1871
|
},
|
|
1845
1872
|
outputSchema: {
|
|
1846
1873
|
errors: z.array(w3cMessageSchema),
|
|
1847
1874
|
totalMessages: z.number().int().nonnegative(),
|
|
1848
1875
|
truncated: z.boolean(),
|
|
1849
1876
|
fetchedUrl: z.string().optional(),
|
|
1877
|
+
checker: z.enum(["w3c_remote", "nu_local"]).optional(),
|
|
1850
1878
|
error: z.string().optional(),
|
|
1851
1879
|
},
|
|
1852
1880
|
annotations: externalReadOnlyAnnotations,
|
|
1853
|
-
}, async ({ url }) => {
|
|
1881
|
+
}, async ({ url, checker }) => {
|
|
1854
1882
|
try {
|
|
1855
1883
|
const fetched = await fetchPublicText(url, {
|
|
1856
1884
|
maxBytes: HTML_MAX_BYTES,
|
|
@@ -1871,7 +1899,7 @@ export function createServer() {
|
|
|
1871
1899
|
.toLowerCase() === "application/xhtml+xml"
|
|
1872
1900
|
? "application/xhtml+xml"
|
|
1873
1901
|
: "text/html";
|
|
1874
|
-
const validation = await validateHtmlContentDetailed(fetched.text, validationMediaType);
|
|
1902
|
+
const validation = await validateHtmlContentDetailed(fetched.text, validationMediaType, checker);
|
|
1875
1903
|
const messages = boundedMcpArray(validation.messages);
|
|
1876
1904
|
const truncated = validation.truncated || messages.length < validation.messages.length;
|
|
1877
1905
|
return result({
|
|
@@ -1879,6 +1907,7 @@ export function createServer() {
|
|
|
1879
1907
|
totalMessages: validation.total,
|
|
1880
1908
|
truncated,
|
|
1881
1909
|
fetchedUrl: fetched.url,
|
|
1910
|
+
checker: validation.checker ?? "w3c_remote",
|
|
1882
1911
|
}, htmlValidationContent(messages, fetched.url, validation.total, validation.counts));
|
|
1883
1912
|
}
|
|
1884
1913
|
catch (cause) {
|
|
@@ -1888,22 +1917,27 @@ export function createServer() {
|
|
|
1888
1917
|
});
|
|
1889
1918
|
server.registerTool("css.local", {
|
|
1890
1919
|
title: "Validate local CSS",
|
|
1891
|
-
description: "Reads
|
|
1920
|
+
description: "Reads local CSS and either sends it to W3C Jigsaw (default), or performs offline Stylelint quality checks. Local lint results are advisory and cannot certify W3C CSS validity.",
|
|
1892
1921
|
inputSchema: {
|
|
1893
1922
|
filePath: filePathSchema.describe("Absolute or workspace-relative path to a CSS file."),
|
|
1923
|
+
checker: z.enum(["w3c", "stylelint"]).default("w3c")
|
|
1924
|
+
.describe("Default W3C standards service; stylelint runs bounded local quality rules without network."),
|
|
1894
1925
|
},
|
|
1895
1926
|
outputSchema: {
|
|
1896
1927
|
errors: z.array(cssMessageSchema),
|
|
1897
1928
|
warnings: z.array(cssMessageSchema).optional(),
|
|
1898
1929
|
totalMessages: z.number().int().nonnegative(),
|
|
1899
1930
|
truncated: z.boolean(),
|
|
1931
|
+
checker: z.enum(["w3c_remote", "stylelint_local"]).optional(),
|
|
1900
1932
|
error: z.string().optional(),
|
|
1901
1933
|
},
|
|
1902
1934
|
annotations: externalReadOnlyAnnotations,
|
|
1903
|
-
}, async ({ filePath }) => {
|
|
1935
|
+
}, async ({ filePath, checker }) => {
|
|
1904
1936
|
try {
|
|
1905
1937
|
const css = await readTextFile(filePath, CSS_MAX_BYTES, "text/css");
|
|
1906
|
-
const validation =
|
|
1938
|
+
const validation = checker === "stylelint"
|
|
1939
|
+
? await lintCssLocally(css)
|
|
1940
|
+
: await validateCssContentDetailed(css);
|
|
1907
1941
|
const messages = boundedMcpArray(validation.messages);
|
|
1908
1942
|
const truncated = validation.truncated || messages.length < validation.messages.length;
|
|
1909
1943
|
return result({
|
|
@@ -1911,7 +1945,9 @@ export function createServer() {
|
|
|
1911
1945
|
warnings: messages.filter((message) => message.type.toLowerCase() === "warning"),
|
|
1912
1946
|
totalMessages: validation.total,
|
|
1913
1947
|
truncated,
|
|
1914
|
-
|
|
1948
|
+
checker: checker === "stylelint" ? "stylelint_local" : "w3c_remote",
|
|
1949
|
+
}, cssValidationContent(messages, validation.total, validation.counts)
|
|
1950
|
+
+ (checker === "stylelint" ? "\n\nOffline lint rules only; this does not establish W3C CSS conformance." : ""));
|
|
1915
1951
|
}
|
|
1916
1952
|
catch (cause) {
|
|
1917
1953
|
const error = getErrorMessage(cause);
|
|
@@ -2108,6 +2144,8 @@ export function createServer() {
|
|
|
2108
2144
|
description: "Combines W3C HTML/CSS validation, local SEO/accessibility checks, JSON-LD syntax checks, and a bounded public-link check into a Markdown and structured report.",
|
|
2109
2145
|
inputSchema: {
|
|
2110
2146
|
htmlFilePath: filePathSchema.describe("Absolute or workspace-relative HTML or .xhtml file path."),
|
|
2147
|
+
htmlChecker: z.enum(["auto", "remote", "local"]).default("auto")
|
|
2148
|
+
.describe("Auto W3C remote with optional local Nu fallback; local avoids uploading markup."),
|
|
2111
2149
|
cssFilePath: filePathSchema
|
|
2112
2150
|
.optional()
|
|
2113
2151
|
.describe("Optional absolute or workspace-relative CSS file path."),
|
|
@@ -2135,10 +2173,11 @@ export function createServer() {
|
|
|
2135
2173
|
errors: z.array(z.string()).optional(),
|
|
2136
2174
|
},
|
|
2137
2175
|
annotations: externalReadOnlyAnnotations,
|
|
2138
|
-
}, async ({ htmlFilePath, cssFilePath, baseUrl }) => {
|
|
2176
|
+
}, async ({ htmlFilePath, htmlChecker, cssFilePath, baseUrl }) => {
|
|
2139
2177
|
try {
|
|
2140
2178
|
const reportData = await generateValidationReport({
|
|
2141
2179
|
htmlFilePath,
|
|
2180
|
+
htmlChecker,
|
|
2142
2181
|
cssFilePath,
|
|
2143
2182
|
baseUrl,
|
|
2144
2183
|
});
|
|
@@ -2567,7 +2606,7 @@ export function createServer() {
|
|
|
2567
2606
|
});
|
|
2568
2607
|
server.registerTool("browser.wcag", {
|
|
2569
2608
|
title: "Review bounded rendered-DOM keyboard and WCAG interaction evidence",
|
|
2570
|
-
description: "Local-only inert Chromium
|
|
2609
|
+
description: "Local-only inert Chromium accessibility evidence: native keyboard focus, named controls and optional axe-core automated WCAG 2.2 rule scan (includeAxe=true). Author scripts and handlers stripped, all resources blocked, only trusted axe engine executes after inert rendering. Does not certify conformance or inspect full live site.",
|
|
2571
2610
|
inputSchema: {
|
|
2572
2611
|
htmlContent: z.string().min(1).max(MAX_WCAG_HTML_BYTES)
|
|
2573
2612
|
.refine((value) => Buffer.byteLength(value, "utf8") <= MAX_WCAG_HTML_BYTES, "Supplied HTML must be at most 180,000 UTF-8 bytes.")
|
|
@@ -2578,13 +2617,15 @@ export function createServer() {
|
|
|
2578
2617
|
.describe("Optional isolated viewport height in CSS pixels, 360–1080; defaults to 720."),
|
|
2579
2618
|
maxTabSteps: z.number().int().min(1).max(MAX_WCAG_TAB_STEPS).optional()
|
|
2580
2619
|
.describe("Maximum real browser Tab key samples (1–24), default 24; no click, form submission or network."),
|
|
2620
|
+
includeAxe: z.boolean().default(false)
|
|
2621
|
+
.describe("Optional local axe-core WCAG 2.2 automated rules; CPU-intensive and not a conformance certificate. No new network access."),
|
|
2581
2622
|
},
|
|
2582
2623
|
outputSchema: wcagReviewOutputSchema,
|
|
2583
2624
|
annotations: localReadOnlyAnnotations,
|
|
2584
|
-
}, async ({ htmlContent, viewportWidth, viewportHeight, maxTabSteps }) => {
|
|
2625
|
+
}, async ({ htmlContent, viewportWidth, viewportHeight, maxTabSteps, includeAxe }) => {
|
|
2585
2626
|
try {
|
|
2586
2627
|
const review = await reviewWcagInteractions(htmlContent, {
|
|
2587
|
-
viewportWidth, viewportHeight, maxTabSteps,
|
|
2628
|
+
viewportWidth, viewportHeight, maxTabSteps, includeAxe,
|
|
2588
2629
|
});
|
|
2589
2630
|
return result(review, wcagInteractionsContent(review));
|
|
2590
2631
|
}
|
|
@@ -2900,7 +2941,7 @@ export function createServer() {
|
|
|
2900
2941
|
});
|
|
2901
2942
|
server.registerTool("screenshot.capture", {
|
|
2902
2943
|
title: "Capture responsive screenshots",
|
|
2903
|
-
description: "Renders
|
|
2944
|
+
description: "Renders bounded, sandboxed responsive PNGs, with optional pixelmatch comparison against an existing separate baseline directory. Only numeric change metrics leave the comparator; missing, over-budget and asset-incomplete comparisons remain inconclusive.",
|
|
2904
2945
|
inputSchema: {
|
|
2905
2946
|
targetPath: z
|
|
2906
2947
|
.string()
|
|
@@ -2912,6 +2953,8 @@ export function createServer() {
|
|
|
2912
2953
|
.optional()
|
|
2913
2954
|
.default(".mcp-validator/screenshots")
|
|
2914
2955
|
.describe("Directory where PNG screenshots will be written."),
|
|
2956
|
+
baselineDir: filePathSchema.optional()
|
|
2957
|
+
.describe("Optional existing local folder with matching viewport PNG filenames; must differ from outputDir. No comparison images are saved."),
|
|
2915
2958
|
viewports: z
|
|
2916
2959
|
.array(z.object({
|
|
2917
2960
|
name: z
|
|
@@ -2947,16 +2990,26 @@ export function createServer() {
|
|
|
2947
2990
|
idempotentHint: true,
|
|
2948
2991
|
openWorldHint: true,
|
|
2949
2992
|
},
|
|
2950
|
-
}, async ({ targetPath, outputDir, viewports }) => {
|
|
2993
|
+
}, async ({ targetPath, outputDir, baselineDir, viewports }) => {
|
|
2951
2994
|
const outputDirectory = path.resolve(outputDir);
|
|
2952
2995
|
try {
|
|
2953
|
-
const screenshots = await captureScreenshots(targetPath, outputDirectory, viewports);
|
|
2996
|
+
const screenshots = await captureScreenshots(targetPath, outputDirectory, viewports, defaultScreenshotBrowserRuntime, baselineDir);
|
|
2954
2997
|
const affected = screenshots.filter((capture) => (capture.incompleteAssetCount ?? 0) > 0);
|
|
2998
|
+
const inconclusive = screenshots.filter((capture) => capture.visualDiff && capture.visualDiff.status !== "compared");
|
|
2999
|
+
if (inconclusive.length > 0) {
|
|
3000
|
+
const error = "Visual comparison was inconclusive for " + inconclusive.length
|
|
3001
|
+
+ " viewport(s); inspect missing/over-budget/asset-incomplete baselines. "
|
|
3002
|
+
+ "PNG captures were saved but no visual pass is claimed.";
|
|
3003
|
+
return result({ screenshots, outputDirectory, error }, screenshotPartialCaptureContent(screenshots.length, outputDirectory, error), true);
|
|
3004
|
+
}
|
|
2955
3005
|
if (affected.length > 0) {
|
|
2956
3006
|
const error = `${affected.length} screenshot viewport(s) have failed or blocked visual assets; files were saved but captures may be incomplete.`;
|
|
2957
3007
|
return result({ screenshots, outputDirectory, error }, screenshotPartialCaptureContent(screenshots.length, outputDirectory, error), true);
|
|
2958
3008
|
}
|
|
2959
|
-
return result({ screenshots, outputDirectory }, screenshotCaptureContent(screenshots.length, outputDirectory)
|
|
3009
|
+
return result({ screenshots, outputDirectory }, screenshotCaptureContent(screenshots.length, outputDirectory)
|
|
3010
|
+
+ (baselineDir ? "\n\nPixelmatch: " +
|
|
3011
|
+
screenshots.filter((capture) => (capture.visualDiff?.changed_pixels ?? 0) > 0).length
|
|
3012
|
+
+ " viewport(s) changed; differences require manual review." : ""));
|
|
2960
3013
|
}
|
|
2961
3014
|
catch (cause) {
|
|
2962
3015
|
const error = getErrorMessage(cause);
|