@nyx-intelligence/val-mcp 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/dist/report.js +13 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { scanSite, checkPage, screenshot } from "./scanner.js";
|
|
3
|
-
import { formatReport } from "./report.js";
|
|
3
|
+
import { formatReport, topFindings } from "./report.js";
|
|
4
4
|
import { session } from "./session.js";
|
|
5
5
|
function fmtAction(r) {
|
|
6
6
|
const lines = [`${r.ok ? "ok" : "warn"} · ${r.title || "(no title)"} · ${r.url}`];
|
|
@@ -66,7 +66,7 @@ async function runServer() {
|
|
|
66
66
|
const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
67
67
|
const { chromium } = await import("playwright");
|
|
68
68
|
const { z } = await import("zod");
|
|
69
|
-
const server = new McpServer({ name: "val", version: "0.
|
|
69
|
+
const server = new McpServer({ name: "val", version: "0.5.0" });
|
|
70
70
|
const text = (t) => ({ content: [{ type: "text", text: t }] });
|
|
71
71
|
// ── Passive crawl ──
|
|
72
72
|
server.registerTool("val_scan", {
|
|
@@ -75,7 +75,7 @@ async function runServer() {
|
|
|
75
75
|
inputSchema: { url: z.string(), maxPages: z.number().int().min(1).max(50).optional(), device: z.string().optional().describe("Emulate a mobile device, e.g. 'iPhone 14' or 'Pixel 7'") },
|
|
76
76
|
}, async ({ url, maxPages, device }) => {
|
|
77
77
|
const { findings, pagesVisited } = await scanSite(url, { maxPages: maxPages ?? 12, device });
|
|
78
|
-
return text(`${formatReport(findings, pagesVisited)}\n\nJSON:\n${JSON.stringify(findings)}`);
|
|
78
|
+
return text(`${formatReport(findings, pagesVisited)}\n\nJSON:\n${JSON.stringify(topFindings(findings))}`);
|
|
79
79
|
});
|
|
80
80
|
server.registerTool("val_check", {
|
|
81
81
|
title: "Re-check one page (verify a fix)",
|
|
@@ -85,7 +85,7 @@ async function runServer() {
|
|
|
85
85
|
const browser = await chromium.launch({ headless: true });
|
|
86
86
|
try {
|
|
87
87
|
const { findings } = await checkPage(browser, url, { device });
|
|
88
|
-
return text(`${formatReport(findings, [url])}\n\nJSON:\n${JSON.stringify(findings)}`);
|
|
88
|
+
return text(`${formatReport(findings, [url])}\n\nJSON:\n${JSON.stringify(topFindings(findings))}`);
|
|
89
89
|
}
|
|
90
90
|
finally {
|
|
91
91
|
await browser.close();
|
package/dist/report.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
const RANK = { high: 0, medium: 1, low: 2 };
|
|
2
|
-
|
|
2
|
+
// Cap how many findings we surface so a very broken site can't blow up the
|
|
3
|
+
// calling agent's token budget. The full count is always reported; only the
|
|
4
|
+
// itemized list (and the JSON the agent parses) is capped to the top N.
|
|
5
|
+
const MAX_REPORT = 50;
|
|
6
|
+
export function topFindings(findings, n = MAX_REPORT) {
|
|
7
|
+
return [...findings].sort((a, b) => RANK[a.severity] - RANK[b.severity]).slice(0, n);
|
|
8
|
+
}
|
|
3
9
|
export function formatReport(findings, pagesVisited) {
|
|
4
10
|
const counts = { high: 0, medium: 0, low: 0 };
|
|
5
11
|
for (const f of findings)
|
|
@@ -12,11 +18,15 @@ export function formatReport(findings, pagesVisited) {
|
|
|
12
18
|
}
|
|
13
19
|
else {
|
|
14
20
|
lines.push("");
|
|
15
|
-
const
|
|
16
|
-
for (const f of
|
|
21
|
+
const shown = topFindings(findings);
|
|
22
|
+
for (const f of shown) {
|
|
17
23
|
lines.push(`[${f.severity.toUpperCase()}] ${f.type} — ${f.page}`);
|
|
18
24
|
lines.push(` ${f.detail}${f.evidence ? ` (${f.evidence})` : ""}`);
|
|
19
25
|
}
|
|
26
|
+
if (findings.length > shown.length) {
|
|
27
|
+
lines.push("");
|
|
28
|
+
lines.push(`… and ${findings.length - shown.length} more (capped to keep this small). Fix the above, then re-scan.`);
|
|
29
|
+
}
|
|
20
30
|
}
|
|
21
31
|
lines.push("");
|
|
22
32
|
lines.push("Pages crawled:");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyx-intelligence/val-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Val — a 100% MCP QA agent for vibecoders. Drives a real browser to catch UX bugs (broken links, 404s, console errors, broken images) so your coding agent can fix them.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|