anvil_startLABSCO SUMMARY
Onchain investigation and Solidity work in the same session.
The reading half - traces, storage, decompiled bytecode - is where this earns its place: an unverified contract stops being opaque. The writing half is real too, and the project is blunt about the risk: give it a key with testnet funds only, because a model that hallucinates here spends money.
What it is
An MCP layer over the Foundry toolchain. It keeps a persistent Forge workspace at ~/.mcp-foundry-workspace, so Solidity files, scripts and installed dependencies survive between calls.
What you get
- Start, stop and inspect a local Anvil instance, or point the same tools at any RPC endpoint
- Read-only contract calls, transactions, receipts, raw storage slots and event logs
- Replay a published transaction locally, and look up a function or event signature from the 4byte directory
- Write Solidity into the workspace, install dependencies, and run a Forge script
- Unit conversion between wei, gwei and hex, deployed-address computation, bytecode size and gas estimates
- Heimdall analysis: disassemble bytecode, decode calldata without an ABI, decompile to Solidity, or draw a control flow graph
Requirements
Node.js v18+ and the Foundry toolchain (Forge, Cast, Anvil) installed. Heimdall-rs is needed only for the bytecode-analysis tools. Run it with npx @pranesh.asp/foundry-mcp-server. RPC_URL and PRIVATE_KEY are both optional environment variables - without a private key the server is read-only.
Setup effort
One command — npx @pranesh.asp/foundry-mcp-server
USE CASES
Working out what an unverified contract does
Decompile the deployed bytecode to Solidity and an ABI, then disassemble the parts that still look wrong.
Explaining a transaction someone sent you
Pull the receipt, decode the calldata without needing an ABI, then replay the transaction locally to see the trace.
Trying a contract change against a local chain
Start Anvil, write the Solidity into the workspace, install what it imports, and run the Forge script against the local node.
Checking a deployment before you pay for it
Compute the address the contract would land on, estimate the gas, and check the bytecode size against the limit.
27 tools
Listed in project docs. Your client may show a different list.
anvil_stopanvil_statuscast_callcast_sendcast_balancecast_receiptcast_storagecast_runcast_logscast_sigcast_4bytecast_chainforge_scriptinstall_dependencycreate_solidity_fileread_filelist_filesconvert_eth_unitscompute_addresscontract_sizeestimate_gasheimdall_disassembleheimdall_decodeheimdall_decompileheimdall_cfgheimdall_inspectBEFORE YOU INSTALL
What to know first
Tools you get
27 tools named in the project's documentation. The five heimdall_ tools need heimdall-rs installed separately. cast_send, the only tool that writes to a chain, needs PRIVATE_KEY; without it the other twenty-six run read-only.
Requires
npx on PATH
INSTALLATION
Connect your client
Server setup
npx @pranesh.asp/foundry-mcp-serverMCP Clients
Claude Code
claude mcp add-json foundry-mcp-server '{"type":"stdio","command":"npx","args":["@pranesh.asp/foundry-mcp-server"],"env":{"RPC_URL":"","PRIVATE_KEY":""}}'Cursor, Claude Desktop, Windsurf
{
"mcpServers": {
"foundry": {
"command": "npx",
"args": [
"@pranesh.asp/foundry-mcp-server"
],
"env": {
"RPC_URL": "http://localhost:8545",
"PRIVATE_KEY": "<YOUR_PRIVATE_KEY>"
}
}
}
}Claude Desktop — local build
{
"mcpServers": {
"foundry": {
"command": "node",
"args": [
"<YOUR_PATH_TO_FOUNDRY_MCP_SERVER>/dist/index.js"
],
"env": {
"PRIVATE_KEY": "0x1234"
}
}
}
}