Foundry Toolkit

Foundry Toolkit

praneshasp

Connects AI assistants to the Foundry blockchain toolkit for smart contract development, testing, and analysis. Provides access to Forge, Cast, and Anvil tools for EVM blockchain operations.

Integrates with Foundry blockchain development toolkit to enable smart contract deployment, testing, bytecode analysis, and transaction inspection across local Anvil instances and remote EVM networks.

242267 views38Local (stdio)

What it does

  • Deploy and test smart contracts using Forge
  • Start local Anvil blockchain instances
  • Analyze contract bytecode and decompile to Solidity
  • Call contract functions and send transactions
  • Decode transaction calldata and generate traces
  • Calculate gas costs and contract addresses

Best for

Solidity developers building smart contractsBlockchain analysts inspecting contract bytecodeDeFi developers testing on local networksSmart contract auditors analyzing transactions
Full Foundry toolchain integrationBytecode decompilation with HeimdallLocal and remote network support

About Foundry Toolkit

Foundry Toolkit is a community-built MCP server published by praneshasp that provides AI assistants with tools and capabilities via the Model Context Protocol. Foundry Toolkit: Deploy, test, and analyze smart contracts on EVM networks and local Anvil with powerful blockchain dev It is categorized under analytics data, developer tools.

How to install

You can install Foundry Toolkit in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

License

Foundry Toolkit is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

Foundry MCP Server

A simple, lightweight and fast MCP (Model Context Protocol) server that provides Solidity development capabilities using the Foundry toolchain (Forge, Cast, and Anvil).

Foundry MCP Demo

Overview

This server connects LLM assistants to the Foundry ecosystem, enabling them to:

  • Interact with nodes (local Anvil instances or remote RPC endpoints)
  • Analyze smart contracts and blockchain data
  • Perform common EVM operations using Cast
  • Manage, deploy, and execute Solidity code and scripts
  • Work with a persistent Forge workspace

Features

Network Interaction

  • Start and manage local Anvil instances
  • Connect to any remote network (just specify the RPC)
  • Get network/chain information

Contract Interaction

  • Call contract functions (read-only)
  • Send transactions to contracts (if PRIVATE_KEY is configured)
  • Get transaction receipts
  • Read contract storage
  • Analyze transaction traces
  • Retrieve contract ABIs and sources from block explorers

Solidity Development

  • Maintain a dedicated Forge workspace
  • Create and edit Solidity files
  • Install dependencies
  • Run Forge scripts
  • Deploy contracts

Utility Functions

  • Calculate contract addresses
  • Check contract bytecode size
  • Estimate gas costs
  • Convert between units (hex to decimals, etc.,)
  • Generate wallets
  • Get event logs
  • Lookup function and event signatures

Smart Contract Analysis (Heimdall)

  • Disassemble EVM bytecode into human-readable opcodes
  • Decode raw calldata without requiring ABI
  • Decompile EVM bytecode to Solidity source code and ABI
  • Generate visual control flow graphs for EVM bytecode
  • Detailed transaction inspection with calldata decoding and trace analysis

Usage

The server is designed to be used as an MCP tool provider for MCP Clients. When connected to a client, it enables the clients(claude desktop, cursor, client, etc.,) to perform Solidity and onchain operations directly.

Requirements

Manual Setup

  1. Ensure Foundry tools (Forge, Cast, Anvil) are installed on your system:

    curl -L https://foundry.paradigm.xyz | bash
    foundryup
    
  2. Clone and build the server.

    bun i && bun build ./src/index.ts --outdir ./dist --target node
    
    
  3. Update your client config (eg: Claude desktop):

 "mcpServers": {
    "foundry": {
      "command": "node",
      "args": [
        "path/to/foundry-mcp-server/dist/index.js"
      ],
      "env" :{
        "PRIVATE_KEY": "0x1234",
      }
    }
 }

[!NOTE] PRIVATE_KEY is optional

Setup using NPM Package

You can now install and run the server directly using npm:

Global Installation

npm install -g @pranesh.asp/foundry-mcp-server

Direct Usage with npx

npx @pranesh.asp/foundry-mcp-server

MCP Client Configuration

Claude Code

 claude mcp add-json foundry-mcp-server '{"type":"stdio","command":"npx","args":["@pranesh.asp/foundry-mcp-server"],"env":{"RPC_URL":"","PRIVATE_KEY":""}}'   

Other MCP Clients (Cursor, Claude, Windsurf)

Add to your MCP settings:

{
  "mcpServers": {
    "foundry": {
      "command": "npx",
      "args": ["@pranesh.asp/foundry-mcp-server"],
      "env": {
        "RPC_URL": "http://localhost:8545",
        "PRIVATE_KEY": "0x..."
      }
    }
  }
}

Configuration

The server supports the following environment variables:

  • RPC_URL: Default RPC URL to use when none is specified (optional)
  • PRIVATE_KEY: Private key to use for transactions (optional)

[!CAUTION] Do not add keys with mainnet funds. Even though the code uses it safely, LLMs can hallicunate and send malicious transactions. Use it only for testing/development purposes. DO NOT trust the LLM!!

[!TIP] Getting Invalid configuration errors? Check your JSON syntax—common issues include double quotes (""KEY""KEY"), trailing commas, or unquoted keys. Validate with echo '...' | jq .

Workspace

The server maintains a persistent Forge workspace at ~/.mcp-foundry-workspace for all Solidity files, scripts, and dependencies.

Tools

Anvil

  • anvil_start: Start a new Anvil instance
  • anvil_stop: Stop a running Anvil instance
  • anvil_status: Check if Anvil is running and get its status

Cast

  • cast_call: Call a contract function (read-only)
  • cast_send: Send a transaction to a contract function
  • cast_balance: Check the ETH balance of an address
  • cast_receipt: Get the transaction receipt
  • cast_storage: Read contract storage at a specific slot
  • cast_run: Run a published transaction in a local environment
  • cast_logs: Get logs by signature or topic
  • cast_sig: Get the selector for a function or event signature
  • cast_4byte: Lookup function or event signature from the 4byte directory
  • cast_chain: Get information about the current chain

Forge

  • forge_script: Run a Forge script from the workspace
  • install_dependency: Install a dependency for the Forge workspace

File Management

  • create_solidity_file: Create or update a Solidity file in the workspace
  • read_file: Read the content of a file from the workspace
  • list_files: List files in the workspace

Utilities

  • convert_eth_units: Convert between EVM units (wei, gwei, hex)
  • compute_address: Compute the address of a contract that would be deployed
  • contract_size: Get the bytecode size of a deployed contract
  • estimate_gas: Estimate the gas cost of a transaction

Heimdall Analysis

  • heimdall_disassemble: Disassemble EVM bytecode into human-readable opcodes
  • heimdall_decode: Decode raw calldata without requiring ABI
  • heimdall_decompile: Decompile EVM bytecode to Solidity source code and ABI
  • heimdall_cfg: Generate visual control flow graph for EVM bytecode
  • heimdall_inspect: Detailed inspection of Ethereum transactions

Usage in Claude Desktop App 🎯

Once the installation is complete, and the Claude desktop app is configured, you must completely close and re-open the Claude desktop app to see the tavily-mcp server. You should see a hammer icon in the bottom left of the app, indicating available MCP tools, you can click on the hammer icon to see more details on the available tools.

Alt text

Now claude will have complete access to the foundry-mcp server. If you insert the below examples into the Claude desktop app, you should see the foundry-mcp server tools in action.

Examples

  1. Transaction analysis:
Can you analyze the transaction and explain what it does? 
https://etherscan.io/tx/0xcb73ad3116f19358e2e649d4dc801b7ae0590a47b8bb2e57a8e98b6daa5fb14b
  1. Querying Balances:
Query the mainnet ETH and USDT balances for the wallet 0x195F46025a6926968a1b3275822096eB12D97E70.
  1. Sending transactions:
Transfer 0.5 USDC to 0x195F46025a6926968a1b3275822096eB12D97E70 on Mainnet. 
  1. Deploying contracts/Running scripts:
Deploy a mock ERC20 contract to a local anvil instance and name it "Fire Coin".

Acknowledgments ✨

Disclaimer

The software is being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the software. They have not been audited and as such there can be no assurance they will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk.

Alternatives

Related Skills

Browse all skills
ui-design-system

UI design system toolkit for Senior UI Designer including design token generation, component documentation, responsive design calculations, and developer handoff tools. Use for creating design systems, maintaining visual consistency, and facilitating design-dev collaboration.

18
youtube-analytics

YouTube Data API v3 analytics toolkit. Analyze YouTube channels, videos, and search results. Use when the user asks to: check YouTube channel stats, analyze video performance, compare channels, search for videos, get subscriber counts, view engagement metrics, find trending videos, get channel uploads, or analyze YouTube competition. Requires a YouTube Data API v3 key from Google Cloud Console.

2
usage-export

Export OpenClaw usage data to CSV for analytics tools like Power BI. Hourly aggregates by activity type, model, and channel.

1
mcp-developer

Use when building MCP servers or clients that connect AI systems with external tools and data sources. Invoke for MCP protocol compliance, TypeScript/Python SDKs, resource providers, tool functions.

1
ga4-analytics

Google Analytics 4, Search Console, and Indexing API toolkit. Analyze website traffic, page performance, user demographics, real-time visitors, search queries, and SEO metrics. Use when the user asks to: check site traffic, analyze page views, see traffic sources, view user demographics, get real-time visitor data, check search console queries, analyze SEO performance, request URL re-indexing, inspect index status, compare date ranges, check bounce rates, view conversion data, or get e-commerce revenue. Requires a Google Cloud service account with GA4 and Search Console access.

1
ccxt-typescript

CCXT cryptocurrency exchange library for TypeScript and JavaScript developers (Node.js and browser). Covers both REST API (standard) and WebSocket API (real-time). Helps install CCXT, connect to exchanges, fetch market data, place orders, stream live tickers/orderbooks, handle authentication, and manage errors. Use when working with crypto exchanges in TypeScript/JavaScript projects, trading bots, arbitrage systems, or portfolio management tools. Includes both REST and WebSocket examples.

1