foundry-mcp

yllvar/foundry-mcp

3.2

If you are the rightful owner of foundry-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Foundry MCP Server is a secure and efficient server for accessing Foundry tools with sandboxed execution and comprehensive security controls.

Tools
  1. call

    Execute contract calls

  2. send

    Send transactions

  3. storage

    Read contract storage

  4. logs

    Retrieve event logs

  5. start

    Launch local node

  6. fork

    Fork mainnet

  7. accounts

    List test accounts

  8. build

    Compile contracts

  9. test

    Run tests

  10. deploy

    Deploy contracts

Foundry MCP Server

A Model Context Protocol (MCP) server providing secure access to Foundry tools (forge, cast, anvil) with sandboxed execution and comprehensive security controls.

Features

  • Full Foundry Integration: Access forge, cast, and anvil tools via MCP
  • Secure Execution: Worker thread sandboxing with resource limits
  • Production-Ready: Built with Bun runtime for performance
  • Monitoring: Performance tracking and audit logging
  • Safety Controls: Gas limits, recipient whitelisting, timeout protection

Installation

# Using bun (recommended)
bun install foundry-mcp-server

# Using npm
npm install foundry-mcp-server

Prerequisites

Usage

import { initializeServer } from 'foundry-mcp-server';

// Start the server
const server = await initializeServer();

Available Tools

Cast Tools

  • call: Execute contract calls
  • send: Send transactions
  • storage: Read contract storage
  • logs: Retrieve event logs

Anvil Tools

  • start: Launch local node
  • fork: Fork mainnet
  • accounts: List test accounts

Forge Tools

  • build: Compile contracts
  • test: Run tests
  • deploy: Deploy contracts

Security Features

  • 5-second request timeout
  • 100MB memory threshold
  • 30M gas limit validation
  • Recipient address whitelisting
  • Comprehensive audit logging

Contributing

Pull requests welcome. Please ensure all changes:

  1. Maintain backward compatibility
  2. Include tests
  3. Document new features

License

MIT