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
call
Execute contract calls
send
Send transactions
storage
Read contract storage
logs
Retrieve event logs
start
Launch local node
fork
Fork mainnet
accounts
List test accounts
build
Compile contracts
test
Run tests
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
- Foundry installed (https://book.getfoundry.sh/getting-started/installation)
- Node.js 18+ or Bun 1.0+
Usage
import { initializeServer } from 'foundry-mcp-server';
// Start the server
const server = await initializeServer();
Available Tools
Cast Tools
call
: Execute contract callssend
: Send transactionsstorage
: Read contract storagelogs
: Retrieve event logs
Anvil Tools
start
: Launch local nodefork
: Fork mainnetaccounts
: List test accounts
Forge Tools
build
: Compile contractstest
: Run testsdeploy
: 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:
- Maintain backward compatibility
- Include tests
- Document new features
License
MIT