Get the FREE Ultimate OpenClaw Setup Guide →

foundry

An experimental MCP Server for foundry built for Solidity devs

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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:

  1. Install Foundry tools (if not already installed): curl -L https://foundry.paradigm.xyz | bash foundryup

  2. 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

  3. Run the server via npx (as an MCP server): npx @pranesh.asp/foundry-mcp-server

  4. 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..." } } } }

  5. 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

Sponsor this space

Reach thousands of developers