argusqa-os 9.2.7 → 9.2.8
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/package.json +1 -1
- package/src/mcp-server.js +48 -3
package/package.json
CHANGED
package/src/mcp-server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Argus MCP Server (v9.2.
|
|
3
|
+
* Argus MCP Server (v9.2.8)
|
|
4
4
|
*
|
|
5
5
|
* Exposes Argus as an MCP server so Claude (or any MCP client) can call
|
|
6
6
|
* argus_audit, argus_audit_full, argus_compare, and argus_last_report
|
|
@@ -28,6 +28,9 @@ import path from 'path';
|
|
|
28
28
|
import { createMcpClient } from './utils/mcp-client.js';
|
|
29
29
|
import { crawlRouteCheap, runCrawl } from './orchestration/crawl-and-report.js';
|
|
30
30
|
import { runComparison } from './orchestration/env-comparison.js';
|
|
31
|
+
import { WatchSession } from './orchestration/watch-mode.js';
|
|
32
|
+
import { CdpBrowserAdapter } from './adapters/browser.js';
|
|
33
|
+
import { generateHtmlReport } from './utils/html-reporter.js';
|
|
31
34
|
|
|
32
35
|
const REPORTS_DIR = path.resolve(process.cwd(), 'reports');
|
|
33
36
|
|
|
@@ -68,6 +71,21 @@ const TOOLS = [
|
|
|
68
71
|
description: 'Returns the most recent Argus JSON report from the reports/ directory. Report includes a findings array and severity summary (critical/warning/info counts). Returns { "error": "No reports found in reports/" } when no audits have been run yet. Use to retrieve prior results without re-running a scan, or to pipe findings into another analysis tool.',
|
|
69
72
|
inputSchema: { type: 'object', properties: {} },
|
|
70
73
|
},
|
|
74
|
+
{
|
|
75
|
+
name: 'argus_watch_snapshot',
|
|
76
|
+
description: 'Snapshots the currently open Chrome tab without navigating — captures console errors, network failures (4xx/5xx), CORS blocks, and auth failures in one poll. Returns { findings: [{severity, type, message, url}], newConsole, newNetwork }. Use during active development to inspect what is happening on the current page without running a full audit. Requires Chrome on --remote-debugging-port=9222 with a page already open.',
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
url: { type: 'string', description: 'Optional base URL to attribute findings to (default: TARGET_DEV_URL env var). Does not navigate — reads the currently open Chrome tab.' },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'argus_report_html',
|
|
86
|
+
description: 'Generates a self-contained reports/report.html from the most recent Argus JSON report. Inlines all screenshots and findings into a portable single-file HTML dashboard shareable with designers, PMs, or reviewable offline. Returns { path: "reports/report.html" }. Run after argus_audit or argus_audit_full. Returns an error if no JSON reports exist in the reports/ directory.',
|
|
87
|
+
inputSchema: { type: 'object', properties: {} },
|
|
88
|
+
},
|
|
71
89
|
];
|
|
72
90
|
|
|
73
91
|
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
@@ -111,6 +129,31 @@ async function handleCompare() {
|
|
|
111
129
|
});
|
|
112
130
|
}
|
|
113
131
|
|
|
132
|
+
async function handleWatchSnapshot({ url } = {}) {
|
|
133
|
+
return withMcp(async (mcp) => {
|
|
134
|
+
const browser = new CdpBrowserAdapter(mcp);
|
|
135
|
+
const baseUrl = url ?? process.env.TARGET_DEV_URL ?? 'http://localhost:3000';
|
|
136
|
+
const session = new WatchSession(browser, baseUrl);
|
|
137
|
+
const result = await session.poll();
|
|
138
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async function handleReportHtml() {
|
|
143
|
+
if (!fs.existsSync(REPORTS_DIR)) {
|
|
144
|
+
return { content: [{ type: 'text', text: JSON.stringify({ error: 'No reports directory. Run argus_audit first.' }) }] };
|
|
145
|
+
}
|
|
146
|
+
const files = fs.readdirSync(REPORTS_DIR)
|
|
147
|
+
.filter(f => f.startsWith('error-report-') && f.endsWith('.json'))
|
|
148
|
+
.map(f => ({ f, mt: fs.statSync(path.join(REPORTS_DIR, f)).mtimeMs }))
|
|
149
|
+
.sort((a, b) => b.mt - a.mt);
|
|
150
|
+
if (files.length === 0) {
|
|
151
|
+
return { content: [{ type: 'text', text: JSON.stringify({ error: 'No reports found. Run argus_audit first.' }) }] };
|
|
152
|
+
}
|
|
153
|
+
const outPath = await generateHtmlReport(path.join(REPORTS_DIR, files[0].f));
|
|
154
|
+
return { content: [{ type: 'text', text: JSON.stringify({ path: outPath }) }] };
|
|
155
|
+
}
|
|
156
|
+
|
|
114
157
|
async function handleLastReport() {
|
|
115
158
|
if (!fs.existsSync(REPORTS_DIR)) {
|
|
116
159
|
return { content: [{ type: 'text', text: '{"error":"No reports found in reports/"}' }] };
|
|
@@ -129,7 +172,7 @@ async function handleLastReport() {
|
|
|
129
172
|
// ── Server bootstrap ──────────────────────────────────────────────────────────
|
|
130
173
|
|
|
131
174
|
const server = new Server(
|
|
132
|
-
{ name: 'argus', version: '9.2.
|
|
175
|
+
{ name: 'argus', version: '9.2.8' },
|
|
133
176
|
{ capabilities: { tools: {} } },
|
|
134
177
|
);
|
|
135
178
|
|
|
@@ -141,7 +184,9 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
141
184
|
case 'argus_audit': return await handleAudit(req.params.arguments ?? {});
|
|
142
185
|
case 'argus_audit_full': return await handleAuditFull(req.params.arguments ?? {});
|
|
143
186
|
case 'argus_compare': return await handleCompare();
|
|
144
|
-
case 'argus_last_report':
|
|
187
|
+
case 'argus_last_report': return await handleLastReport();
|
|
188
|
+
case 'argus_watch_snapshot': return await handleWatchSnapshot(req.params.arguments ?? {});
|
|
189
|
+
case 'argus_report_html': return await handleReportHtml();
|
|
145
190
|
default: throw new Error(`Unknown tool: ${req.params.name}`);
|
|
146
191
|
}
|
|
147
192
|
} catch (err) {
|