Smart Contract Project Manager with MCP (Model Context Protocol) integration for Ethereum development.
https://steadfast-miracle-production.up.railway.app/mcp
Project for Foundry workflow
- Project Management: Create, manage, and cleanup temporary Foundry projects
- File Operations: Add, modify, and delete contract files
- Compilation: Unified compilation using project settings (solc version, optimization)
- Testing: Run tests, fuzz tests, coverage analysis, gas reports
- Fuzzing: Echidna integration for property-based testing and vulnerability discovery
- Deployment: Generate smart deployment scripts based on artifacts
- Dependencies: Install external dependencies (OpenZeppelin, etc.)
- Scenario Testing: YAML-based declarative testing framework
mcp-foundry-anvil/
├── server.py # Main MCP server (898 lines)
├── mcp_modules/ # Core modules
│ ├── project.py # Project management (1105 lines)
│ ├── build.py # Build management (553 lines)
│ ├── tests_runner.py # Test execution (488 lines)
│ ├── scenario.py # Scenario testing (1424 lines)
│ └── chain.py # Chain management (604 lines)
├── pyproject.toml # Dependencies
├── requirements.txt # Python requirements
├── Dockerfile # Docker container definition
├── docker-compose.yml # Docker Compose configuration
├── .dockerignore # Docker ignore file
└── README.md # This file
- Foundry-Only: Removed Hardhat/Truffle support for simplicity
- Unified Compilation: All compilation goes through
project_manager.compile_project() - Smart Deployment: Auto-generates deployment scripts with correct Solidity versions
- Caching: Build artifacts cached for performance
- Security: File operations restricted to project directories
project_create()- Create Foundry projectproject_add_files()- Add contract filesproject_compile()- Compile contractsproject_deploy()- Deploy contractsproject_cleanup_all()- Cleanup all projects
test_run_all()- Run all teststest_run_fuzz()- Run fuzz teststest_run_coverage()- Coverage analysistest_get_gas_reports()- Gas reports
project_install_dependency()- Install single dependencyproject_install_multiple_dependencies()- Install multiple dependencies
scenario_run_from_file()- Run scenario from YAMLscenario_create_template()- Create scenario templatescenario_start_local_chain()- Start Anvil chain
# Install dependencies
pip install -r requirements.txt
# Run MCP server
python server.py# Build and run with Docker Compose
docker-compose up --build
# Run in detached mode
docker-compose up -d --build
# View logs
docker-compose logs -f
# Stop the container
docker-compose down# Build the image
docker build -t mcp-foundry-anvil .
# Run the container
docker run -p 8000:8000 -v foundry_projects:/tmp/foundry_projects mcp-foundry-anvil- Python 3.11+
- Foundry (forge, anvil, cast)
- Echidna (optional, for fuzzing)
- Git
- Docker
- Docker Compose (optional, for easier management)
The project includes comprehensive Docker support with Foundry pre-installed:
- Base Image: Python 3.11 slim for optimal size
- Foundry Integration: Pre-installed Foundry tools (forge, anvil, cast, chisel)
- Echidna Integration: Pre-installed Echidna fuzzing tool for smart contract testing
- System Dependencies: Includes build tools for Solidity compilation
- Package Management: Uses
uvfor fast dependency resolution - Cache Management: Persistent volumes for Foundry projects and build artifacts
- Health Checks: Built-in container health monitoring
- Service Management: Easy start/stop/restart
- Volume Persistence: Foundry projects and cache survive container restarts
- Port Mapping: MCP server accessible on port 8000
- Development Mode: Source code mounting for live development
- Health Monitoring: Automatic health checks and restart policies
foundry_projects: Persistent storage for Foundry project filesbuild_cache: Build artifacts cachedeploy_cache: Deployment scripts cache- Source code mounting for development (optional)
MIT License