forge-test-mcp

v0.1.0
io.github.vschernoff/forge-test-mcp Checked 2 hours ago Published 1 month ago

Runs Foundry tests and builds; returns compact, structured failures to AI coding agents

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

run_tests

Run `forge test` and return a compact summary: counts, and for each failing test its kind (unit, fuzz, invariant, setup), decoded reason, fuzz counterexample or invariant call sequence, and console logs. isError means the tests did not run (compile error, no matching tests, timeout, missing forge, …); never report that as passing.

ParameterTypeDescription
fuzz_runsintegerOverride fuzz runs. A value below the project setting is reported as reduced; do not use it to make tests pass.
match_contractstringOnly run test contracts matching this regex.
match_pathstringOnly run test files matching this glob.
match_teststringOnly run test functions matching this regex.
max_bytesintegerResponse size budget in bytes (default 8192).
tracesbooleanAttach a decoded trace excerpt to the first 5 failures (a second, text-mode forge run). Default true.

explain_failure

Re-run one test at high verbosity and return only that test: its reason, decoded call trace (trimmed to the path to the revert when long), backtrace, logs and, for fuzz or invariant tests, the counterexample. Pass the test name as run_tests reports it, e.g. "BankTest.test_transfer()".

ParameterTypeDescription
test *stringTest function, optionally with its contract: "Contract.test_name()".
contractstringTest contract, if not given in `test`.
max_bytesintegerResponse size budget in bytes (default 8192).

build

Compile the project with `forge build` and return compiler errors and warnings as structured items (file, line, column, code, message). Unchanged files are not recompiled and forge does not repeat their warnings; pass force: true to recompile everything.

ParameterTypeDescription
forcebooleanRecompile everything, so warnings for unchanged files are reported again.
max_bytesintegerResponse size budget in bytes (default 8192).