@remnux/mcp-server 0.1.66 → 0.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -8
- package/data/tools-index.json +9 -2
- package/dist/analysis/summarizer.d.ts.map +1 -1
- package/dist/analysis/summarizer.js +10 -3
- package/dist/analysis/summarizer.js.map +1 -1
- package/dist/handlers/analyze-file.d.ts +7 -0
- package/dist/handlers/analyze-file.d.ts.map +1 -1
- package/dist/handlers/analyze-file.js +31 -25
- package/dist/handlers/analyze-file.js.map +1 -1
- package/dist/handlers/get-server-info.d.ts +9 -0
- package/dist/handlers/get-server-info.d.ts.map +1 -0
- package/dist/handlers/get-server-info.js +52 -0
- package/dist/handlers/get-server-info.js.map +1 -0
- package/dist/handlers/output-spill.d.ts +29 -0
- package/dist/handlers/output-spill.d.ts.map +1 -0
- package/dist/handlers/output-spill.js +48 -0
- package/dist/handlers/output-spill.js.map +1 -0
- package/dist/handlers/run-tool.d.ts +15 -0
- package/dist/handlers/run-tool.d.ts.map +1 -1
- package/dist/handlers/run-tool.js +285 -14
- package/dist/handlers/run-tool.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -18
- package/dist/index.js.map +1 -1
- package/dist/schemas/tools.d.ts +2 -0
- package/dist/schemas/tools.d.ts.map +1 -1
- package/dist/schemas/tools.js +12 -2
- package/dist/schemas/tools.js.map +1 -1
- package/package.json +4 -4
|
@@ -6,6 +6,8 @@ import { parseToolOutput, hasParser } from "../parsers/index.js";
|
|
|
6
6
|
import { toolRegistry } from "../tools/registry.js";
|
|
7
7
|
import { filterStderrNoise } from "../utils/stderr-filter.js";
|
|
8
8
|
import { OUTPUT_SENTINEL } from "../tools/invoker.js";
|
|
9
|
+
import { createHash } from "crypto";
|
|
10
|
+
import { saveOversizedOutput } from "./output-spill.js";
|
|
9
11
|
const DISCOURAGED_PATTERNS = [
|
|
10
12
|
{
|
|
11
13
|
pattern: /^yara\s/,
|
|
@@ -32,9 +34,218 @@ const ADVISORY_PATTERNS = [
|
|
|
32
34
|
"Other files → also run 'strings -el <file>' for Unicode (little-endian 16-bit).",
|
|
33
35
|
},
|
|
34
36
|
];
|
|
37
|
+
/**
|
|
38
|
+
* Split a shell command on unquoted, unescaped single `|` characters (pipe
|
|
39
|
+
* stages). `||` is a control operator, not a pipe, and `|` inside quotes or
|
|
40
|
+
* after a backslash is literal text, so none of those split. This is not a
|
|
41
|
+
* full shell parser; it only needs to find the pipeline's last stage.
|
|
42
|
+
*/
|
|
43
|
+
function splitPipeline(command) {
|
|
44
|
+
const stages = [];
|
|
45
|
+
let current = "";
|
|
46
|
+
let quote = null;
|
|
47
|
+
for (let i = 0; i < command.length; i++) {
|
|
48
|
+
const ch = command[i];
|
|
49
|
+
if (quote) {
|
|
50
|
+
current += ch;
|
|
51
|
+
if (ch === "\\" && quote === '"' && i + 1 < command.length) {
|
|
52
|
+
current += command[++i];
|
|
53
|
+
}
|
|
54
|
+
else if (ch === quote) {
|
|
55
|
+
quote = null;
|
|
56
|
+
}
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (ch === "\\" && i + 1 < command.length) {
|
|
60
|
+
current += ch + command[++i];
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (ch === "'" || ch === '"') {
|
|
64
|
+
quote = ch;
|
|
65
|
+
current += ch;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (ch === "#" && (i === 0 || /\s/.test(command[i - 1]))) {
|
|
69
|
+
break; // the rest of the line is a shell comment
|
|
70
|
+
}
|
|
71
|
+
if (ch === "|") {
|
|
72
|
+
if (command[i + 1] === "|") {
|
|
73
|
+
current += "||";
|
|
74
|
+
i++;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (command[i + 1] === "&")
|
|
78
|
+
i++; // `|&` pipes stderr too; still a pipe
|
|
79
|
+
stages.push(current);
|
|
80
|
+
current = "";
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
current += ch;
|
|
84
|
+
}
|
|
85
|
+
stages.push(current);
|
|
86
|
+
return stages;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Detect a `head` or `tail` stage that reads from a pipe (any stage after the
|
|
90
|
+
* first; `tail -n 50 file` with no pipe before it is deliberate paging).
|
|
91
|
+
* Excluded: `tail -f/-F/--follow` (streams rather than limits) and
|
|
92
|
+
* `tail -n +1` (returns every line). Such a stage discards producer output the
|
|
93
|
+
* server would otherwise have returned whole, with exit 0 and no other
|
|
94
|
+
* signal — the model-side mirror of server truncation, and an upstream
|
|
95
|
+
* `head -500 | grep` caps the producer just as a terminal one does. Returns
|
|
96
|
+
* the first such stage's text (whitespace-normalized, trailing redirects and
|
|
97
|
+
* operators dropped, length-capped) and which limiter it is, or undefined.
|
|
98
|
+
*/
|
|
99
|
+
export function detectPipedLimiter(command) {
|
|
100
|
+
const stages = splitPipeline(command);
|
|
101
|
+
for (let n = 1; n < stages.length; n++) {
|
|
102
|
+
// Keep only the command word and its arguments: drop anything after a
|
|
103
|
+
// redirect or control operator that follows the limiter.
|
|
104
|
+
const text = stages[n].trim().split(/\s*(?:\d*[<>]|&&|;)/)[0].trim();
|
|
105
|
+
const words = text.split(/\s+/).filter(Boolean);
|
|
106
|
+
if (words.length === 0)
|
|
107
|
+
continue;
|
|
108
|
+
const cmd = words[0].replace(/^.*\//, "");
|
|
109
|
+
if (cmd !== "head" && cmd !== "tail")
|
|
110
|
+
continue;
|
|
111
|
+
if (cmd === "tail") {
|
|
112
|
+
const args = words.slice(1);
|
|
113
|
+
const follows = args.some((w) => w === "--follow" || w.startsWith("--follow=") || /^-[A-Za-z]*[fF][A-Za-z]*$/.test(w));
|
|
114
|
+
if (follows)
|
|
115
|
+
continue;
|
|
116
|
+
// `tail -n +1` / `tail +1` / `--lines=+1` print from line 1: nothing is dropped
|
|
117
|
+
const fromStart = args.some((w, k) => w === "+1" || w === "--lines=+1" || (w === "-n" && args[k + 1] === "+1"));
|
|
118
|
+
if (fromStart)
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
return { limiter: cmd, stage: text.replace(/\s+/g, " ").slice(0, 60) };
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
// Response budgets (JS string length): 100 KiB of stdout, 50 KiB of stderr.
|
|
126
|
+
const STDOUT_CAP_CHARS = 100 * 1024;
|
|
127
|
+
const MAX_STDERR_RESPONSE = 50 * 1024;
|
|
128
|
+
// Parsers run on captured stdout (not just the returned slice) up to this
|
|
129
|
+
// bound, mirroring analyze_file's IOC_SCAN_CAP, so a finding past the response
|
|
130
|
+
// cap is still reported rather than silently lost.
|
|
131
|
+
const PARSE_CAP_CHARS = 512 * 1024;
|
|
132
|
+
// Parsers can emit one finding per line, so the response carries at most this
|
|
133
|
+
// many; findings_total reports the parsed count when capped.
|
|
134
|
+
const MAX_FINDINGS = 500;
|
|
135
|
+
function limiterAdvisory(l) {
|
|
136
|
+
const part = l.limiter === "head" ? "leading" : "trailing";
|
|
137
|
+
return (`PARTIAL: the pipeline stage '${l.stage}' keeps only the ${part} part of its input; anything past that ` +
|
|
138
|
+
`point is discarded with no signal, and a pipeline's exit status is its last stage's, not the producer's. ` +
|
|
139
|
+
`run_tool returns stdout whole up to ${STDOUT_CAP_CHARS.toLocaleString("en-US")} characters and says so when ` +
|
|
140
|
+
`it has to cut, so drop the ${l.limiter} stage, or select by content with grep.`);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Collect every matching command advisory (newline-joined) so a command like
|
|
144
|
+
* `strings x | head` carries both the INCOMPLETE and the PARTIAL guidance.
|
|
145
|
+
*/
|
|
35
146
|
function getCommandAdvisory(command) {
|
|
36
|
-
const
|
|
37
|
-
|
|
147
|
+
const advisories = ADVISORY_PATTERNS.filter((p) => p.match(command)).map((p) => p.advisory);
|
|
148
|
+
const limiter = detectPipedLimiter(command);
|
|
149
|
+
if (limiter)
|
|
150
|
+
advisories.push(limiterAdvisory(limiter));
|
|
151
|
+
return advisories.length > 0 ? advisories.join("\n") : undefined;
|
|
152
|
+
}
|
|
153
|
+
/** Count lines the way `wc -l` would, plus one for a final unterminated line. */
|
|
154
|
+
function countLines(text) {
|
|
155
|
+
if (text.length === 0)
|
|
156
|
+
return 0;
|
|
157
|
+
let n = 0;
|
|
158
|
+
for (let i = 0; i < text.length; i++)
|
|
159
|
+
if (text.charCodeAt(i) === 10)
|
|
160
|
+
n++;
|
|
161
|
+
return text.endsWith("\n") ? n : n + 1;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Deterministic, sanitized filename for the redirect-to-file recovery recipe:
|
|
165
|
+
* derived only from the registry tool name (or the sanitized command word) and
|
|
166
|
+
* a hash of the full command, so re-running the same command maps to the same
|
|
167
|
+
* file and no untrusted text reaches the filename.
|
|
168
|
+
*/
|
|
169
|
+
function suggestedOutputFilename(fullCommand, toolName) {
|
|
170
|
+
const firstWord = fullCommand.trim().split(/\s/)[0]?.replace(/^.*\//, "") ?? "";
|
|
171
|
+
const base = (toolName ?? firstWord).replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 32) || "cmd";
|
|
172
|
+
const hash = createHash("sha256").update(fullCommand).digest("hex").slice(0, 12);
|
|
173
|
+
return `run_tool-${base}-${hash}.stdout.txt`;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Per-stream truncation notice. Names the omitted line range with
|
|
177
|
+
* server-computed integers and gives a recovery recipe that can actually reach
|
|
178
|
+
* the tail; `head` is never offered as a remedy (it returns another prefix).
|
|
179
|
+
*/
|
|
180
|
+
function buildTruncationNotice(args) {
|
|
181
|
+
const parts = [];
|
|
182
|
+
const fmt = (n) => String(n); // raw integers: copy-safe into sed ranges
|
|
183
|
+
const cap = STDOUT_CAP_CHARS.toLocaleString("en-US");
|
|
184
|
+
// Quoted so an output directory with spaces still resolves (substitution is textual).
|
|
185
|
+
const outPath = `'${OUTPUT_SENTINEL}${args.outFile}'`;
|
|
186
|
+
const errPath = `'${OUTPUT_SENTINEL}${args.outFile.replace(/\.stdout\.txt$/, ".stderr.txt")}'`;
|
|
187
|
+
if (args.stdoutTruncated && args.stdoutReturnedLines === 0) {
|
|
188
|
+
// Not even one complete line fits: line ranges cannot help, so offer
|
|
189
|
+
// content and chunking recipes instead. (`cut -c` slices per line, not
|
|
190
|
+
// the stream, so it is not offered.)
|
|
191
|
+
parts.push(`stdout: ${fmt(args.stdoutCapturedLines)} line(s) captured (${fmt(args.stdoutCapturedLength)} characters); ` +
|
|
192
|
+
`the first line alone fills the ${cap}-character limit, so line ranges cannot help. Narrow by content ` +
|
|
193
|
+
`(e.g. \`<command> | grep -oE '<pattern>'\`) or chunk it: ` +
|
|
194
|
+
(args.savedFile
|
|
195
|
+
? `the captured stdout is saved as ${outPath}; run_tool \`fold -w 1000 ${outPath} | sed -n '103,$p'\` ` +
|
|
196
|
+
`(chunks of 1000 characters from character 102001 to the end; repeat with a later start if still cut). `
|
|
197
|
+
: args.outputDirSet
|
|
198
|
+
? `re-run with \` > ${outPath}\` appended, then \`fold -w 1000 ${outPath} | sed -n '103,$p'\` ` +
|
|
199
|
+
`(chunks of 1000 characters from character 102001 to the end; repeat with a later start if still cut). `
|
|
200
|
+
: `\`<command> | fold -w 1000 | sed -n '103,$p'\` (chunks of 1000 characters from character 102001; ` +
|
|
201
|
+
`repeat with a later start if still cut). `) +
|
|
202
|
+
"'head' returns another prefix and cannot recover the omitted part.");
|
|
203
|
+
}
|
|
204
|
+
else if (args.stdoutTruncated) {
|
|
205
|
+
const from = args.stdoutReturnedLines + 1;
|
|
206
|
+
// Open-ended range: the line count describes captured stdout, which the
|
|
207
|
+
// connector trims and caps (10 MiB), so a fixed end could miss the tail.
|
|
208
|
+
const range = `${from},$p`;
|
|
209
|
+
let msg = `stdout: ${fmt(args.stdoutCapturedLines)} lines captured (${fmt(args.stdoutCapturedLength)} characters); ` +
|
|
210
|
+
`lines 1-${fmt(args.stdoutReturnedLines)} returned in full, the rest omitted (the cut can fall mid-line, ` +
|
|
211
|
+
`so the range below re-reads the cut line whole). `;
|
|
212
|
+
if (args.savedFile) {
|
|
213
|
+
msg +=
|
|
214
|
+
`The captured stdout is saved as ${outPath} (the server resolves %OUTPUT% to the output directory): ` +
|
|
215
|
+
`read the omitted part with run_tool \`sed -n '${range}' ${outPath}\`, grep that file for specifics, ` +
|
|
216
|
+
`or fetch it with download_file '${args.outFile}'. `;
|
|
217
|
+
}
|
|
218
|
+
else if (args.outputDirSet) {
|
|
219
|
+
msg +=
|
|
220
|
+
`To read the omitted part: re-run the same command with \` > ${outPath}\` appended ` +
|
|
221
|
+
`(the server resolves %OUTPUT% to the output directory), then run_tool \`sed -n '${range}' ${outPath}\` ` +
|
|
222
|
+
`(grep that file for specifics; download_file fetches '${args.outFile}'). If re-running is cheap, ` +
|
|
223
|
+
`\`<command> | sed -n '${range}'\` does it in one call. `;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
msg +=
|
|
227
|
+
`To read the omitted part, re-run as \`<command> | sed -n '${range}'\` (repeat with a later start if that ` +
|
|
228
|
+
`is still over the limit), or narrow by content with grep. `;
|
|
229
|
+
}
|
|
230
|
+
msg += "'head' returns another prefix and cannot recover the omitted tail.";
|
|
231
|
+
parts.push(msg);
|
|
232
|
+
}
|
|
233
|
+
if (args.stderrTruncated) {
|
|
234
|
+
let msg = `stderr: ${fmt(args.stderrCapturedLength)} characters captured (after noise filtering), the first ` +
|
|
235
|
+
`${fmt(MAX_STDERR_RESPONSE)} returned` +
|
|
236
|
+
(args.stdoutTruncated ? ". " : "; stdout is complete. ");
|
|
237
|
+
if (args.outputDirSet) {
|
|
238
|
+
msg +=
|
|
239
|
+
`To keep all of stderr, re-run as \`( <command> ) 2> ${errPath}\` (the parentheses matter for a pipeline: ` +
|
|
240
|
+
`a bare 2> covers only its last stage; use \`( <command> ) > ${outPath} 2>&1\` for both streams) and ` +
|
|
241
|
+
`query that file with grep or sed -n.`;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
msg += "To see more of it, re-run as `( <command> ) 2>&1 | grep -i error` or with a similar filter.";
|
|
245
|
+
}
|
|
246
|
+
parts.push(msg);
|
|
247
|
+
}
|
|
248
|
+
return parts.join("\n");
|
|
38
249
|
}
|
|
39
250
|
// An actual js_unshroud capture invocation: the executable (wrapper, full or
|
|
40
251
|
// quoted path, or raw js_unshroud-linux-x64 binary) followed by the `run`
|
|
@@ -142,8 +353,7 @@ export async function handleRunTool(deps, args) {
|
|
|
142
353
|
}, startTime);
|
|
143
354
|
}
|
|
144
355
|
}
|
|
145
|
-
const MAX_STDOUT_RESPONSE =
|
|
146
|
-
const MAX_STDERR_RESPONSE = 50 * 1024;
|
|
356
|
+
const MAX_STDOUT_RESPONSE = STDOUT_CAP_CHARS; // 100KB — fits in LLM context
|
|
147
357
|
try {
|
|
148
358
|
const execOptions = {
|
|
149
359
|
timeout: (args.timeout || config.timeout) * 1000,
|
|
@@ -156,27 +366,67 @@ export async function handleRunTool(deps, args) {
|
|
|
156
366
|
let stdout = result.stdout || "";
|
|
157
367
|
let stderr = result.stderr || "";
|
|
158
368
|
stderr = filterStderrNoise(stderr);
|
|
159
|
-
let truncated = false;
|
|
160
369
|
const fullStdoutLength = stdout.length;
|
|
161
|
-
|
|
370
|
+
const stderrCapturedLength = stderr.length; // after noise filtering
|
|
371
|
+
const stdoutTruncated = stdout.length > MAX_STDOUT_RESPONSE;
|
|
372
|
+
const stderrTruncated = stderr.length > MAX_STDERR_RESPONSE;
|
|
373
|
+
const truncated = stdoutTruncated || stderrTruncated;
|
|
374
|
+
// Line accounting only on the (rare) truncated path; the returned stdout
|
|
375
|
+
// stays an exact slice with nothing appended, so a forged marker inside
|
|
376
|
+
// the sample's output cannot masquerade as server metadata.
|
|
377
|
+
let stdoutCapturedLines = 0;
|
|
378
|
+
let stdoutReturnedLines = 0;
|
|
379
|
+
if (stdoutTruncated) {
|
|
380
|
+
stdoutCapturedLines = countLines(stdout);
|
|
162
381
|
stdout = stdout.slice(0, MAX_STDOUT_RESPONSE);
|
|
163
|
-
|
|
382
|
+
// complete lines inside the slice; a trailing partial line is re-read by the recipe
|
|
383
|
+
for (let i = 0; i < stdout.length; i++)
|
|
384
|
+
if (stdout.charCodeAt(i) === 10)
|
|
385
|
+
stdoutReturnedLines++;
|
|
164
386
|
}
|
|
165
|
-
if (
|
|
387
|
+
if (stderrTruncated) {
|
|
166
388
|
stderr = stderr.slice(0, MAX_STDERR_RESPONSE);
|
|
167
|
-
truncated = true;
|
|
168
389
|
}
|
|
169
|
-
// Auto-parse output if command matches a known tool with a parser
|
|
390
|
+
// Auto-parse output if command matches a known tool with a parser. Parse
|
|
391
|
+
// the CAPTURED stdout (bounded), not just the returned slice, so a finding
|
|
392
|
+
// past the response cap is still reported; findings_scope says which.
|
|
170
393
|
let findings;
|
|
394
|
+
let findingsTotal;
|
|
171
395
|
let parsedMetadata;
|
|
396
|
+
let findingsScope;
|
|
172
397
|
const toolName = detectToolName(fullCommand);
|
|
173
|
-
|
|
174
|
-
|
|
398
|
+
const capturedStdout = result.stdout || "";
|
|
399
|
+
if (toolName && hasParser(toolName) && capturedStdout) {
|
|
400
|
+
const parseInput = stdoutTruncated ? capturedStdout.slice(0, PARSE_CAP_CHARS) : stdout;
|
|
401
|
+
const parsed = parseToolOutput(toolName, parseInput);
|
|
175
402
|
if (parsed.parsed) {
|
|
176
403
|
findings = parsed.findings;
|
|
177
404
|
parsedMetadata = parsed.metadata;
|
|
405
|
+
if (findings.length > MAX_FINDINGS) {
|
|
406
|
+
findingsTotal = findings.length;
|
|
407
|
+
findings = findings.slice(0, MAX_FINDINGS);
|
|
408
|
+
}
|
|
409
|
+
// The agent's own head/tail limited the producer: that loss is
|
|
410
|
+
// upstream of anything the server captured, so it takes precedence.
|
|
411
|
+
if (detectPipedLimiter(fullCommand)) {
|
|
412
|
+
findingsScope = "pipeline_limited";
|
|
413
|
+
}
|
|
414
|
+
else if (stdoutTruncated) {
|
|
415
|
+
findingsScope = capturedStdout.length > PARSE_CAP_CHARS ? "captured_prefix" : "captured_stdout";
|
|
416
|
+
}
|
|
178
417
|
}
|
|
179
418
|
}
|
|
419
|
+
// Spill the captured stdout to the output directory (bounded, hash-named,
|
|
420
|
+
// idempotent per command) so the omitted tail can be read without
|
|
421
|
+
// re-running the tool. Non-fatal: on failure the notice carries the
|
|
422
|
+
// re-run recipe instead.
|
|
423
|
+
const outFile = suggestedOutputFilename(fullCommand, toolName);
|
|
424
|
+
let stdoutSavedFile;
|
|
425
|
+
if (stdoutTruncated) {
|
|
426
|
+
const spill = await saveOversizedOutput(connector, config.outputDir, outFile, capturedStdout);
|
|
427
|
+
if (spill.saved)
|
|
428
|
+
stdoutSavedFile = outFile;
|
|
429
|
+
}
|
|
180
430
|
// Check for advisory (non-blocking guidance)
|
|
181
431
|
const advisory = getCommandAdvisory(fullCommand);
|
|
182
432
|
// Output-conditioned advisory (tools that exit 0 on failure); scans the
|
|
@@ -194,10 +444,31 @@ export async function handleRunTool(deps, args) {
|
|
|
194
444
|
exit_code: result.exitCode,
|
|
195
445
|
truncated,
|
|
196
446
|
...(truncated && {
|
|
197
|
-
truncation_notice:
|
|
198
|
-
|
|
447
|
+
truncation_notice: buildTruncationNotice({
|
|
448
|
+
stdoutTruncated,
|
|
449
|
+
stderrTruncated,
|
|
450
|
+
stdoutCapturedLength: fullStdoutLength,
|
|
451
|
+
stdoutCapturedLines,
|
|
452
|
+
stdoutReturnedLines,
|
|
453
|
+
stderrCapturedLength,
|
|
454
|
+
outputDirSet: Boolean(config.outputDir),
|
|
455
|
+
outFile,
|
|
456
|
+
savedFile: Boolean(stdoutSavedFile),
|
|
457
|
+
}),
|
|
458
|
+
full_stdout_length: fullStdoutLength, // legacy alias of stdout_captured_length
|
|
459
|
+
stdout_truncated: stdoutTruncated,
|
|
460
|
+
stderr_truncated: stderrTruncated,
|
|
461
|
+
stdout_captured_length: fullStdoutLength,
|
|
462
|
+
stderr_captured_length: stderrCapturedLength,
|
|
463
|
+
...(stdoutTruncated && {
|
|
464
|
+
stdout_captured_lines: stdoutCapturedLines,
|
|
465
|
+
stdout_returned_lines: stdoutReturnedLines,
|
|
466
|
+
}),
|
|
467
|
+
...(stdoutSavedFile && { stdout_saved_file: stdoutSavedFile }),
|
|
199
468
|
}),
|
|
200
469
|
...(findings && { findings, parsed_metadata: parsedMetadata }),
|
|
470
|
+
...(findingsTotal !== undefined && { findings_total: findingsTotal }),
|
|
471
|
+
...(findings && findingsScope && { findings_scope: findingsScope }),
|
|
201
472
|
...(advisory && { advisory }),
|
|
202
473
|
...(outputAdvisory && { output_advisory: outputAdvisory }),
|
|
203
474
|
}, startTime);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-tool.js","sourceRoot":"","sources":["../../src/handlers/run-tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAYtD,MAAM,oBAAoB,GAAyB;IACjD;QACE,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,4BAA4B;QACrC,UAAU,EACR,0FAA0F;YAC1F,+DAA+D;YAC/D,6EAA6E;KAChF;CACF,CAAC;AAWF,MAAM,iBAAiB,GAAsB;IAC3C;QACE,KAAK,EAAE,CAAC,GAAG,EAAE,EA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CAAC,CAAC;IACzC,8DAA8D;IAC9D,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAEpE,gDAAgD;IAChD,KAAK,MAAM,GAAG,IAAI,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC;QACrC,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACnD,OAAO,GAAG,CAAC,IAAI,CAAC;QAClB,CAAC;IACH,CAAC;IACD,iEAAiE;IACjE,IAAI,SAAS,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IACvC,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { OAuthTokenVerifier } from "@modelcontextprotocol/sdk/server/auth/provider.js";
|
|
2
3
|
import { type ConnectorConfig } from "./connectors/index.js";
|
|
3
4
|
export interface ServerConfig extends ConnectorConfig {
|
|
4
5
|
samplesDir: string;
|
|
@@ -14,4 +15,15 @@ export interface ServerConfig extends ConnectorConfig {
|
|
|
14
15
|
}
|
|
15
16
|
export declare function createServer(config: ServerConfig): Promise<McpServer>;
|
|
16
17
|
export declare function startServer(config: ServerConfig): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Bearer-token verifier for the HTTP transport.
|
|
20
|
+
*
|
|
21
|
+
* Exported so tests exercise the real verifier rather than a copy — a duplicated
|
|
22
|
+
* verifier in the test helper cannot catch a defect in this one.
|
|
23
|
+
*
|
|
24
|
+
* Throws InvalidTokenError, not a bare Error: requireBearerAuth maps
|
|
25
|
+
* InvalidTokenError to 401 and *anything else* to 500, so a bare Error reports a
|
|
26
|
+
* wrong token as a server fault.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createTokenVerifier(token: string): OAuthTokenVerifier;
|
|
17
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAoB,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAoB,MAAM,yCAAyC,CAAC;AAMtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAE5F,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA+C9E,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,YAAY,sBAoctD;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,iBAqCrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,CAYrE"}
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,9 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
5
5
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
6
6
|
import { createMcpExpressApp } from "@modelcontextprotocol/sdk/server/express.js";
|
|
7
7
|
import { requireBearerAuth } from "@modelcontextprotocol/sdk/server/auth/middleware/bearerAuth.js";
|
|
8
|
+
import { InvalidTokenError } from "@modelcontextprotocol/sdk/server/auth/errors.js";
|
|
8
9
|
import { createConnector } from "./connectors/index.js";
|
|
9
|
-
import { runToolSchema, getFileInfoSchema, listFilesSchema, extractArchiveSchema, uploadFromHostSchema, downloadFromUrlSchema, downloadFileSchema, analyzeFileSchema, suggestToolsSchema, extractIOCsSchema, checkToolsSchema, getToolHelpSchema, getReportTemplateSchema, getReportGuidanceSchema, getOsintGuidanceSchema, checkBehaviorPrerequisitesSchema, verifyStringUsageSchema, compareFilesSchema, } from "./schemas/tools.js";
|
|
10
|
+
import { runToolSchema, getFileInfoSchema, listFilesSchema, extractArchiveSchema, uploadFromHostSchema, downloadFromUrlSchema, downloadFileSchema, analyzeFileSchema, suggestToolsSchema, extractIOCsSchema, checkToolsSchema, getServerInfoSchema, getToolHelpSchema, getReportTemplateSchema, getReportGuidanceSchema, getOsintGuidanceSchema, checkBehaviorPrerequisitesSchema, verifyStringUsageSchema, compareFilesSchema, } from "./schemas/tools.js";
|
|
10
11
|
import { SessionState, DEFAULT_ARCHIVE_PASSWORD } from "./state/session.js";
|
|
11
12
|
import { handleRunTool } from "./handlers/run-tool.js";
|
|
12
13
|
import { handleGetFileInfo } from "./handlers/get-file-info.js";
|
|
@@ -18,6 +19,7 @@ import { handleDownloadFile } from "./handlers/download-file.js";
|
|
|
18
19
|
import { handleAnalyzeFile } from "./handlers/analyze-file.js";
|
|
19
20
|
import { handleExtractIOCs } from "./handlers/extract-iocs.js";
|
|
20
21
|
import { handleCheckTools } from "./handlers/check-tools.js";
|
|
22
|
+
import { handleGetServerInfo } from "./handlers/get-server-info.js";
|
|
21
23
|
import { handleSuggestTools } from "./handlers/suggest-tools.js";
|
|
22
24
|
import { handleGetToolHelp } from "./handlers/get-tool-help.js";
|
|
23
25
|
import { handleGetReportTemplate, handleGetReportGuidance } from "./handlers/report.js";
|
|
@@ -73,7 +75,10 @@ export async function createServer(config) {
|
|
|
73
75
|
sessionState,
|
|
74
76
|
};
|
|
75
77
|
// Tool: run_tool - Execute a command in REMnux
|
|
76
|
-
server.tool("run_tool", "Execute a command in REMnux. Supports piped commands (e.g., 'oledump.py sample.doc | grep VBA'
|
|
78
|
+
server.tool("run_tool", "Execute a command in REMnux. Supports piped commands (e.g., 'oledump.py /home/remnux/files/samples/sample.doc | grep VBA'; " +
|
|
79
|
+
"use input_file for a single-tool command, or an absolute path inline when piping). " +
|
|
80
|
+
"stdout is returned whole up to 102,400 characters (see the command parameter for the truncation contract), " +
|
|
81
|
+
"so do not pre-cap output with '| head'; filter by content with grep instead. " +
|
|
77
82
|
"String extraction: For PE files use 'pestr'; for non-PE use 'strings' (ASCII) and 'strings -el' (Unicode). " +
|
|
78
83
|
"Note: capa matches under namespaces like collection/* or data-manipulation/* can be artifact-level (matched " +
|
|
79
84
|
"on strings/data) rather than behavioral; a behavioral capability requires the corresponding APIs to be " +
|
|
@@ -125,10 +130,12 @@ export async function createServer(config) {
|
|
|
125
130
|
"Returns file metadata (hashes, type, size). Supports custom HTTP headers " +
|
|
126
131
|
"and an optional thug mode for sites requiring JavaScript execution.", downloadFromUrlSchema.shape, (args) => handleDownloadFromUrl(deps, args));
|
|
127
132
|
// Tool: download_file - Download a file from the output directory
|
|
128
|
-
server.tool("download_file", "Download a file from the output directory
|
|
133
|
+
server.tool("download_file", "Download a file from the output directory to a directory on the host (output_path); returns the host path. " +
|
|
134
|
+
"Use this to retrieve analysis results, including the text files the server saves when tool output exceeds " +
|
|
135
|
+
"a response budget (run_tool: stdout_saved_file, e.g. run_tool-<tool>-<hash>.stdout.txt; analyze_file: " +
|
|
136
|
+
"<tool>-<sample>.txt). To read such a file in-session instead, use run_tool with grep/sed -n on %OUTPUT%/<file>. " +
|
|
129
137
|
"Files are wrapped in a password-protected archive by default to prevent AV/EDR triggers. " +
|
|
130
|
-
"Pass archive: false for harmless files like text reports.
|
|
131
|
-
"Provide output_path to save directly to the host filesystem.", downloadFileSchema.shape, (args) => handleDownloadFile(deps, args));
|
|
138
|
+
"Pass archive: false for harmless files like text reports.", downloadFileSchema.shape, (args) => handleDownloadFile(deps, args));
|
|
132
139
|
// Tool: analyze_file - Auto-analyze a file using appropriate REMnux tools
|
|
133
140
|
server.tool("analyze_file", "Auto-analyze a file using REMnux tools appropriate for the detected file type. Runs `file` to detect type, then executes matching tools (e.g., PE → peframe/capa, PDF → pdfid/pdf-parser, Office → olevba/oleid). Use `depth` to control analysis intensity: 'quick' (triage only), 'standard' (default), 'deep' (includes expensive tools). Note: 'standard' is sufficient for most files; use 'deep' only when standard doesn't reveal enough. Output includes a capability_evidence field (behavior_capable vs artifact_only) and per-capa evidence_types tags so you can tell code-backed capabilities from data-only artifacts — an artifact_only match means the data is present, not that the behavior executes.", analyzeFileSchema.shape, (args) => handleAnalyzeFile(deps, args));
|
|
134
141
|
// Tool: suggest_tools - Get tool recommendations for a file
|
|
@@ -139,7 +146,9 @@ export async function createServer(config) {
|
|
|
139
146
|
"static analysis — plan for emulation (speakeasy) or sandbox detonation when a behavioral claim is needed.", suggestToolsSchema.shape, (args) => handleSuggestTools(deps, args));
|
|
140
147
|
// Tool: extract_iocs - Extract IOCs from text
|
|
141
148
|
server.tool("extract_iocs", "Extract IOCs (IPs, domains, URLs, hashes, registry keys, etc.) from text. " +
|
|
142
|
-
"Pass output from run_tool or analyze_file to identify indicators. " +
|
|
149
|
+
"Pass output from run_tool or analyze_file to identify indicators. If that output was truncated " +
|
|
150
|
+
"(truncated: true), first read the saved file via run_tool (e.g. grep -iE 'https?://|[0-9]+\\.[0-9]+\\.' on " +
|
|
151
|
+
"%OUTPUT%/<stdout_saved_file>) and pass that output, or the IOCs past the cut are missed. " +
|
|
143
152
|
"Works well with Volatility 3 plugin output (netscan, cmdline, filescan). " +
|
|
144
153
|
"Returns deduplicated IOCs with confidence scores. " +
|
|
145
154
|
"Note: an IOC extracted from a binary's strings is an artifact (present in the file) — not evidence the " +
|
|
@@ -172,6 +181,10 @@ export async function createServer(config) {
|
|
|
172
181
|
"so you can understand available flags, options, and usage patterns.", getToolHelpSchema.shape, (args) => handleGetToolHelp(deps, args));
|
|
173
182
|
// Tool: check_tools - Check tool availability
|
|
174
183
|
server.tool("check_tools", "Check which REMnux analysis tools are installed and available. Returns a summary of installed vs missing tools across all file type categories.", checkToolsSchema.shape, () => handleCheckTools(deps));
|
|
184
|
+
// Tool: get_server_info - Server version, connector mode, REMnux version
|
|
185
|
+
server.tool("get_server_info", "Report the remnux-mcp-server version, how it reaches REMnux (connector mode and transport), " +
|
|
186
|
+
"and the REMnux distro version on the target. Use for diagnostics and when documenting which " +
|
|
187
|
+
"server/REMnux versions produced an analysis.", getServerInfoSchema.shape, () => handleGetServerInfo(deps, pkgVersion));
|
|
175
188
|
// Tool: get_report_template - Bundled malware analysis report template (offline)
|
|
176
189
|
server.tool("get_report_template", "Get a malware analysis report template (Markdown) bundled locally for offline use. " +
|
|
177
190
|
"Created by Lenny Zeltser, licensed CC BY 4.0. Use it to structure a report after analyzing a sample. " +
|
|
@@ -340,6 +353,29 @@ export async function startServer(config) {
|
|
|
340
353
|
console.error(`REMnux MCP server started${warnings}`);
|
|
341
354
|
}
|
|
342
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* Bearer-token verifier for the HTTP transport.
|
|
358
|
+
*
|
|
359
|
+
* Exported so tests exercise the real verifier rather than a copy — a duplicated
|
|
360
|
+
* verifier in the test helper cannot catch a defect in this one.
|
|
361
|
+
*
|
|
362
|
+
* Throws InvalidTokenError, not a bare Error: requireBearerAuth maps
|
|
363
|
+
* InvalidTokenError to 401 and *anything else* to 500, so a bare Error reports a
|
|
364
|
+
* wrong token as a server fault.
|
|
365
|
+
*/
|
|
366
|
+
export function createTokenVerifier(token) {
|
|
367
|
+
const tokenBuf = Buffer.from(token);
|
|
368
|
+
return {
|
|
369
|
+
async verifyAccessToken(t) {
|
|
370
|
+
const inputBuf = Buffer.from(t);
|
|
371
|
+
const match = inputBuf.length === tokenBuf.length && timingSafeEqual(inputBuf, tokenBuf);
|
|
372
|
+
if (!match) {
|
|
373
|
+
throw new InvalidTokenError("Invalid token");
|
|
374
|
+
}
|
|
375
|
+
return { token: t, clientId: "remnux-client", scopes: [], expiresAt: Math.floor(Date.now() / 1000) + 86400 };
|
|
376
|
+
},
|
|
377
|
+
};
|
|
378
|
+
}
|
|
343
379
|
async function startHttpServer(config) {
|
|
344
380
|
const host = config.httpHost ?? "127.0.0.1";
|
|
345
381
|
const port = config.httpPort ?? 3000;
|
|
@@ -357,18 +393,7 @@ async function startHttpServer(config) {
|
|
|
357
393
|
const app = createMcpExpressApp({ host });
|
|
358
394
|
// Bearer token auth middleware
|
|
359
395
|
if (token) {
|
|
360
|
-
|
|
361
|
-
const verifier = {
|
|
362
|
-
async verifyAccessToken(t) {
|
|
363
|
-
const inputBuf = Buffer.from(t);
|
|
364
|
-
const match = inputBuf.length === tokenBuf.length && timingSafeEqual(inputBuf, tokenBuf);
|
|
365
|
-
if (!match) {
|
|
366
|
-
throw new Error("Invalid token");
|
|
367
|
-
}
|
|
368
|
-
return { token: t, clientId: "remnux-client", scopes: [], expiresAt: Math.floor(Date.now() / 1000) + 86400 };
|
|
369
|
-
},
|
|
370
|
-
};
|
|
371
|
-
app.use("/mcp", requireBearerAuth({ verifier }));
|
|
396
|
+
app.use("/mcp", requireBearerAuth({ verifier: createTokenVerifier(token) }));
|
|
372
397
|
}
|
|
373
398
|
else {
|
|
374
399
|
console.error("WARNING: No auth token configured. Set --http-token or MCP_TOKEN env var for production use.");
|
|
@@ -436,6 +461,25 @@ async function startHttpServer(config) {
|
|
|
436
461
|
}
|
|
437
462
|
}
|
|
438
463
|
});
|
|
464
|
+
// Express's default error handler renders an HTML page. On a JSON-RPC endpoint
|
|
465
|
+
// that breaks any conforming client, which parses the response as JSON — most
|
|
466
|
+
// visibly for body-parser's 413 (request entity too large) and its 400 on
|
|
467
|
+
// malformed JSON. Answer in JSON-RPC instead.
|
|
468
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
469
|
+
app.use("/mcp", (err, _req, res, next) => {
|
|
470
|
+
if (res.headersSent)
|
|
471
|
+
return next(err);
|
|
472
|
+
const status = typeof err?.status === "number" ? err.status : 500;
|
|
473
|
+
const code = status === 413 ? -32600 : status === 400 ? -32700 : -32603;
|
|
474
|
+
// Name the recovery path on 413 so an AI client self-heals instead of
|
|
475
|
+
// dead-ending: the limit is body-parser's 100kb default, applied inside the
|
|
476
|
+
// SDK's createMcpExpressApp, and large text belongs in a file rather than in
|
|
477
|
+
// a request body (or the model's context) anyway.
|
|
478
|
+
const message = status === 413 ? "Request entity too large. Write the text to a file in the samples directory, then process it with run_tool instead of sending it inline."
|
|
479
|
+
: status === 400 ? "Parse error"
|
|
480
|
+
: "Internal error";
|
|
481
|
+
res.status(status).json({ jsonrpc: "2.0", error: { code, message }, id: null });
|
|
482
|
+
});
|
|
439
483
|
const warnings = !(config.noSandbox ?? false)
|
|
440
484
|
? ` (upload_from_host confined to ${config.ingestRoot ?? config.samplesDir})`
|
|
441
485
|
: " (WARNING: sandbox disabled)";
|