mcp-web-validator 1.3.50 → 1.3.51
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 +12 -0
- package/README.md +2 -0
- package/dist/index.js +27 -28
- package/dist/index.js.map +1 -1
- package/dist/mcp-bounds.d.ts +11 -0
- package/dist/mcp-bounds.js +68 -0
- package/dist/mcp-bounds.js.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project are documented here. The project follows [Se
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [1.3.51] - 2026-11-18
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Limit machine-readable HTML, CSS, link-check, and combined-report previews by serialized byte size so large valid diagnostics reach MCP gateways without oversized structured-content errors.
|
|
12
|
+
- Preserve exact W3C totals, link counts, report scores, and failure status when verbose details are shortened; expose `totalLinks` and `truncated` for link checks.
|
|
13
|
+
|
|
14
|
+
### Maintenance
|
|
15
|
+
|
|
16
|
+
- Reuse one byte-aware diagnostic boundary for local MCP tools rather than duplicating per-tool truncation logic.
|
|
17
|
+
- Add deterministic stress tests covering large combined reports and long blocked-link records.
|
|
18
|
+
|
|
7
19
|
## [1.3.50] - 2026-11-18
|
|
8
20
|
|
|
9
21
|
### Fixed
|
package/README.md
CHANGED
|
@@ -45,6 +45,8 @@ The validation, SEO, schema, link, and report tools do not download a browser du
|
|
|
45
45
|
|
|
46
46
|
## Tools
|
|
47
47
|
|
|
48
|
+
**Large results:** MCP structured diagnostic previews are bounded by serialized byte size. Exact totals and severity counts remain available, and `truncated` indicates omitted previews. `links.broken` also returns `totalLinks`. Extremely large `report.validation` results use a condensed Markdown summary instead of oversized tables; the score and check-status values still reflect the full audit.
|
|
49
|
+
|
|
48
50
|
The npm package exposes these exact runtime tool names:
|
|
49
51
|
|
|
50
52
|
| Tool | Purpose | Network or filesystem behavior |
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as path from "node:path";
|
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
import { boundedMcpArray, boundedMcpIssues, boundedMcpReport } from "./mcp-bounds.js";
|
|
6
7
|
import { z } from "zod";
|
|
7
8
|
import { captureScreenshots, PartialScreenshotCaptureError } from "./screenshot.js";
|
|
8
9
|
import { auditSeoMetadata, auditSeoMetadataDetailed, checkBrokenLinks, validateSchemaMarkup, validateSchemaMarkupDetailed, } from "./seo-auditor.js";
|
|
@@ -17,9 +18,6 @@ const HTML_MAX_BYTES = 2_000_000;
|
|
|
17
18
|
const CSS_MAX_BYTES = MAX_CSS_VALIDATION_BYTES;
|
|
18
19
|
const PATH_MAX_LENGTH = 4_096;
|
|
19
20
|
const MAX_VIEWPORTS = 8;
|
|
20
|
-
// Bound machine-readable diagnostic payloads for MCP gateways with smaller result limits.
|
|
21
|
-
// The original issue totals and severity counts remain exact when details are clipped.
|
|
22
|
-
const MAX_MCP_ISSUES_JSON_BYTES = 16_000;
|
|
23
21
|
function localHtmlValidationMediaType(filePath) {
|
|
24
22
|
const extension = path.extname(filePath).toLowerCase();
|
|
25
23
|
return extension === ".xhtml" || extension === ".xht"
|
|
@@ -108,20 +106,6 @@ const localReadOnlyAnnotations = {
|
|
|
108
106
|
idempotentHint: true,
|
|
109
107
|
openWorldHint: false,
|
|
110
108
|
};
|
|
111
|
-
function boundedMcpIssues(details) {
|
|
112
|
-
let bytes = 2; // JSON array brackets.
|
|
113
|
-
let count = 0;
|
|
114
|
-
for (const issue of details.issues) {
|
|
115
|
-
const increment = Buffer.byteLength(JSON.stringify(issue), "utf8") + (count > 0 ? 1 : 0);
|
|
116
|
-
if (bytes + increment > MAX_MCP_ISSUES_JSON_BYTES)
|
|
117
|
-
break;
|
|
118
|
-
bytes += increment;
|
|
119
|
-
count += 1;
|
|
120
|
-
}
|
|
121
|
-
if (count === details.issues.length)
|
|
122
|
-
return details;
|
|
123
|
-
return { ...details, issues: details.issues.slice(0, count), truncated: true };
|
|
124
|
-
}
|
|
125
109
|
function result(structuredContent, content, isError = false) {
|
|
126
110
|
return {
|
|
127
111
|
structuredContent: structuredContent,
|
|
@@ -317,7 +301,9 @@ export function createServer() {
|
|
|
317
301
|
const htmlMediaType = localHtmlValidationMediaType(filePath);
|
|
318
302
|
const html = await readTextFile(filePath, HTML_MAX_BYTES, htmlMediaType);
|
|
319
303
|
const validation = await validateHtmlContentDetailed(html, htmlMediaType);
|
|
320
|
-
|
|
304
|
+
const messages = boundedMcpArray(validation.messages);
|
|
305
|
+
const truncated = validation.truncated || messages.length < validation.messages.length;
|
|
306
|
+
return result({ errors: messages, totalMessages: validation.total, truncated }, htmlValidationContent(messages, undefined, validation.total, validation.counts));
|
|
321
307
|
}
|
|
322
308
|
catch (cause) {
|
|
323
309
|
const error = getErrorMessage(cause);
|
|
@@ -360,12 +346,14 @@ export function createServer() {
|
|
|
360
346
|
? "application/xhtml+xml"
|
|
361
347
|
: "text/html";
|
|
362
348
|
const validation = await validateHtmlContentDetailed(fetched.text, validationMediaType);
|
|
349
|
+
const messages = boundedMcpArray(validation.messages);
|
|
350
|
+
const truncated = validation.truncated || messages.length < validation.messages.length;
|
|
363
351
|
return result({
|
|
364
|
-
errors:
|
|
352
|
+
errors: messages,
|
|
365
353
|
totalMessages: validation.total,
|
|
366
|
-
truncated
|
|
354
|
+
truncated,
|
|
367
355
|
fetchedUrl: fetched.url,
|
|
368
|
-
}, htmlValidationContent(
|
|
356
|
+
}, htmlValidationContent(messages, fetched.url, validation.total, validation.counts));
|
|
369
357
|
}
|
|
370
358
|
catch (cause) {
|
|
371
359
|
const error = getErrorMessage(cause);
|
|
@@ -390,12 +378,14 @@ export function createServer() {
|
|
|
390
378
|
try {
|
|
391
379
|
const css = await readTextFile(filePath, CSS_MAX_BYTES, "text/css");
|
|
392
380
|
const validation = await validateCssContentDetailed(css);
|
|
381
|
+
const messages = boundedMcpArray(validation.messages);
|
|
382
|
+
const truncated = validation.truncated || messages.length < validation.messages.length;
|
|
393
383
|
return result({
|
|
394
|
-
errors:
|
|
395
|
-
warnings:
|
|
384
|
+
errors: messages.filter((message) => message.type.toLowerCase() !== "warning"),
|
|
385
|
+
warnings: messages.filter((message) => message.type.toLowerCase() === "warning"),
|
|
396
386
|
totalMessages: validation.total,
|
|
397
|
-
truncated
|
|
398
|
-
}, cssValidationContent(
|
|
387
|
+
truncated,
|
|
388
|
+
}, cssValidationContent(messages, validation.total, validation.counts));
|
|
399
389
|
}
|
|
400
390
|
catch (cause) {
|
|
401
391
|
const error = getErrorMessage(cause);
|
|
@@ -444,17 +434,22 @@ export function createServer() {
|
|
|
444
434
|
},
|
|
445
435
|
outputSchema: {
|
|
446
436
|
links: z.array(linkStatusSchema),
|
|
437
|
+
totalLinks: z.number().int().nonnegative(),
|
|
438
|
+
truncated: z.boolean(),
|
|
447
439
|
error: z.string().optional(),
|
|
448
440
|
},
|
|
449
441
|
annotations: externalReadOnlyAnnotations,
|
|
450
442
|
}, async ({ htmlContent, baseUrl, maxLinks }) => {
|
|
451
443
|
try {
|
|
452
444
|
const links = await checkBrokenLinks(htmlContent, baseUrl, maxLinks);
|
|
453
|
-
|
|
445
|
+
const preview = boundedMcpArray(links);
|
|
446
|
+
const truncated = preview.length < links.length;
|
|
447
|
+
return result({ links: preview, totalLinks: links.length, truncated }, linkCheckContent(links, baseUrl)
|
|
448
|
+
+ (truncated ? `\n\nOnly the first ${preview.length} of ${links.length} link records fit the MCP output budget; link-check counts include all results.` : ""));
|
|
454
449
|
}
|
|
455
450
|
catch (cause) {
|
|
456
451
|
const error = getErrorMessage(cause);
|
|
457
|
-
return result({ links: [], error }, failureContent("Link check", error, "Confirm the base URL is public and the supplied HTML is within the size limit, then retry."), true);
|
|
452
|
+
return result({ links: [], totalLinks: 0, truncated: false, error }, failureContent("Link check", error, "Confirm the base URL is public and the supplied HTML is within the size limit, then retry."), true);
|
|
458
453
|
}
|
|
459
454
|
});
|
|
460
455
|
server.registerTool("schema.markup", {
|
|
@@ -520,7 +515,11 @@ export function createServer() {
|
|
|
520
515
|
cssFilePath,
|
|
521
516
|
baseUrl,
|
|
522
517
|
});
|
|
523
|
-
|
|
518
|
+
const narrative = reportContent(reportData);
|
|
519
|
+
const bounded = boundedMcpReport(reportData, narrative);
|
|
520
|
+
return result(bounded, bounded === reportData
|
|
521
|
+
? narrative
|
|
522
|
+
: narrative + "\n\nVerbose report tables and structured previews were shortened for MCP transport; all summary scores and totals remain unchanged.");
|
|
524
523
|
}
|
|
525
524
|
catch (cause) {
|
|
526
525
|
const error = getErrorMessage(cause);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EAExB,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EAGtB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,gB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Ac,CACZ,oBAAoB,EACpB,KAAK,EACL,+FAA+F,CAChG,EACD,IAAI,CACL,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,GAAG;IACvB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;IACjD,OAAO,CAAC,KAAK,CAAC,qBAAqB,cAAc,mBAAmB,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACpG,IAAI,WAAW,KAAK,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC7B,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QACjF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["#!/usr/bin/env node\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\nimport { captureScreenshots, PartialScreenshotCaptureError } from \"./screenshot.js\";\nimport {\n auditSeoMetadata,\n auditSeoMetadataDetailed,\n type AuditDetails,\n checkBrokenLinks,\n validateSchemaMarkup,\n validateSchemaMarkupDetailed,\n} from \"./seo-auditor.js\";\nimport {\n createValidationReport,\n type ValidationReport,\n type ValidationReportCheck,\n validationReportChecks,\n} from \"./report.js\";\nimport { fetchPublicText, getErrorMessage, readTextFile } from \"./network.js\";\nimport {\n cssValidationContent,\n failureContent,\n htmlValidationContent,\n linkCheckContent,\n reportContent,\n schemaValidationContent,\n screenshotCaptureContent,\n screenshotPartialCaptureContent,\n seoAuditContent,\n} from \"./presentation.js\";\nimport { PACKAGE_VERSION } from \"./version.js\";\nimport {\n MAX_AUDIT_HISTORY,\n MAX_AUDIT_SNAPSHOT_BYTES,\n getAuditHistorySnapshot,\n listAuditHistory,\n saveAuditHistorySnapshot,\n} from \"./audit-history.js\";\nimport {\n getW3CMessageSeverity,\n type HtmlValidationMediaType,\n MAX_CSS_VALIDATION_BYTES,\n validateCssContent,\n validateCssContentDetailed,\n validateHtmlContent,\n validateHtmlContentDetailed,\n} from \"./w3c-validator.js\";\n\nexport const SERVER_VERSION = PACKAGE_VERSION;\n\nconst HTML_MAX_BYTES = 2_000_000;\nconst CSS_MAX_BYTES = MAX_CSS_VALIDATION_BYTES;\nconst PATH_MAX_LENGTH = 4_096;\nconst MAX_VIEWPORTS = 8;\n// Bound machine-readable diagnostic payloads for MCP gateways with smaller result limits.\n// The original issue totals and severity counts remain exact when details are clipped.\nconst MAX_MCP_ISSUES_JSON_BYTES = 16_000;\n\nfunction localHtmlValidationMediaType(filePath: string): HtmlValidationMediaType {\n const extension = path.extname(filePath).toLowerCase();\n return extension === \".xhtml\" || extension === \".xht\"\n ? \"application/xhtml+xml\"\n : \"text/html\";\n}\n\nconst filePathSchema = z.string().trim().min(1).max(PATH_MAX_LENGTH);\nconst htmlContentSchema = z.string().min(1).max(HTML_MAX_BYTES).refine(\n (value) => new TextEncoder().encode(value).byteLength <= HTML_MAX_BYTES,\n `HTML input must not exceed ${HTML_MAX_BYTES.toLocaleString(\"en-US\")} UTF-8 bytes.`,\n);\nconst publicUrlSchema = z\n .string()\n .url()\n .refine((value) => {\n const protocol = new URL(value).protocol;\n return protocol === \"http:\" || protocol === \"https:\";\n }, \"URL must use HTTP or HTTPS.\");\n\nconst w3cMessageSchema = z.object({\n type: z.string(),\n subType: z.string().optional(),\n message: z.string(),\n lastLine: z.number().int().optional(),\n lastColumn: z.number().int().optional(),\n firstLine: z.number().int().optional(),\n firstColumn: z.number().int().optional(),\n extract: z.string().optional(),\n});\n\nconst cssMessageSchema = z.object({\n line: z.number().int(),\n type: z.string(),\n message: z.string(),\n context: z.string().optional(),\n compatibility: z.literal(\"known-validator-limitation\").optional(),\n});\n\nconst seoIssueSchema = z.object({\n code: z.string().describe(\"Stable machine-readable audit rule identifier.\"),\n severity: z.enum([\"error\", \"warning\", \"info\"]),\n category: z.enum([\"SEO\", \"Schema\", \"BrokenLinks\", \"Accessibility\"]),\n message: z.string(),\n element: z.string().optional(),\n});\n\nconst auditCountsSchema = z.object({\n error: z.number().int().nonnegative(),\n warning: z.number().int().nonnegative(),\n info: z.number().int().nonnegative(),\n});\n\nconst linkStatusSchema = z.object({\n url: z.string(),\n status: z.union([z.number().int(), z.enum([\"blocked\", \"failed\"])]),\n ok: z.boolean(),\n message: z.string().optional(),\n});\n\nconst screenshotSchema = z.object({\n viewportName: z.string(),\n width: z.number().int(),\n height: z.number().int(),\n outputPath: z.string(),\n incompleteAssetCount: z.number().int().nonnegative().optional(),\n});\n\nconst reportSummarySchema = z.object({\n overallScore: z.number().int().min(0).max(100).nullable(),\n htmlScore: z.number().int().min(0).max(100).nullable(),\n cssScore: z.number().int().min(0).max(100).nullable(),\n seoScore: z.number().int().min(0).max(100).nullable(),\n linkScore: z.number().int().min(0).max(100).nullable(),\n htmlErrors: z.number().int().nonnegative(),\n htmlWarnings: z.number().int().nonnegative(),\n cssErrors: z.number().int().nonnegative(),\n cssWarnings: z.number().int().nonnegative().optional(),\n cssCompatibilityLimitations: z.number().int().nonnegative(),\n seoErrors: z.number().int().nonnegative(),\n seoWarnings: z.number().int().nonnegative(),\n schemaErrors: z.number().int().nonnegative(),\n linksChecked: z.number().int().nonnegative(),\n brokenLinks: z.number().int().nonnegative(),\n unverifiedLinks: z.number().int().nonnegative(),\n});\n\nconst externalReadOnlyAnnotations = {\n // These calls contact external recipients but do not modify external state.\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n} as const;\n\nconst localReadOnlyAnnotations = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\nfunction boundedMcpIssues(details: AuditDetails): AuditDetails {\n let bytes = 2; // JSON array brackets.\n let count = 0;\n for (const issue of details.issues) {\n const increment = Buffer.byteLength(JSON.stringify(issue), \"utf8\") + (count > 0 ? 1 : 0);\n if (bytes + increment > MAX_MCP_ISSUES_JSON_BYTES) break;\n bytes += increment;\n count += 1;\n }\n if (count === details.issues.length) return details;\n return { ...details, issues: details.issues.slice(0, count), truncated: true };\n}\n\nfunction result<T extends object>(\n structuredContent: T,\n content: string,\n isError = false,\n): CallToolResult {\n return {\n structuredContent: structuredContent as Record<string, unknown>,\n content: [\n {\n type: \"text\",\n text: content,\n },\n ],\n ...(isError ? { isError: true } : {}),\n };\n}\n\nfunction failedReport(filePath: string, error: string): ValidationReport {\n return {\n report: `Validation report could not be generated: ${error}`,\n summary: {\n overallScore: null,\n htmlScore: null,\n cssScore: null,\n seoScore: null,\n linkScore: null,\n htmlErrors: 0,\n htmlWarnings: 0,\n cssErrors: 0,\n cssWarnings: 0,\n cssCompatibilityLimitations: 0,\n seoErrors: 0,\n seoWarnings: 0,\n schemaErrors: 0,\n linksChecked: 0,\n brokenLinks: 0,\n unverifiedLinks: 0,\n },\n htmlMessages: [],\n htmlTotalMessages: 0,\n htmlTruncated: false,\n cssMessages: [],\n cssTotalMessages: 0,\n cssTruncated: false,\n seoIssues: [],\n seoTotalIssues: 0,\n seoTruncated: false,\n schemaIssues: [],\n schemaTotalIssues: 0,\n schemaTruncated: false,\n links: [],\n failedChecks: [\"input\"],\n errors: [`${path.basename(filePath || \"document\")}: ${error}`],\n };\n}\n\ninterface ValidationReportDependencies {\n readTextFile: typeof readTextFile;\n validateHtmlContent: typeof validateHtmlContent;\n validateHtmlContentDetailed?: typeof validateHtmlContentDetailed;\n validateCssContent: typeof validateCssContent;\n validateCssContentDetailed?: typeof validateCssContentDetailed;\n auditSeoMetadata: typeof auditSeoMetadata;\n auditSeoMetadataDetailed?: typeof auditSeoMetadataDetailed;\n validateSchemaMarkup: typeof validateSchemaMarkup;\n validateSchemaMarkupDetailed?: typeof validateSchemaMarkupDetailed;\n checkBrokenLinks: typeof checkBrokenLinks;\n}\n\nconst validationReportDependencies: ValidationReportDependencies = {\n readTextFile,\n validateHtmlContent,\n validateHtmlContentDetailed,\n validateCssContent,\n validateCssContentDetailed,\n auditSeoMetadata,\n auditSeoMetadataDetailed,\n validateSchemaMarkup,\n validateSchemaMarkupDetailed,\n checkBrokenLinks,\n};\n\nexport interface GenerateValidationReportOptions {\n htmlFilePath: string;\n cssFilePath?: string;\n baseUrl?: string;\n}\n\n/** Runs independent validation checks without discarding successful results when another check fails. */\nexport async function generateValidationReport(\n { htmlFilePath, cssFilePath, baseUrl }: GenerateValidationReportOptions,\n dependencies: ValidationReportDependencies = validationReportDependencies,\n): Promise<ValidationReport> {\n const htmlMediaType = localHtmlValidationMediaType(htmlFilePath);\n const html = await dependencies.readTextFile(htmlFilePath, HTML_MAX_BYTES, htmlMediaType);\n const failedChecks: ValidationReportCheck[] = [];\n const errors: string[] = [];\n const recordFailure = (check: ValidationReportCheck, label: string, cause: unknown): void => {\n if (!failedChecks.includes(check)) {\n failedChecks.push(check);\n }\n errors.push(`${label} was unavailable: ${getErrorMessage(cause)}`);\n };\n\n let css: string | undefined;\n if (cssFilePath) {\n try {\n css = await dependencies.readTextFile(cssFilePath, CSS_MAX_BYTES, \"text/css\");\n } catch (cause) {\n recordFailure(\"css\", \"CSS validation\", cause);\n }\n }\n\n const htmlValidation = dependencies.validateHtmlContentDetailed\n ? dependencies.validateHtmlContentDetailed(html, htmlMediaType)\n : dependencies.validateHtmlContent(html, htmlMediaType).then((messages) => {\n const counts = { error: 0, warning: 0, info: 0 };\n for (const message of messages) counts[getW3CMessageSeverity(message)] += 1;\n return { messages, total: messages.length, truncated: false, counts };\n });\n const cssValidation = css === undefined\n ? Promise.resolve({\n messages: [],\n total: 0,\n truncated: false,\n counts: { error: 0, warning: 0, compatibilityLimitation: 0 },\n })\n : dependencies.validateCssContentDetailed\n ? dependencies.validateCssContentDetailed(css)\n : dependencies.validateCssContent(css).then((messages) => {\n const compatibilityLimitation = messages.filter(\n (message) => message.compatibility === \"known-validator-limitation\",\n ).length;\n const warning = messages.filter((message) => message.type.toLowerCase() === \"warning\").length;\n return {\n messages,\n total: messages.length,\n truncated: false,\n counts: {\n error: messages.length - warning - compatibilityLimitation,\n warning,\n compatibilityLimitation,\n },\n };\n });\n const seoValidation = dependencies.auditSeoMetadataDetailed\n ? Promise.resolve().then(() => dependencies.auditSeoMetadataDetailed!(html))\n : Promise.resolve().then(() => {\n const issues = dependencies.auditSeoMetadata(html);\n const counts = { error: 0, warning: 0, info: 0 };\n for (const issue of issues) counts[issue.severity] += 1;\n return { issues, totalIssues: issues.length, truncated: false, counts };\n });\n const schemaValidation = dependencies.validateSchemaMarkupDetailed\n ? Promise.resolve().then(() => dependencies.validateSchemaMarkupDetailed!(html))\n : Promise.resolve().then(() => {\n const issues = dependencies.validateSchemaMarkup(html);\n const counts = { error: 0, warning: 0, info: 0 };\n for (const issue of issues) counts[issue.severity] += 1;\n return { issues, totalIssues: issues.length, truncated: false, counts };\n });\n const [htmlResult, cssResult, seoResult, schemaResult, linksResult] = await Promise.allSettled([\n htmlValidation,\n cssValidation,\n seoValidation,\n schemaValidation,\n dependencies.checkBrokenLinks(html, baseUrl, 25),\n ]);\n\n if (htmlResult.status === \"rejected\") recordFailure(\"html\", \"HTML validation\", htmlResult.reason);\n if (cssResult.status === \"rejected\") recordFailure(\"css\", \"CSS validation\", cssResult.reason);\n if (seoResult.status === \"rejected\") recordFailure(\"seo\", \"SEO analysis\", seoResult.reason);\n if (schemaResult.status === \"rejected\") recordFailure(\"schema\", \"JSON-LD analysis\", schemaResult.reason);\n if (linksResult.status === \"rejected\") recordFailure(\"links\", \"Link checking\", linksResult.reason);\n\n return createValidationReport({\n htmlFilePath,\n cssAudited: css !== undefined,\n htmlMessages: htmlResult.status === \"fulfilled\" ? htmlResult.value.messages : [],\n htmlTotalMessages: htmlResult.status === \"fulfilled\" ? htmlResult.value.total : 0,\n htmlTruncated: htmlResult.status === \"fulfilled\" ? htmlResult.value.truncated : false,\n htmlCounts: htmlResult.status === \"fulfilled\" ? htmlResult.value.counts : undefined,\n cssMessages: cssResult.status === \"fulfilled\" ? cssResult.value.messages : [],\n cssTotalMessages: cssResult.status === \"fulfilled\" ? cssResult.value.total : 0,\n cssTruncated: cssResult.status === \"fulfilled\" ? cssResult.value.truncated : false,\n cssCounts: cssResult.status === \"fulfilled\" ? cssResult.value.counts : undefined,\n seoIssues: seoResult.status === \"fulfilled\" ? seoResult.value.issues : [],\n seoTotalIssues: seoResult.status === \"fulfilled\" ? seoResult.value.totalIssues : 0,\n seoTruncated: seoResult.status === \"fulfilled\" ? seoResult.value.truncated : false,\n seoCounts: seoResult.status === \"fulfilled\" ? seoResult.value.counts : undefined,\n schemaIssues: schemaResult.status === \"fulfilled\" ? schemaResult.value.issues : [],\n schemaTotalIssues: schemaResult.status === \"fulfilled\" ? schemaResult.value.totalIssues : 0,\n schemaTruncated: schemaResult.status === \"fulfilled\" ? schemaResult.value.truncated : false,\n schemaCounts: schemaResult.status === \"fulfilled\" ? schemaResult.value.counts : undefined,\n links: linksResult.status === \"fulfilled\" ? linksResult.value : [],\n failedChecks,\n errors,\n });\n}\n\nexport function createServer(): McpServer {\n const server = new McpServer(\n { name: \"mcp-web-validator\", version: SERVER_VERSION },\n {\n instructions:\n \"Validate only files, markup, and public URLs the user owns or is authorized to inspect. HTML and CSS validation send supplied content to W3C-operated validators. Link checks contact public links without following redirects. Screenshot capture executes page content in a sandboxed local browser and writes PNG files.\",\n },\n );\n\n server.registerTool(\n \"html.local\",\n {\n title: \"Validate local HTML\",\n description:\n \"Reads a bounded local HTML or .xhtml file and sends its markup to the W3C Nu HTML Checker. .xhtml files use application/xhtml+xml parsing semantics. Use only files the user is authorized to share.\",\n inputSchema: {\n filePath: filePathSchema.describe(\"Absolute or workspace-relative path to an HTML or .xhtml file.\"),\n },\n outputSchema: {\n errors: z.array(w3cMessageSchema),\n totalMessages: z.number().int().nonnegative(),\n truncated: z.boolean(),\n error: z.string().optional(),\n },\n annotations: externalReadOnlyAnnotations,\n },\n async ({ filePath }) => {\n try {\n const htmlMediaType = localHtmlValidationMediaType(filePath);\n const html = await readTextFile(filePath, HTML_MAX_BYTES, htmlMediaType);\n const validation = await validateHtmlContentDetailed(\n html,\n htmlMediaType,\n );\n return result(\n { errors: validation.messages, totalMessages: validation.total, truncated: validation.truncated },\n htmlValidationContent(validation.messages, undefined, validation.total, validation.counts),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { errors: [], totalMessages: 0, truncated: false, error },\n failureContent(\n \"HTML validation\",\n error,\n \"Confirm the file exists and is readable, then retry. If the W3C service is unavailable, try again later.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"html.url\",\n {\n title: \"Validate a public URL\",\n description:\n \"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.\",\n inputSchema: {\n url: publicUrlSchema.describe(\"Public HTTP(S) URL on port 80 or 443.\"),\n },\n outputSchema: {\n errors: z.array(w3cMessageSchema),\n totalMessages: z.number().int().nonnegative(),\n truncated: z.boolean(),\n fetchedUrl: z.string().optional(),\n error: z.string().optional(),\n },\n annotations: externalReadOnlyAnnotations,\n },\n async ({ url }) => {\n try {\n const fetched = await fetchPublicText(url, {\n maxBytes: HTML_MAX_BYTES,\n timeoutMs: 15_000,\n maxRedirects: 3,\n acceptedContentTypes: [\"text/html\", \"application/xhtml+xml\"],\n headers: {\n accept: \"text/html,application/xhtml+xml;q=0.9\",\n \"user-agent\": `DigestSEO-Web-Validator/${SERVER_VERSION} (+https://digestseo.com/validator-mcp/)`,\n },\n });\n if (fetched.status < 200 || fetched.status >= 300) {\n throw new Error(`Target URL returned HTTP ${fetched.status}.`);\n }\n const validationMediaType = fetched.contentType\n ?.split(\";\", 1)[0]\n .trim()\n .toLowerCase() === \"application/xhtml+xml\"\n ? \"application/xhtml+xml\"\n : \"text/html\";\n const validation = await validateHtmlContentDetailed(fetched.text, validationMediaType);\n return result(\n {\n errors: validation.messages,\n totalMessages: validation.total,\n truncated: validation.truncated,\n fetchedUrl: fetched.url,\n },\n htmlValidationContent(validation.messages, fetched.url, validation.total, validation.counts),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { errors: [], totalMessages: 0, truncated: false, error },\n failureContent(\n \"URL validation\",\n error,\n \"Confirm the URL is public, uses HTTP or HTTPS on a standard port, and returns HTML, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"css.local\",\n {\n title: \"Validate local CSS\",\n description:\n \"Reads a bounded local CSS file and sends it to the W3C Jigsaw CSS Validator. Use only files the user is authorized to share.\",\n inputSchema: {\n filePath: filePathSchema.describe(\"Absolute or workspace-relative path to a CSS file.\"),\n },\n outputSchema: {\n errors: z.array(cssMessageSchema),\n warnings: z.array(cssMessageSchema).optional(),\n totalMessages: z.number().int().nonnegative(),\n truncated: z.boolean(),\n error: z.string().optional(),\n },\n annotations: externalReadOnlyAnnotations,\n },\n async ({ filePath }) => {\n try {\n const css = await readTextFile(filePath, CSS_MAX_BYTES, \"text/css\");\n const validation = await validateCssContentDetailed(css);\n return result(\n {\n errors: validation.messages.filter((message) => message.type.toLowerCase() !== \"warning\"),\n warnings: validation.messages.filter((message) => message.type.toLowerCase() === \"warning\"),\n totalMessages: validation.total,\n truncated: validation.truncated,\n },\n cssValidationContent(validation.messages, validation.total, validation.counts),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { errors: [], warnings: [], totalMessages: 0, truncated: false, error },\n failureContent(\n \"CSS validation\",\n error,\n \"Confirm the file exists, is readable, and is within the size limit, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"seo.metadata\",\n {\n title: \"Audit SEO metadata\",\n description:\n \"Audits supplied HTML offline for on-page SEO metadata, headings, viewport, image alternatives, and Open Graph issues. Use for a quick on-page check; use html.local/html.url for W3C HTML validation, schema.markup for JSON-LD syntax, or report.validation for a combined local-file report.\",\n inputSchema: {\n htmlContent: htmlContentSchema.describe(\"Raw HTML markup to inspect locally.\"),\n },\n outputSchema: {\n issues: z.array(seoIssueSchema),\n totalIssues: z.number().int().nonnegative(),\n truncated: z.boolean(),\n counts: auditCountsSchema,\n error: z.string().optional(),\n },\n annotations: localReadOnlyAnnotations,\n },\n async ({ htmlContent }) => {\n try {\n const { issues, totalIssues, truncated, counts } = boundedMcpIssues(auditSeoMetadataDetailed(htmlContent));\n return result(\n { issues, totalIssues, truncated, counts },\n seoAuditContent(issues, totalIssues, truncated, counts),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { issues: [], totalIssues: 0, truncated: false, counts: { error: 0, warning: 0, info: 0 }, error },\n failureContent(\n \"SEO audit\",\n error,\n \"Confirm the supplied HTML is complete and within the size limit, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"links.broken\",\n {\n title: \"Check public links\",\n description:\n \"Resolves and checks up to 25 public HTTP(S) links in supplied HTML. Redirects are reported but not followed, and response bodies are discarded.\",\n inputSchema: {\n htmlContent: htmlContentSchema.describe(\"Raw HTML markup containing links to check.\"),\n baseUrl: publicUrlSchema\n .optional()\n .describe(\"Optional public HTTP(S) base URL used to resolve relative links.\"),\n maxLinks: z\n .number()\n .int()\n .min(1)\n .max(25)\n .default(25)\n .describe(\"Maximum number of public HTTP(S) links to check, from 1 to 25.\"),\n },\n outputSchema: {\n links: z.array(linkStatusSchema),\n error: z.string().optional(),\n },\n annotations: externalReadOnlyAnnotations,\n },\n async ({ htmlContent, baseUrl, maxLinks }) => {\n try {\n const links = await checkBrokenLinks(htmlContent, baseUrl, maxLinks);\n return result({ links }, linkCheckContent(links, baseUrl));\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { links: [], error },\n failureContent(\n \"Link check\",\n error,\n \"Confirm the base URL is public and the supplied HTML is within the size limit, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"schema.markup\",\n {\n title: \"Validate JSON-LD syntax\",\n description:\n \"Parses JSON-LD blocks in supplied HTML locally and reports empty blocks or JSON syntax errors. It does not validate vocabulary semantics.\",\n inputSchema: {\n htmlContent: htmlContentSchema.describe(\"Raw HTML containing JSON-LD script blocks.\"),\n },\n outputSchema: {\n issues: z.array(seoIssueSchema),\n totalIssues: z.number().int().nonnegative(),\n truncated: z.boolean(),\n counts: auditCountsSchema,\n error: z.string().optional(),\n },\n annotations: localReadOnlyAnnotations,\n },\n async ({ htmlContent }) => {\n try {\n const { issues, totalIssues, truncated, counts } = boundedMcpIssues(validateSchemaMarkupDetailed(htmlContent));\n return result(\n { issues, totalIssues, truncated, counts },\n schemaValidationContent(issues, totalIssues, truncated, htmlContent),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { issues: [], totalIssues: 0, truncated: false, counts: { error: 0, warning: 0, info: 0 }, error },\n failureContent(\n \"JSON-LD syntax\",\n error,\n \"Confirm the supplied HTML is complete and within the size limit, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"report.validation\",\n {\n title: \"Generate a validation report\",\n description:\n \"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.\",\n inputSchema: {\n htmlFilePath: filePathSchema.describe(\"Absolute or workspace-relative HTML or .xhtml file path.\"),\n cssFilePath: filePathSchema\n .optional()\n .describe(\"Optional absolute or workspace-relative CSS file path.\"),\n baseUrl: publicUrlSchema\n .optional()\n .describe(\"Optional public HTTP(S) base URL used to resolve relative links.\"),\n },\n outputSchema: {\n report: z.string(),\n summary: reportSummarySchema,\n htmlMessages: z.array(w3cMessageSchema),\n htmlTotalMessages: z.number().int().nonnegative(),\n htmlTruncated: z.boolean(),\n cssMessages: z.array(cssMessageSchema),\n cssTotalMessages: z.number().int().nonnegative(),\n cssTruncated: z.boolean(),\n seoIssues: z.array(seoIssueSchema),\n seoTotalIssues: z.number().int().nonnegative(),\n seoTruncated: z.boolean(),\n schemaIssues: z.array(seoIssueSchema),\n schemaTotalIssues: z.number().int().nonnegative(),\n schemaTruncated: z.boolean(),\n links: z.array(linkStatusSchema),\n failedChecks: z.array(z.enum(validationReportChecks)),\n errors: z.array(z.string()).optional(),\n },\n annotations: externalReadOnlyAnnotations,\n },\n async ({ htmlFilePath, cssFilePath, baseUrl }) => {\n try {\n const reportData = await generateValidationReport({\n htmlFilePath,\n cssFilePath,\n baseUrl,\n });\n return result(reportData, reportContent(reportData));\n } catch (cause) {\n const error = getErrorMessage(cause);\n const reportData = failedReport(htmlFilePath, error);\n return result(\n reportData,\n failureContent(\n \"Validation report\",\n error,\n \"Confirm the input paths are readable and any base URL is public, then regenerate the report.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"audit.history\",\n {\n title: \"Manage local audit history\",\n description:\n \"Opt-in local-only site-audit snapshot history. Save a previous hosted audit_public_site structured result as JSON, list saved IDs, or retrieve an exact version. A single compact local JSON file retains at most 10 versions; saving the 11th removes the oldest. No database, background task, or network request.\",\n inputSchema: {\n action: z.enum([\"save\", \"list\", \"get\"]).describe(\"Save a snapshot, list versions, or retrieve one by ID.\"),\n snapshotJson: z.string().min(1).max(MAX_AUDIT_SNAPSHOT_BYTES).optional()\n .describe(\"For save: JSON-serialized structuredContent from hosted audit_public_site, max 60 KB. Raw HTML is not stored.\"),\n id: z.string().uuid().optional().describe(\"For get: saved version ID returned by list or save.\"),\n },\n outputSchema: {\n count: z.number().int().nonnegative(),\n items: z.array(z.object({\n id: z.string().uuid(),\n saved_at: z.string(),\n site_url: z.string(),\n })).max(MAX_AUDIT_HISTORY),\n snapshot_json: z.string().optional(),\n evicted_id: z.string().uuid().optional(),\n error: z.string().optional(),\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: false,\n },\n },\n async ({ action, snapshotJson, id }) => {\n try {\n if (action === \"save\") {\n if (!snapshotJson) throw new Error(\"snapshotJson is required when action is save.\");\n const saved = await saveAuditHistorySnapshot(snapshotJson);\n return result(saved, `Audit version saved locally. ${saved.count}/10 versions retained.${saved.evicted_id ? \" Oldest version automatically deleted.\" : \"\"} Latest ID: ${saved.items[0]?.id}`);\n }\n if (action === \"get\") {\n if (!id) throw new Error(\"id is required when action is get.\");\n const found = await getAuditHistorySnapshot(id);\n return result(found, `Retrieved audit history version ${id}. Use snapshot_json as a baseline or current result for compare_site_audits.`);\n }\n const listed = await listAuditHistory();\n return result(listed, `Found ${listed.count} locally saved audit versions, newest first.`);\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { count: 0, items: [], error },\n failureContent(\"Audit history\", error, \"Review snapshot JSON or local history file permissions and retry.\"),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"screenshot.capture\",\n {\n title: \"Capture responsive screenshots\",\n description:\n \"Renders a local HTML file or HTTP(S) URL in a sandboxed local Chromium browser and writes PNG screenshots to the requested directory. Downloads the pinned headless browser on first use if it is not already cached. Existing matching files may be replaced. Completed PNG paths are included if a later viewport fails.\",\n inputSchema: {\n targetPath: z\n .string()\n .trim()\n .min(1)\n .max(PATH_MAX_LENGTH)\n .describe(\"Local HTML path or HTTP(S) URL to render.\"),\n outputDir: filePathSchema\n .optional()\n .default(\".mcp-validator/screenshots\")\n .describe(\"Directory where PNG screenshots will be written.\"),\n viewports: z\n .array(\n z.object({\n name: z\n .string()\n .regex(/^[A-Za-z0-9_-]{1,50}$/)\n .describe(\"Safe filename label for this screenshot viewport.\"),\n width: z\n .number()\n .int()\n .min(200)\n .max(3_840)\n .describe(\"Viewport width in CSS pixels, from 200 to 3840.\"),\n height: z\n .number()\n .int()\n .min(200)\n .max(4_320)\n .describe(\"Viewport height in CSS pixels, from 200 to 4320.\"),\n }),\n )\n .min(1)\n .max(MAX_VIEWPORTS)\n .optional()\n .describe(\"Optional viewport definitions; defaults to desktop, tablet, and mobile sizes.\"),\n },\n outputSchema: {\n screenshots: z.array(screenshotSchema),\n outputDirectory: z.string(),\n error: z.string().optional(),\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: true,\n openWorldHint: true,\n },\n },\n async ({ targetPath, outputDir, viewports }) => {\n const outputDirectory = path.resolve(outputDir);\n try {\n const screenshots = await captureScreenshots(targetPath, outputDirectory, viewports);\n const affected = screenshots.filter((capture) => (capture.incompleteAssetCount ?? 0) > 0);\n if (affected.length > 0) {\n const error = `${affected.length} screenshot viewport(s) have failed or blocked visual assets; files were saved but captures may be incomplete.`;\n return result(\n { screenshots, outputDirectory, error },\n screenshotPartialCaptureContent(screenshots.length, outputDirectory, error),\n true,\n );\n }\n return result(\n { screenshots, outputDirectory },\n screenshotCaptureContent(screenshots.length, outputDirectory),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n if (cause instanceof PartialScreenshotCaptureError) {\n return result(\n { screenshots: cause.screenshots, outputDirectory, error },\n screenshotPartialCaptureContent(cause.screenshots.length, outputDirectory, error),\n true,\n );\n }\n return result(\n { screenshots: [], outputDirectory, error },\n failureContent(\n \"Screenshot capture\",\n error,\n \"Confirm the target is reachable or readable and the output directory is writable, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n return server;\n}\n\nexport async function run(): Promise<void> {\n const server = createServer();\n await server.connect(new StdioServerTransport());\n console.error(`mcp-web-validator ${SERVER_VERSION} started on stdio`);\n}\n\nconst invokedPath = process.argv[1] ? pathToFileURL(path.resolve(process.argv[1])).href : undefined;\nif (invokedPath === import.meta.url) {\n run().catch((cause: unknown) => {\n console.error(\"Fatal error starting mcp-web-validator:\", getErrorMessage(cause));\n process.exitCode = 1;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EAGtB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACxB,+BAA+B,EAC/B,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EAErB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,EACnB,2BAA2B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C;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,GAAG;IACvB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;IACjD,OAAO,CAAC,KAAK,CAAC,qBAAqB,cAAc,mBAAmB,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACpG,IAAI,WAAW,KAAK,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC7B,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QACjF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["#!/usr/bin/env node\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { boundedMcpArray, boundedMcpIssues, boundedMcpReport } from \"./mcp-bounds.js\";\nimport { z } from \"zod\";\nimport { captureScreenshots, PartialScreenshotCaptureError } from \"./screenshot.js\";\nimport {\n auditSeoMetadata,\n auditSeoMetadataDetailed,\n checkBrokenLinks,\n validateSchemaMarkup,\n validateSchemaMarkupDetailed,\n} from \"./seo-auditor.js\";\nimport {\n createValidationReport,\n type ValidationReport,\n type ValidationReportCheck,\n validationReportChecks,\n} from \"./report.js\";\nimport { fetchPublicText, getErrorMessage, readTextFile } from \"./network.js\";\nimport {\n cssValidationContent,\n failureContent,\n htmlValidationContent,\n linkCheckContent,\n reportContent,\n schemaValidationContent,\n screenshotCaptureContent,\n screenshotPartialCaptureContent,\n seoAuditContent,\n} from \"./presentation.js\";\nimport { PACKAGE_VERSION } from \"./version.js\";\nimport {\n MAX_AUDIT_HISTORY,\n MAX_AUDIT_SNAPSHOT_BYTES,\n getAuditHistorySnapshot,\n listAuditHistory,\n saveAuditHistorySnapshot,\n} from \"./audit-history.js\";\nimport {\n getW3CMessageSeverity,\n type HtmlValidationMediaType,\n MAX_CSS_VALIDATION_BYTES,\n validateCssContent,\n validateCssContentDetailed,\n validateHtmlContent,\n validateHtmlContentDetailed,\n} from \"./w3c-validator.js\";\n\nexport const SERVER_VERSION = PACKAGE_VERSION;\n\nconst HTML_MAX_BYTES = 2_000_000;\nconst CSS_MAX_BYTES = MAX_CSS_VALIDATION_BYTES;\nconst PATH_MAX_LENGTH = 4_096;\nconst MAX_VIEWPORTS = 8;\n\nfunction localHtmlValidationMediaType(filePath: string): HtmlValidationMediaType {\n const extension = path.extname(filePath).toLowerCase();\n return extension === \".xhtml\" || extension === \".xht\"\n ? \"application/xhtml+xml\"\n : \"text/html\";\n}\n\nconst filePathSchema = z.string().trim().min(1).max(PATH_MAX_LENGTH);\nconst htmlContentSchema = z.string().min(1).max(HTML_MAX_BYTES).refine(\n (value) => new TextEncoder().encode(value).byteLength <= HTML_MAX_BYTES,\n `HTML input must not exceed ${HTML_MAX_BYTES.toLocaleString(\"en-US\")} UTF-8 bytes.`,\n);\nconst publicUrlSchema = z\n .string()\n .url()\n .refine((value) => {\n const protocol = new URL(value).protocol;\n return protocol === \"http:\" || protocol === \"https:\";\n }, \"URL must use HTTP or HTTPS.\");\n\nconst w3cMessageSchema = z.object({\n type: z.string(),\n subType: z.string().optional(),\n message: z.string(),\n lastLine: z.number().int().optional(),\n lastColumn: z.number().int().optional(),\n firstLine: z.number().int().optional(),\n firstColumn: z.number().int().optional(),\n extract: z.string().optional(),\n});\n\nconst cssMessageSchema = z.object({\n line: z.number().int(),\n type: z.string(),\n message: z.string(),\n context: z.string().optional(),\n compatibility: z.literal(\"known-validator-limitation\").optional(),\n});\n\nconst seoIssueSchema = z.object({\n code: z.string().describe(\"Stable machine-readable audit rule identifier.\"),\n severity: z.enum([\"error\", \"warning\", \"info\"]),\n category: z.enum([\"SEO\", \"Schema\", \"BrokenLinks\", \"Accessibility\"]),\n message: z.string(),\n element: z.string().optional(),\n});\n\nconst auditCountsSchema = z.object({\n error: z.number().int().nonnegative(),\n warning: z.number().int().nonnegative(),\n info: z.number().int().nonnegative(),\n});\n\nconst linkStatusSchema = z.object({\n url: z.string(),\n status: z.union([z.number().int(), z.enum([\"blocked\", \"failed\"])]),\n ok: z.boolean(),\n message: z.string().optional(),\n});\n\nconst screenshotSchema = z.object({\n viewportName: z.string(),\n width: z.number().int(),\n height: z.number().int(),\n outputPath: z.string(),\n incompleteAssetCount: z.number().int().nonnegative().optional(),\n});\n\nconst reportSummarySchema = z.object({\n overallScore: z.number().int().min(0).max(100).nullable(),\n htmlScore: z.number().int().min(0).max(100).nullable(),\n cssScore: z.number().int().min(0).max(100).nullable(),\n seoScore: z.number().int().min(0).max(100).nullable(),\n linkScore: z.number().int().min(0).max(100).nullable(),\n htmlErrors: z.number().int().nonnegative(),\n htmlWarnings: z.number().int().nonnegative(),\n cssErrors: z.number().int().nonnegative(),\n cssWarnings: z.number().int().nonnegative().optional(),\n cssCompatibilityLimitations: z.number().int().nonnegative(),\n seoErrors: z.number().int().nonnegative(),\n seoWarnings: z.number().int().nonnegative(),\n schemaErrors: z.number().int().nonnegative(),\n linksChecked: z.number().int().nonnegative(),\n brokenLinks: z.number().int().nonnegative(),\n unverifiedLinks: z.number().int().nonnegative(),\n});\n\nconst externalReadOnlyAnnotations = {\n // These calls contact external recipients but do not modify external state.\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n} as const;\n\nconst localReadOnlyAnnotations = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\nfunction result<T extends object>(\n structuredContent: T,\n content: string,\n isError = false,\n): CallToolResult {\n return {\n structuredContent: structuredContent as Record<string, unknown>,\n content: [\n {\n type: \"text\",\n text: content,\n },\n ],\n ...(isError ? { isError: true } : {}),\n };\n}\n\nfunction failedReport(filePath: string, error: string): ValidationReport {\n return {\n report: `Validation report could not be generated: ${error}`,\n summary: {\n overallScore: null,\n htmlScore: null,\n cssScore: null,\n seoScore: null,\n linkScore: null,\n htmlErrors: 0,\n htmlWarnings: 0,\n cssErrors: 0,\n cssWarnings: 0,\n cssCompatibilityLimitations: 0,\n seoErrors: 0,\n seoWarnings: 0,\n schemaErrors: 0,\n linksChecked: 0,\n brokenLinks: 0,\n unverifiedLinks: 0,\n },\n htmlMessages: [],\n htmlTotalMessages: 0,\n htmlTruncated: false,\n cssMessages: [],\n cssTotalMessages: 0,\n cssTruncated: false,\n seoIssues: [],\n seoTotalIssues: 0,\n seoTruncated: false,\n schemaIssues: [],\n schemaTotalIssues: 0,\n schemaTruncated: false,\n links: [],\n failedChecks: [\"input\"],\n errors: [`${path.basename(filePath || \"document\")}: ${error}`],\n };\n}\n\ninterface ValidationReportDependencies {\n readTextFile: typeof readTextFile;\n validateHtmlContent: typeof validateHtmlContent;\n validateHtmlContentDetailed?: typeof validateHtmlContentDetailed;\n validateCssContent: typeof validateCssContent;\n validateCssContentDetailed?: typeof validateCssContentDetailed;\n auditSeoMetadata: typeof auditSeoMetadata;\n auditSeoMetadataDetailed?: typeof auditSeoMetadataDetailed;\n validateSchemaMarkup: typeof validateSchemaMarkup;\n validateSchemaMarkupDetailed?: typeof validateSchemaMarkupDetailed;\n checkBrokenLinks: typeof checkBrokenLinks;\n}\n\nconst validationReportDependencies: ValidationReportDependencies = {\n readTextFile,\n validateHtmlContent,\n validateHtmlContentDetailed,\n validateCssContent,\n validateCssContentDetailed,\n auditSeoMetadata,\n auditSeoMetadataDetailed,\n validateSchemaMarkup,\n validateSchemaMarkupDetailed,\n checkBrokenLinks,\n};\n\nexport interface GenerateValidationReportOptions {\n htmlFilePath: string;\n cssFilePath?: string;\n baseUrl?: string;\n}\n\n/** Runs independent validation checks without discarding successful results when another check fails. */\nexport async function generateValidationReport(\n { htmlFilePath, cssFilePath, baseUrl }: GenerateValidationReportOptions,\n dependencies: ValidationReportDependencies = validationReportDependencies,\n): Promise<ValidationReport> {\n const htmlMediaType = localHtmlValidationMediaType(htmlFilePath);\n const html = await dependencies.readTextFile(htmlFilePath, HTML_MAX_BYTES, htmlMediaType);\n const failedChecks: ValidationReportCheck[] = [];\n const errors: string[] = [];\n const recordFailure = (check: ValidationReportCheck, label: string, cause: unknown): void => {\n if (!failedChecks.includes(check)) {\n failedChecks.push(check);\n }\n errors.push(`${label} was unavailable: ${getErrorMessage(cause)}`);\n };\n\n let css: string | undefined;\n if (cssFilePath) {\n try {\n css = await dependencies.readTextFile(cssFilePath, CSS_MAX_BYTES, \"text/css\");\n } catch (cause) {\n recordFailure(\"css\", \"CSS validation\", cause);\n }\n }\n\n const htmlValidation = dependencies.validateHtmlContentDetailed\n ? dependencies.validateHtmlContentDetailed(html, htmlMediaType)\n : dependencies.validateHtmlContent(html, htmlMediaType).then((messages) => {\n const counts = { error: 0, warning: 0, info: 0 };\n for (const message of messages) counts[getW3CMessageSeverity(message)] += 1;\n return { messages, total: messages.length, truncated: false, counts };\n });\n const cssValidation = css === undefined\n ? Promise.resolve({\n messages: [],\n total: 0,\n truncated: false,\n counts: { error: 0, warning: 0, compatibilityLimitation: 0 },\n })\n : dependencies.validateCssContentDetailed\n ? dependencies.validateCssContentDetailed(css)\n : dependencies.validateCssContent(css).then((messages) => {\n const compatibilityLimitation = messages.filter(\n (message) => message.compatibility === \"known-validator-limitation\",\n ).length;\n const warning = messages.filter((message) => message.type.toLowerCase() === \"warning\").length;\n return {\n messages,\n total: messages.length,\n truncated: false,\n counts: {\n error: messages.length - warning - compatibilityLimitation,\n warning,\n compatibilityLimitation,\n },\n };\n });\n const seoValidation = dependencies.auditSeoMetadataDetailed\n ? Promise.resolve().then(() => dependencies.auditSeoMetadataDetailed!(html))\n : Promise.resolve().then(() => {\n const issues = dependencies.auditSeoMetadata(html);\n const counts = { error: 0, warning: 0, info: 0 };\n for (const issue of issues) counts[issue.severity] += 1;\n return { issues, totalIssues: issues.length, truncated: false, counts };\n });\n const schemaValidation = dependencies.validateSchemaMarkupDetailed\n ? Promise.resolve().then(() => dependencies.validateSchemaMarkupDetailed!(html))\n : Promise.resolve().then(() => {\n const issues = dependencies.validateSchemaMarkup(html);\n const counts = { error: 0, warning: 0, info: 0 };\n for (const issue of issues) counts[issue.severity] += 1;\n return { issues, totalIssues: issues.length, truncated: false, counts };\n });\n const [htmlResult, cssResult, seoResult, schemaResult, linksResult] = await Promise.allSettled([\n htmlValidation,\n cssValidation,\n seoValidation,\n schemaValidation,\n dependencies.checkBrokenLinks(html, baseUrl, 25),\n ]);\n\n if (htmlResult.status === \"rejected\") recordFailure(\"html\", \"HTML validation\", htmlResult.reason);\n if (cssResult.status === \"rejected\") recordFailure(\"css\", \"CSS validation\", cssResult.reason);\n if (seoResult.status === \"rejected\") recordFailure(\"seo\", \"SEO analysis\", seoResult.reason);\n if (schemaResult.status === \"rejected\") recordFailure(\"schema\", \"JSON-LD analysis\", schemaResult.reason);\n if (linksResult.status === \"rejected\") recordFailure(\"links\", \"Link checking\", linksResult.reason);\n\n return createValidationReport({\n htmlFilePath,\n cssAudited: css !== undefined,\n htmlMessages: htmlResult.status === \"fulfilled\" ? htmlResult.value.messages : [],\n htmlTotalMessages: htmlResult.status === \"fulfilled\" ? htmlResult.value.total : 0,\n htmlTruncated: htmlResult.status === \"fulfilled\" ? htmlResult.value.truncated : false,\n htmlCounts: htmlResult.status === \"fulfilled\" ? htmlResult.value.counts : undefined,\n cssMessages: cssResult.status === \"fulfilled\" ? cssResult.value.messages : [],\n cssTotalMessages: cssResult.status === \"fulfilled\" ? cssResult.value.total : 0,\n cssTruncated: cssResult.status === \"fulfilled\" ? cssResult.value.truncated : false,\n cssCounts: cssResult.status === \"fulfilled\" ? cssResult.value.counts : undefined,\n seoIssues: seoResult.status === \"fulfilled\" ? seoResult.value.issues : [],\n seoTotalIssues: seoResult.status === \"fulfilled\" ? seoResult.value.totalIssues : 0,\n seoTruncated: seoResult.status === \"fulfilled\" ? seoResult.value.truncated : false,\n seoCounts: seoResult.status === \"fulfilled\" ? seoResult.value.counts : undefined,\n schemaIssues: schemaResult.status === \"fulfilled\" ? schemaResult.value.issues : [],\n schemaTotalIssues: schemaResult.status === \"fulfilled\" ? schemaResult.value.totalIssues : 0,\n schemaTruncated: schemaResult.status === \"fulfilled\" ? schemaResult.value.truncated : false,\n schemaCounts: schemaResult.status === \"fulfilled\" ? schemaResult.value.counts : undefined,\n links: linksResult.status === \"fulfilled\" ? linksResult.value : [],\n failedChecks,\n errors,\n });\n}\n\nexport function createServer(): McpServer {\n const server = new McpServer(\n { name: \"mcp-web-validator\", version: SERVER_VERSION },\n {\n instructions:\n \"Validate only files, markup, and public URLs the user owns or is authorized to inspect. HTML and CSS validation send supplied content to W3C-operated validators. Link checks contact public links without following redirects. Screenshot capture executes page content in a sandboxed local browser and writes PNG files.\",\n },\n );\n\n server.registerTool(\n \"html.local\",\n {\n title: \"Validate local HTML\",\n description:\n \"Reads a bounded local HTML or .xhtml file and sends its markup to the W3C Nu HTML Checker. .xhtml files use application/xhtml+xml parsing semantics. Use only files the user is authorized to share.\",\n inputSchema: {\n filePath: filePathSchema.describe(\"Absolute or workspace-relative path to an HTML or .xhtml file.\"),\n },\n outputSchema: {\n errors: z.array(w3cMessageSchema),\n totalMessages: z.number().int().nonnegative(),\n truncated: z.boolean(),\n error: z.string().optional(),\n },\n annotations: externalReadOnlyAnnotations,\n },\n async ({ filePath }) => {\n try {\n const htmlMediaType = localHtmlValidationMediaType(filePath);\n const html = await readTextFile(filePath, HTML_MAX_BYTES, htmlMediaType);\n const validation = await validateHtmlContentDetailed(\n html,\n htmlMediaType,\n );\n const messages = boundedMcpArray(validation.messages);\n const truncated = validation.truncated || messages.length < validation.messages.length;\n return result(\n { errors: messages, totalMessages: validation.total, truncated },\n htmlValidationContent(messages, undefined, validation.total, validation.counts),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { errors: [], totalMessages: 0, truncated: false, error },\n failureContent(\n \"HTML validation\",\n error,\n \"Confirm the file exists and is readable, then retry. If the W3C service is unavailable, try again later.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"html.url\",\n {\n title: \"Validate a public URL\",\n description:\n \"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.\",\n inputSchema: {\n url: publicUrlSchema.describe(\"Public HTTP(S) URL on port 80 or 443.\"),\n },\n outputSchema: {\n errors: z.array(w3cMessageSchema),\n totalMessages: z.number().int().nonnegative(),\n truncated: z.boolean(),\n fetchedUrl: z.string().optional(),\n error: z.string().optional(),\n },\n annotations: externalReadOnlyAnnotations,\n },\n async ({ url }) => {\n try {\n const fetched = await fetchPublicText(url, {\n maxBytes: HTML_MAX_BYTES,\n timeoutMs: 15_000,\n maxRedirects: 3,\n acceptedContentTypes: [\"text/html\", \"application/xhtml+xml\"],\n headers: {\n accept: \"text/html,application/xhtml+xml;q=0.9\",\n \"user-agent\": `DigestSEO-Web-Validator/${SERVER_VERSION} (+https://digestseo.com/validator-mcp/)`,\n },\n });\n if (fetched.status < 200 || fetched.status >= 300) {\n throw new Error(`Target URL returned HTTP ${fetched.status}.`);\n }\n const validationMediaType = fetched.contentType\n ?.split(\";\", 1)[0]\n .trim()\n .toLowerCase() === \"application/xhtml+xml\"\n ? \"application/xhtml+xml\"\n : \"text/html\";\n const validation = await validateHtmlContentDetailed(fetched.text, validationMediaType);\n const messages = boundedMcpArray(validation.messages);\n const truncated = validation.truncated || messages.length < validation.messages.length;\n return result(\n {\n errors: messages,\n totalMessages: validation.total,\n truncated,\n fetchedUrl: fetched.url,\n },\n htmlValidationContent(messages, fetched.url, validation.total, validation.counts),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { errors: [], totalMessages: 0, truncated: false, error },\n failureContent(\n \"URL validation\",\n error,\n \"Confirm the URL is public, uses HTTP or HTTPS on a standard port, and returns HTML, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"css.local\",\n {\n title: \"Validate local CSS\",\n description:\n \"Reads a bounded local CSS file and sends it to the W3C Jigsaw CSS Validator. Use only files the user is authorized to share.\",\n inputSchema: {\n filePath: filePathSchema.describe(\"Absolute or workspace-relative path to a CSS file.\"),\n },\n outputSchema: {\n errors: z.array(cssMessageSchema),\n warnings: z.array(cssMessageSchema).optional(),\n totalMessages: z.number().int().nonnegative(),\n truncated: z.boolean(),\n error: z.string().optional(),\n },\n annotations: externalReadOnlyAnnotations,\n },\n async ({ filePath }) => {\n try {\n const css = await readTextFile(filePath, CSS_MAX_BYTES, \"text/css\");\n const validation = await validateCssContentDetailed(css);\n const messages = boundedMcpArray(validation.messages);\n const truncated = validation.truncated || messages.length < validation.messages.length;\n return result(\n {\n errors: messages.filter((message) => message.type.toLowerCase() !== \"warning\"),\n warnings: messages.filter((message) => message.type.toLowerCase() === \"warning\"),\n totalMessages: validation.total,\n truncated,\n },\n cssValidationContent(messages, validation.total, validation.counts),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { errors: [], warnings: [], totalMessages: 0, truncated: false, error },\n failureContent(\n \"CSS validation\",\n error,\n \"Confirm the file exists, is readable, and is within the size limit, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"seo.metadata\",\n {\n title: \"Audit SEO metadata\",\n description:\n \"Audits supplied HTML offline for on-page SEO metadata, headings, viewport, image alternatives, and Open Graph issues. Use for a quick on-page check; use html.local/html.url for W3C HTML validation, schema.markup for JSON-LD syntax, or report.validation for a combined local-file report.\",\n inputSchema: {\n htmlContent: htmlContentSchema.describe(\"Raw HTML markup to inspect locally.\"),\n },\n outputSchema: {\n issues: z.array(seoIssueSchema),\n totalIssues: z.number().int().nonnegative(),\n truncated: z.boolean(),\n counts: auditCountsSchema,\n error: z.string().optional(),\n },\n annotations: localReadOnlyAnnotations,\n },\n async ({ htmlContent }) => {\n try {\n const { issues, totalIssues, truncated, counts } = boundedMcpIssues(auditSeoMetadataDetailed(htmlContent));\n return result(\n { issues, totalIssues, truncated, counts },\n seoAuditContent(issues, totalIssues, truncated, counts),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { issues: [], totalIssues: 0, truncated: false, counts: { error: 0, warning: 0, info: 0 }, error },\n failureContent(\n \"SEO audit\",\n error,\n \"Confirm the supplied HTML is complete and within the size limit, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"links.broken\",\n {\n title: \"Check public links\",\n description:\n \"Resolves and checks up to 25 public HTTP(S) links in supplied HTML. Redirects are reported but not followed, and response bodies are discarded.\",\n inputSchema: {\n htmlContent: htmlContentSchema.describe(\"Raw HTML markup containing links to check.\"),\n baseUrl: publicUrlSchema\n .optional()\n .describe(\"Optional public HTTP(S) base URL used to resolve relative links.\"),\n maxLinks: z\n .number()\n .int()\n .min(1)\n .max(25)\n .default(25)\n .describe(\"Maximum number of public HTTP(S) links to check, from 1 to 25.\"),\n },\n outputSchema: {\n links: z.array(linkStatusSchema),\n totalLinks: z.number().int().nonnegative(),\n truncated: z.boolean(),\n error: z.string().optional(),\n },\n annotations: externalReadOnlyAnnotations,\n },\n async ({ htmlContent, baseUrl, maxLinks }) => {\n try {\n const links = await checkBrokenLinks(htmlContent, baseUrl, maxLinks);\n const preview = boundedMcpArray(links);\n const truncated = preview.length < links.length;\n return result(\n { links: preview, totalLinks: links.length, truncated },\n linkCheckContent(links, baseUrl)\n + (truncated ? `\\n\\nOnly the first ${preview.length} of ${links.length} link records fit the MCP output budget; link-check counts include all results.` : \"\"),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { links: [], totalLinks: 0, truncated: false, error },\n failureContent(\n \"Link check\",\n error,\n \"Confirm the base URL is public and the supplied HTML is within the size limit, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"schema.markup\",\n {\n title: \"Validate JSON-LD syntax\",\n description:\n \"Parses JSON-LD blocks in supplied HTML locally and reports empty blocks or JSON syntax errors. It does not validate vocabulary semantics.\",\n inputSchema: {\n htmlContent: htmlContentSchema.describe(\"Raw HTML containing JSON-LD script blocks.\"),\n },\n outputSchema: {\n issues: z.array(seoIssueSchema),\n totalIssues: z.number().int().nonnegative(),\n truncated: z.boolean(),\n counts: auditCountsSchema,\n error: z.string().optional(),\n },\n annotations: localReadOnlyAnnotations,\n },\n async ({ htmlContent }) => {\n try {\n const { issues, totalIssues, truncated, counts } = boundedMcpIssues(validateSchemaMarkupDetailed(htmlContent));\n return result(\n { issues, totalIssues, truncated, counts },\n schemaValidationContent(issues, totalIssues, truncated, htmlContent),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { issues: [], totalIssues: 0, truncated: false, counts: { error: 0, warning: 0, info: 0 }, error },\n failureContent(\n \"JSON-LD syntax\",\n error,\n \"Confirm the supplied HTML is complete and within the size limit, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"report.validation\",\n {\n title: \"Generate a validation report\",\n description:\n \"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.\",\n inputSchema: {\n htmlFilePath: filePathSchema.describe(\"Absolute or workspace-relative HTML or .xhtml file path.\"),\n cssFilePath: filePathSchema\n .optional()\n .describe(\"Optional absolute or workspace-relative CSS file path.\"),\n baseUrl: publicUrlSchema\n .optional()\n .describe(\"Optional public HTTP(S) base URL used to resolve relative links.\"),\n },\n outputSchema: {\n report: z.string(),\n summary: reportSummarySchema,\n htmlMessages: z.array(w3cMessageSchema),\n htmlTotalMessages: z.number().int().nonnegative(),\n htmlTruncated: z.boolean(),\n cssMessages: z.array(cssMessageSchema),\n cssTotalMessages: z.number().int().nonnegative(),\n cssTruncated: z.boolean(),\n seoIssues: z.array(seoIssueSchema),\n seoTotalIssues: z.number().int().nonnegative(),\n seoTruncated: z.boolean(),\n schemaIssues: z.array(seoIssueSchema),\n schemaTotalIssues: z.number().int().nonnegative(),\n schemaTruncated: z.boolean(),\n links: z.array(linkStatusSchema),\n failedChecks: z.array(z.enum(validationReportChecks)),\n errors: z.array(z.string()).optional(),\n },\n annotations: externalReadOnlyAnnotations,\n },\n async ({ htmlFilePath, cssFilePath, baseUrl }) => {\n try {\n const reportData = await generateValidationReport({\n htmlFilePath,\n cssFilePath,\n baseUrl,\n });\n const narrative = reportContent(reportData);\n const bounded = boundedMcpReport(reportData, narrative);\n return result(\n bounded,\n bounded === reportData\n ? narrative\n : narrative + \"\\n\\nVerbose report tables and structured previews were shortened for MCP transport; all summary scores and totals remain unchanged.\",\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n const reportData = failedReport(htmlFilePath, error);\n return result(\n reportData,\n failureContent(\n \"Validation report\",\n error,\n \"Confirm the input paths are readable and any base URL is public, then regenerate the report.\",\n ),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"audit.history\",\n {\n title: \"Manage local audit history\",\n description:\n \"Opt-in local-only site-audit snapshot history. Save a previous hosted audit_public_site structured result as JSON, list saved IDs, or retrieve an exact version. A single compact local JSON file retains at most 10 versions; saving the 11th removes the oldest. No database, background task, or network request.\",\n inputSchema: {\n action: z.enum([\"save\", \"list\", \"get\"]).describe(\"Save a snapshot, list versions, or retrieve one by ID.\"),\n snapshotJson: z.string().min(1).max(MAX_AUDIT_SNAPSHOT_BYTES).optional()\n .describe(\"For save: JSON-serialized structuredContent from hosted audit_public_site, max 60 KB. Raw HTML is not stored.\"),\n id: z.string().uuid().optional().describe(\"For get: saved version ID returned by list or save.\"),\n },\n outputSchema: {\n count: z.number().int().nonnegative(),\n items: z.array(z.object({\n id: z.string().uuid(),\n saved_at: z.string(),\n site_url: z.string(),\n })).max(MAX_AUDIT_HISTORY),\n snapshot_json: z.string().optional(),\n evicted_id: z.string().uuid().optional(),\n error: z.string().optional(),\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: false,\n },\n },\n async ({ action, snapshotJson, id }) => {\n try {\n if (action === \"save\") {\n if (!snapshotJson) throw new Error(\"snapshotJson is required when action is save.\");\n const saved = await saveAuditHistorySnapshot(snapshotJson);\n return result(saved, `Audit version saved locally. ${saved.count}/10 versions retained.${saved.evicted_id ? \" Oldest version automatically deleted.\" : \"\"} Latest ID: ${saved.items[0]?.id}`);\n }\n if (action === \"get\") {\n if (!id) throw new Error(\"id is required when action is get.\");\n const found = await getAuditHistorySnapshot(id);\n return result(found, `Retrieved audit history version ${id}. Use snapshot_json as a baseline or current result for compare_site_audits.`);\n }\n const listed = await listAuditHistory();\n return result(listed, `Found ${listed.count} locally saved audit versions, newest first.`);\n } catch (cause) {\n const error = getErrorMessage(cause);\n return result(\n { count: 0, items: [], error },\n failureContent(\"Audit history\", error, \"Review snapshot JSON or local history file permissions and retry.\"),\n true,\n );\n }\n },\n );\n\n server.registerTool(\n \"screenshot.capture\",\n {\n title: \"Capture responsive screenshots\",\n description:\n \"Renders a local HTML file or HTTP(S) URL in a sandboxed local Chromium browser and writes PNG screenshots to the requested directory. Downloads the pinned headless browser on first use if it is not already cached. Existing matching files may be replaced. Completed PNG paths are included if a later viewport fails.\",\n inputSchema: {\n targetPath: z\n .string()\n .trim()\n .min(1)\n .max(PATH_MAX_LENGTH)\n .describe(\"Local HTML path or HTTP(S) URL to render.\"),\n outputDir: filePathSchema\n .optional()\n .default(\".mcp-validator/screenshots\")\n .describe(\"Directory where PNG screenshots will be written.\"),\n viewports: z\n .array(\n z.object({\n name: z\n .string()\n .regex(/^[A-Za-z0-9_-]{1,50}$/)\n .describe(\"Safe filename label for this screenshot viewport.\"),\n width: z\n .number()\n .int()\n .min(200)\n .max(3_840)\n .describe(\"Viewport width in CSS pixels, from 200 to 3840.\"),\n height: z\n .number()\n .int()\n .min(200)\n .max(4_320)\n .describe(\"Viewport height in CSS pixels, from 200 to 4320.\"),\n }),\n )\n .min(1)\n .max(MAX_VIEWPORTS)\n .optional()\n .describe(\"Optional viewport definitions; defaults to desktop, tablet, and mobile sizes.\"),\n },\n outputSchema: {\n screenshots: z.array(screenshotSchema),\n outputDirectory: z.string(),\n error: z.string().optional(),\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: true,\n openWorldHint: true,\n },\n },\n async ({ targetPath, outputDir, viewports }) => {\n const outputDirectory = path.resolve(outputDir);\n try {\n const screenshots = await captureScreenshots(targetPath, outputDirectory, viewports);\n const affected = screenshots.filter((capture) => (capture.incompleteAssetCount ?? 0) > 0);\n if (affected.length > 0) {\n const error = `${affected.length} screenshot viewport(s) have failed or blocked visual assets; files were saved but captures may be incomplete.`;\n return result(\n { screenshots, outputDirectory, error },\n screenshotPartialCaptureContent(screenshots.length, outputDirectory, error),\n true,\n );\n }\n return result(\n { screenshots, outputDirectory },\n screenshotCaptureContent(screenshots.length, outputDirectory),\n );\n } catch (cause) {\n const error = getErrorMessage(cause);\n if (cause instanceof PartialScreenshotCaptureError) {\n return result(\n { screenshots: cause.screenshots, outputDirectory, error },\n screenshotPartialCaptureContent(cause.screenshots.length, outputDirectory, error),\n true,\n );\n }\n return result(\n { screenshots: [], outputDirectory, error },\n failureContent(\n \"Screenshot capture\",\n error,\n \"Confirm the target is reachable or readable and the output directory is writable, then retry.\",\n ),\n true,\n );\n }\n },\n );\n\n return server;\n}\n\nexport async function run(): Promise<void> {\n const server = createServer();\n await server.connect(new StdioServerTransport());\n console.error(`mcp-web-validator ${SERVER_VERSION} started on stdio`);\n}\n\nconst invokedPath = process.argv[1] ? pathToFileURL(path.resolve(process.argv[1])).href : undefined;\nif (invokedPath === import.meta.url) {\n run().catch((cause: unknown) => {\n console.error(\"Fatal error starting mcp-web-validator:\", getErrorMessage(cause));\n process.exitCode = 1;\n });\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ValidationReport } from "./report.js";
|
|
2
|
+
import type { AuditDetails } from "./seo-auditor.js";
|
|
3
|
+
export declare const MAX_MCP_STRUCTURED_BYTES = 16000;
|
|
4
|
+
export declare function jsonBytes(value: unknown): number;
|
|
5
|
+
export declare function boundedMcpArray<T>(items: readonly T[], maxBytes?: number): T[];
|
|
6
|
+
export declare function boundedMcpIssues(details: AuditDetails): AuditDetails;
|
|
7
|
+
/**
|
|
8
|
+
* Preserve the report's exact summary, totals, and completed-check status.
|
|
9
|
+
* Only huge reports lose verbose Markdown tables and diagnostic previews.
|
|
10
|
+
*/
|
|
11
|
+
export declare function boundedMcpReport(data: ValidationReport, narrative: string): ValidationReport;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Keep complete counts while limiting diagnostic previews to a size that
|
|
2
|
+
// survives MCP gateways with stricter structured-result limits.
|
|
3
|
+
export const MAX_MCP_STRUCTURED_BYTES = 16_000;
|
|
4
|
+
export function jsonBytes(value) {
|
|
5
|
+
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
6
|
+
}
|
|
7
|
+
export function boundedMcpArray(items, maxBytes = MAX_MCP_STRUCTURED_BYTES) {
|
|
8
|
+
let bytes = 2; // JSON array brackets.
|
|
9
|
+
let count = 0;
|
|
10
|
+
for (const item of items) {
|
|
11
|
+
const increment = jsonBytes(item) + (count > 0 ? 1 : 0);
|
|
12
|
+
if (bytes + increment > maxBytes)
|
|
13
|
+
break;
|
|
14
|
+
bytes += increment;
|
|
15
|
+
count += 1;
|
|
16
|
+
}
|
|
17
|
+
return items.slice(0, count);
|
|
18
|
+
}
|
|
19
|
+
export function boundedMcpIssues(details) {
|
|
20
|
+
const issues = boundedMcpArray(details.issues);
|
|
21
|
+
if (issues.length === details.issues.length)
|
|
22
|
+
return details;
|
|
23
|
+
return { ...details, issues, truncated: true };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Preserve the report's exact summary, totals, and completed-check status.
|
|
27
|
+
* Only huge reports lose verbose Markdown tables and diagnostic previews.
|
|
28
|
+
*/
|
|
29
|
+
export function boundedMcpReport(data, narrative) {
|
|
30
|
+
if (jsonBytes(data) <= MAX_MCP_STRUCTURED_BYTES)
|
|
31
|
+
return data;
|
|
32
|
+
const preview = narrative.length > 1_800
|
|
33
|
+
? `${narrative.slice(0, 1_800)}\n\n*The narrative preview was shortened.*`
|
|
34
|
+
: narrative;
|
|
35
|
+
for (const cap of [32, 24, 16, 12, 8, 6, 4, 2, 1, 0]) {
|
|
36
|
+
const htmlMessages = data.htmlMessages.slice(0, cap);
|
|
37
|
+
const cssMessages = data.cssMessages.slice(0, cap);
|
|
38
|
+
const seoIssues = data.seoIssues.slice(0, cap);
|
|
39
|
+
const schemaIssues = data.schemaIssues.slice(0, cap);
|
|
40
|
+
const links = data.links.slice(0, cap);
|
|
41
|
+
const errors = data.errors?.slice(0, cap).map((error) => error.length > 400 ? `${error.slice(0, 397)}...` : error);
|
|
42
|
+
const details = [
|
|
43
|
+
`HTML ${htmlMessages.length}/${data.htmlTotalMessages}`,
|
|
44
|
+
`CSS ${cssMessages.length}/${data.cssTotalMessages}`,
|
|
45
|
+
`SEO ${seoIssues.length}/${data.seoTotalIssues}`,
|
|
46
|
+
`JSON-LD ${schemaIssues.length}/${data.schemaTotalIssues}`,
|
|
47
|
+
`links ${links.length}/${data.summary.linksChecked}`,
|
|
48
|
+
].join("; ");
|
|
49
|
+
const compact = {
|
|
50
|
+
...data,
|
|
51
|
+
report: `# Web validation report (condensed)\n\n${preview}\n\nDetailed tables were shortened for MCP transport limits. The summary scores and total counts still cover all completed checks. Preview: ${details}.`,
|
|
52
|
+
htmlMessages,
|
|
53
|
+
htmlTruncated: data.htmlTruncated || htmlMessages.length < data.htmlMessages.length,
|
|
54
|
+
cssMessages,
|
|
55
|
+
cssTruncated: data.cssTruncated || cssMessages.length < data.cssMessages.length,
|
|
56
|
+
seoIssues,
|
|
57
|
+
seoTruncated: data.seoTruncated || seoIssues.length < data.seoIssues.length,
|
|
58
|
+
schemaIssues,
|
|
59
|
+
schemaTruncated: data.schemaTruncated || schemaIssues.length < data.schemaIssues.length,
|
|
60
|
+
links,
|
|
61
|
+
...(errors ? { errors } : {}),
|
|
62
|
+
};
|
|
63
|
+
if (jsonBytes(compact) <= MAX_MCP_STRUCTURED_BYTES)
|
|
64
|
+
return compact;
|
|
65
|
+
}
|
|
66
|
+
throw new Error("The validation report could not be bounded for MCP transport.");
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=mcp-bounds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-bounds.js","sourceRoot":"","sources":["../src/mcp-bounds.ts"],"names":[],"mappings":"AAGA,yEAAyE;AACzE,gEAAgE;AAChE,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE/C,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,eAAe,CAAI,KAAmB,EAAE,QAAQ,GAAG,wBAAwB;IACzF,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,uBAAuB;IACtC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,IAAI,KAAK,GAAG,SAAS,GAAG,QAAQ;YAAE,MAAM;QACxC,KAAK,IAAI,SAAS,CAAC;QACnB,KAAK,IAAI,C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AAM,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM;YACvF,KAAK;YACL,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9B,CAAC;QACF,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,wBAAwB;YAAE,OAAO,OAAO,CAAC;IACrE,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;AACnF,CAAC","sourcesContent":["import type { ValidationReport } from \"./report.js\";\nimport type { AuditDetails } from \"./seo-auditor.js\";\n\n// Keep complete counts while limiting diagnostic previews to a size that\n// survives MCP gateways with stricter structured-result limits.\nexport const MAX_MCP_STRUCTURED_BYTES = 16_000;\n\nexport function jsonBytes(value: unknown): number {\n return Buffer.byteLength(JSON.stringify(value), \"utf8\");\n}\n\nexport function boundedMcpArray<T>(items: readonly T[], maxBytes = MAX_MCP_STRUCTURED_BYTES): T[] {\n let bytes = 2; // JSON array brackets.\n let count = 0;\n for (const item of items) {\n const increment = jsonBytes(item) + (count > 0 ? 1 : 0);\n if (bytes + increment > maxBytes) break;\n bytes += increment;\n count += 1;\n }\n return items.slice(0, count);\n}\n\nexport function boundedMcpIssues(details: AuditDetails): AuditDetails {\n const issues = boundedMcpArray(details.issues);\n if (issues.length === details.issues.length) return details;\n return { ...details, issues, truncated: true };\n}\n\n/**\n * Preserve the report's exact summary, totals, and completed-check status.\n * Only huge reports lose verbose Markdown tables and diagnostic previews.\n */\nexport function boundedMcpReport(data: ValidationReport, narrative: string): ValidationReport {\n if (jsonBytes(data) <= MAX_MCP_STRUCTURED_BYTES) return data;\n\n const preview = narrative.length > 1_800\n ? `${narrative.slice(0, 1_800)}\\n\\n*The narrative preview was shortened.*`\n : narrative;\n\n for (const cap of [32, 24, 16, 12, 8, 6, 4, 2, 1, 0]) {\n const htmlMessages = data.htmlMessages.slice(0, cap);\n const cssMessages = data.cssMessages.slice(0, cap);\n const seoIssues = data.seoIssues.slice(0, cap);\n const schemaIssues = data.schemaIssues.slice(0, cap);\n const links = data.links.slice(0, cap);\n const errors = data.errors?.slice(0, cap).map((error) =>\n error.length > 400 ? `${error.slice(0, 397)}...` : error\n );\n const details = [\n `HTML ${htmlMessages.length}/${data.htmlTotalMessages}`,\n `CSS ${cssMessages.length}/${data.cssTotalMessages}`,\n `SEO ${seoIssues.length}/${data.seoTotalIssues}`,\n `JSON-LD ${schemaIssues.length}/${data.schemaTotalIssues}`,\n `links ${links.length}/${data.summary.linksChecked}`,\n ].join(\"; \");\n const compact: ValidationReport = {\n ...data,\n report: `# Web validation report (condensed)\\n\\n${preview}\\n\\nDetailed tables were shortened for MCP transport limits. The summary scores and total counts still cover all completed checks. Preview: ${details}.`,\n htmlMessages,\n htmlTruncated: data.htmlTruncated || htmlMessages.length < data.htmlMessages.length,\n cssMessages,\n cssTruncated: data.cssTruncated || cssMessages.length < data.cssMessages.length,\n seoIssues,\n seoTruncated: data.seoTruncated || seoIssues.length < data.seoIssues.length,\n schemaIssues,\n schemaTruncated: data.schemaTruncated || schemaIssues.length < data.schemaIssues.length,\n links,\n ...(errors ? { errors } : {}),\n };\n if (jsonBytes(compact) <= MAX_MCP_STRUCTURED_BYTES) return compact;\n }\n throw new Error(\"The validation report could not be bounded for MCP transport.\");\n}\n"]}
|