foundry
An experimental MCP Server for foundry built for Solidity devs
claude mcp add --transport stdio praneshasp-foundry-mcp-server npx @pranesh.asp/foundry-mcp-server \ --env RPC_URL="" \ --env PRIVATE_KEY=""
How to use
This MCP server exposes Foundry-based Solidity development and on-chain interaction tools to MCP clients. It connects to a local or remote Ethereum-compatible network via RPC and leverages the Foundry toolchain (Forge, Cast, and Anvil) along with Heimdall for smart contract analysis. Through the MCP interface, clients can start and manage local Anvil instances, deploy and test Solidity code, run Forge scripts, call read-only contract functions, send transactions (when a PRIVATE_KEY is provided), inspect transaction receipts and storage, and perform advanced analysis such as bytecode disassembly, calldata decoding, and decompilation. The server also exposes utilities for computing addresses, estimating gas, converting units, and generating wallets, making it a comprehensive Solidity development assistant integrated into the MCP ecosystem.
How to install
Prerequisites:
- Node.js v18+ and npm/yarn
- Foundry toolchain (Forge, Cast, Anvil)
- Heimdall-rs (for advanced contract analysis)
Installation steps:
-
Install Foundry tools (if not already installed): curl -L https://foundry.paradigm.xyz | bash foundryup
-
Install and build the MCP server package:
Using Bun (as suggested by the project) or npm/yarn as an alternative
bun i bun build ./src/index.ts --outdir ./dist --target node
-
Run the server via npx (as an MCP server): npx @pranesh.asp/foundry-mcp-server
-
Optional: configure your MCP client with the server details. Example (Claude Desktop or other MCP clients): { "mcpServers": { "foundry": { "command": "npx", "args": ["@pranesh.asp/foundry-mcp-server"], "env": { "RPC_URL": "http://localhost:8545", "PRIVATE_KEY": "0x..." } } } }
-
If you prefer a global install: npm install -g @pranesh.asp/foundry-mcp-server npx @pranesh.asp/foundry-mcp-server
Additional notes
Environment variables:
- RPC_URL: RPC endpoint to use when not specified by the client (optional)
- PRIVATE_KEY: Private key for sending transactions (optional; avoid using mainnet funds in development)
Common issues:
- Ensure JSON configuration is valid (validate with jq or a linter to avoid trailing commas or missing quotes).
- If you see "Invalid configuration" errors in the MCP client, re-check the JSON and the environment variable names.
Workspace:
- The server maintains a persistent Forge workspace at ~/.mcp-foundry-workspace for Solidity files, scripts, and dependencies.
Security:
- Do not expose PRIVATE_KEY publicly. Use it only for development/testing purposes.
Related MCP Servers
gemini-cli
An open-source AI agent that brings the power of Gemini directly into your terminal.
rohlik
MCP server that lets you shop groceries across the Rohlik Group platforms (Rohlik.cz, Knuspr.de, Gurkerl.at, Kifli.hu, Sezamo.ro)
marinade-finance
Marinade Finance MCP Server is an MCP server specifically designed for the Marinade Finance.
mcp -arangodb
This is a TypeScript-based MCP server that provides database interaction capabilities through ArangoDB. It implements core database operations and allows seamless integration with ArangoDB through MCP tools. You can use it wih Claude app and also extension for VSCode that works with mcp like Cline!
jigsawstack
Model Context Protocol Server that allows AI models to interact with JigsawStack models!
mcp-rfc
An MCP server for fetching RFC related information.