Forge Test MCP
What it does
Runs Foundry tests and builds; returns compact, structured failures to AI coding agents
- Connects 在你的电脑上运行
- Account or key No key needed
- Category 开发者工具
安装
选择你使用的 AI 应用,然后复制设置。
通过 3/3 项检查 · 在你的电脑上运行 · ✓ 命令已检查 2026年11月13日
第一步:你用哪个 AI?
选择你用的应用,步骤会显示在下方。
可连接 Claude,但需要先准备
需要先在电脑上安装 Node.js(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
打开电脑版 Claude 应用的设置文件
SettingsDeveloperEdit Config
粘贴这些设置并保存文件
{ "mcpServers": { "forge-test": { "command": "npx", "args": [ "-y", "forge-test-mcp" ] } } }退出 Claude 再重新打开
试一试
用 Forge Test MCP 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude 说正在使用 Forge Test MCP,或回答中出现 Forge Test MCP 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
ChatGPT 暂时无法连接 Forge Test MCP
Forge Test MCP 需要安装在你的电脑上,而 ChatGPT 只能连接在网上运行的服务器
你可以改用这些方式
A · 使用能连接 Forge Test MCP 的应用
- 需要先在电脑上安装 Node.js(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
- 需要先在电脑上安装 Node.js(只需一次)
- 需要先在电脑上安装 Node.js(只需一次)
- 需要先在电脑上安装 Node.js(只需一次)
B · 开发者工具 类中能连接 ChatGPT 的其他服务器
从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的
- Sentry✓ ChatGPT
- Compiler Explorer✓ ChatGPT
- GitDiagram✓ ChatGPT
可连接 Claude Code,但需要先准备
需要先在电脑上安装 Node.js(只需一次)
打开终端
Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell
粘贴这条命令并按 Enter
claude mcp add --scope user forge-test -- npx -y forge-test-mcp在 Claude Code 中输入 /mcp
应能看到 Forge Test MCP 在列表中并显示已连接
试一试
用 Forge Test MCP 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude Code 说正在使用 Forge Test MCP,或回答中出现 Forge Test MCP 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
可连接 Cursor,但需要先准备
需要先在电脑上安装 Node.js(只需一次)
在 Cursor 中以 Agent 模式打开 AI 聊天
试一试
用 Forge Test MCP 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Cursor 说正在使用 Forge Test MCP,或回答中出现 Forge Test MCP 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同
可连接 VS Code,但需要先准备
需要先在电脑上安装 Node.js(只需一次)
在 VS Code 中以 Agent 模式打开 AI 聊天
试一试
用 Forge Test MCP 告诉我你能帮我做什么,然后做一件给我看✓ 如果 VS Code 说正在使用 Forge Test MCP,或回答中出现 Forge Test MCP 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同
开发者专用:终端命令和 JSON 设置
安装在电脑上
Claude Code
claude mcp add --scope user forge-test -- npx -y forge-test-mcpClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"forge-test": {
"command": "npx",
"args": [
"-y",
"forge-test-mcp"
]
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"forge-test": {
"command": "npx",
"args": [
"-y",
"forge-test-mcp"
]
}
}
}VS Code (mcp.json)
{
"servers": {
"forge-test": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"forge-test-mcp"
]
}
}
}这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
一览
哪些应用可以使用它
依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。
在你的电脑上运行,适用于
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
它能做什么
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
基础检查i
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月14日
- ✓ 通过
作者与仓库一致
注册名称已通过 GitHub 账户 vschernoff 验证,该账户拥有此仓库
- ✓ 通过
仍在维护
代码最后更新于前天
- ✓ 通过
有许可证
使用 MIT
- – 不适用
端点有响应
它在你的电脑上运行,没有互联网端点
- – 不适用
使用 OAuth 登录
在你的电脑上运行,改用本地设置
- … 尚未检查
工具描述中没有隐藏指令
它在你的电脑上运行;我们只能读取互联网端点的工具列表
讨论
提问、分享技巧或报告无法使用。按“有帮助”数量排序。
用户评价
还没有评价
与“开发者工具”中的其他服务器比较i
- 星标数多于此分类中其他 5886 个服务器的 69%
- 发布到注册中心的时间比此分类中其他 5886 个服务器的 59% 更新
- 基础检查结果等于或优于此分类中其他 5886 个服务器的 100%
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
常见问题
Forge Test MCP 安全吗?
它在 3 项适用的基础检查中通过了 3 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
它需要哪些密钥或代码?
注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。
它在我的电脑上运行还是在云端?
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
它还在维护吗?
GitHub 仓库最后更新于前天,最新版本(0.1.0)于19天前进入注册中心。
哪些应用可以使用它?
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Node.js。
有什么可以替代它?
同一分类中有:REA, GitHub, Serena MCP: the IDE for your agent
同类别的其他选择
同一分类中其他作者的服务器,按星标数排序。
如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
GitHub
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Serena MCP: the IDE for your agent
A powerful toolkit for coding, providing semantic retrieval and editing capabilities.
作者的 README
打开 README
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
forge-test-mcp
An MCP server that runs Foundry's forge test and forge build and returns compact, structured results an AI coding agent can act on: for every failing test, its kind, the decoded reason, the fuzz counterexample or invariant call sequence, console logs and a short decoded trace. It speaks standard MCP over stdio and is meant for any MCP client (Claude Code, Codex, Cursor, Claude Desktop, Windsurf, …). So far it has been tested with an MCP test client, not yet inside each of those clients.
When forge did not run the tests (a compile error, no matching tests, a timeout, a missing or unsupported forge, …) the tool says so as an error. It never reports "0 failed" for tests that did not run.
Status: 0.1.0, the first release. See CHANGELOG.md for what is in it
and what is not yet verified.
Before you use it
- Running tests runs code.
forge testexecutes the project's Solidity with your user's rights. Use this server only on projects you would test in a terminal yourself. - FFI is off unless you start the server with
--allow-ffi, even whenfoundry.tomlenables it. forge runs with--offline, but tests can still reach the network themselves, for example through fork cheatcodes. - No transactions. No tool sends transactions, deploys, signs or takes a key.
- Passing tests do not prove a contract is secure.
Details in Security and trust.
Requirements
- Node.js 22 or later.
- Foundry with
forge1.8.5 or a later 1.8.x. You install it; this server never installs or updates anything. Newer versions run but are flagged as untested. - The project's compiler version installed once: run
forge buildin a terminal first. The server runs forge with--offline, so it cannot download solc itself.
Configure your MCP client
Start the server in your Foundry project (the directory with foundry.toml, or below it). Most clients accept this mcpServers entry:
{
"mcpServers": { "forge-test": { "command": "npx", "args": ["-y", "forge-test-mcp@0.1.0"] } } }
Pin an exact version, as above. Client shortcuts, from each vendor's documentation (checked 2026-10-23, not yet verified by running each client):
- Claude Code: put the JSON above in
.mcp.jsonat the project root. In interactive sessions Claude Code asks you to approve project servers the first time. - Cursor: put it in
.cursor/mcp.json, adding"type": "stdio"to the server entry. - Codex: in
.codex/config.toml(loaded for trusted projects only) or~/.codex/config.toml:
[mcp_servers.forge-test]
command = "npx" args = ["-y", "forge-test-mcp@0.1.0"]
Docker
The image contains the server and forge 1.8.6, the official static Alpine build. The build checks the download against pinned SHA-256 digests; those digests were taken from the release's provenance attestation and verified when they were pinned. Mount the project at /project and a cache volume at /cache, where forge keeps the compiler:
docker build -t forge-test-mcp .
docker run --rm -v "$PWD":/project -v forge-test-mcp-cache:/cache --entrypoint forge forge-test-mcp build
The second command installs the project's solc once, online. Then configure the client to run docker with ["run", "-i", "--rm", "-v", " :/project", "-v", "forge-test-mcp-cache:/cache", "forge-test-mcp"]. forge writes out/ and cache/ into the project, so on Linux add --user "$(id -u):$(id -g)" to both commands.
Options
Options go after the package name in args. Only the user sets them; no tool argument can.
| Option | Meaning |
|---|---|
--root | Project directory (default: where the client starts the server). |
--forge | The forge executable (default: forge on PATH). |
--timeout | Stop a forge run after this long (default 300). |
--allow-ffi | Let tests use FFI cheatcodes when foundry.toml enables them. Off by default; see below. |
--strict-version | Refuse forge versions newer than the tested range instead of flagging them. |
Tools
| Tool | What it does |
|---|---|
run_tests | Runs forge test. Filters: match_test, match_contract, match_path; fuzz_runs; traces (default true); max_bytes (default 8192). |
explain_failure | Re-runs one test at high verbosity and returns only that test: reason, counterexample, logs, backtrace and the decoded trace. Pass the name as run_tests prints it, e.g. "BankTest.test_transfer()". |
build | Runs forge build and returns compiler errors and warnings with file, line, column and code. force: true recompiles everything. |
None of them sends transactions, deploys, signs or accepts keys.
A failing run_tests result looks like this:
{
"status": "failed", "forge": "1.8.6", "summary": { "suites": 1, "passed": 1, "failed": 1, "skipped": 0 }, "ffi": "disabled", "fuzzRuns": { "configured": 256, "used": 256 }, "notRun": [], "failures": [ { "test": "SupplyInvariantTest.invariant_supplyMatches()", "file": "test/Supply.t.sol", "kind": "invariant", "reason": "supply mismatch: 6683 != 6355", "sequence": { "calls": [ { "call": "Handler.mint(uint256)", "args": "6683", "sender": "0x…022f" }, { "call": "Handler.burnFrom(uint256)", "args": "328", "sender": "0x…054e" } ], "shrunkFrom": 4 }, "trace": [ "[21670] SupplyInvariantTest::invariant_supplyMatches()", " ├─ [0] VM::assertEq(6683, 6355, \"supply mismatch\") [staticcall]", " │ └─ ← [Revert] supply mismatch: 6683 != 6355", " └─ ← [Revert] supply mismatch: 6683 != 6355" ], "traceLinesOmitted": 16 } ], "truncated": null }
Responses stay within the size budget. When there is more than fits, traces and logs go first, then whole failures, and truncated says exactly how many were left out.
When the tests did not run
The result is an MCP error (isError: true) with a code, a message and a hint:
| Code | Cause |
|---|---|
COMPILE_FAILED | The project does not compile (the first compiler errors are included). |
NO_TESTS_RAN | No test matched the filters, or every matched test was skipped. |
NOT_A_FOUNDRY_PROJECT | No foundry.toml here or above it in the repository. |
FORGE_NOT_FOUND, UNSUPPORTED_FORGE_VERSION | forge is missing, or older than 1.8.5. |
SOLC_MISSING | Run forge build once in a terminal so forge can install the compiler. |
TIMEOUT | The run took longer than --timeout; forge reports nothing until it finishes. |
CONFIG_ERROR, INVALID_ARGUMENTS, FORGE_CRASHED, FORGE_FAILED, UNPARSEABLE_OUTPUT, INCONSISTENT_RESULT, OUTPUT_TOO_LARGE, FFI_OVERRIDE_FAILED | forge could not produce a trustworthy report; the message and stderr say why. |
Report a problem or suggest an improvement
- Problem or wrong result: open an issue. Include the version, your client, what was run and the output. Don't include keys,
.envcontents, RPC URLs with API keys, or code you can't share. - Security problem: report it privately, see SECURITY.md.
- You can ask your coding agent to draft the report from your session. Read it before you post it: nothing is sent unless you send it. This project collects no telemetry.
Security and trust
Running tests runs code. forge test executes the project's Solidity and cheatcodes with your user's rights, just as it does in a terminal. Only use this server on projects you would test in a terminal yourself. It cannot make an untrusted repository safe.
What the server does to reduce that risk:
- FFI is off unless you opt in. FFI cheatcodes run arbitrary shell commands. forge ignores
FOUNDRY_FFIin the environment, so whenfoundry.tomlsetsffi = truethe server runs forge with a copy of the resolved configuration that hasffi = false, and checks through forge that it took effect before running anything. Start the server with--allow-ffiif you want FFI. - No downloads. forge always runs with
--offline, so forge itself makes no network lookups. Tests can still reach the network on their own, for example fork tests throughvm.createSelectForkand RPC endpoints. - No shell. forge is started with an argument list. Tool arguments are validated and passed as single
--flag=valuearguments. - Secrets. forge loads the project's
.envitself, so tests can read and print those values. The server replaces the exact values of variables named like*PRIVATE_KEY*,*MNEMONIC*,*SECRET*,*TOKEN*,*API_KEY*and*RPC_URL*(RPC URLs often embed an API key), from its environment and.env, with[redacted:NAME]. A hex value such as a private key is also caught without0x, in either case, without leading zeros, and in decimal (asvm.envUintandconsole.logprint it). It cannot catch a secret printed in any other form. Keep spendable keys out of projects you test with an agent. - No transactions. No tool broadcasts, deploys, signs or takes a key.
To report a vulnerability, see SECURITY.md.
Passing tests do not prove a contract is secure. They show the tests you wrote pass. Contracts that will hold value need an independent audit.
Foundry compatibility
Tested in CI against forge 1.8.5 and 1.8.6 on Linux, macOS and Windows. Supported range: >=1.8.5 <1.9.0. Older versions are refused. Newer ones run with a forgeUntested