Foundry MCP Server

Expose foundry-zksync (forge, cast, anvil-zksync) tools for zkSync Era development

Local serverstdio

What is the Foundry MCP server?

Expose foundry-zksync (forge, cast, anvil-zksync) tools for zkSync Era development. That is what the foundry mcp server brings to an AI assistant: the same capability, reachable through the Model Context Protocol rather than a separate app or dashboard.

The short version

An MCP (Model Context Protocol) server that exposes foundry-zksync CLI tools to AI assistants like Claude.

The tools it exposes

The server publishes 14 tools. What each one is for:

  • init — forge init with automatic zkSync config
  • compile — forge build --zksync
  • test — forge test --zksync with filter/verbosity options
  • run_script — forge script --zksync with broadcast, sender, slow mode
  • deploy — forge create --zksync with structured output parsing
  • verify — forge verify-contract --zksync (Etherscan & zkSync Explorer)
  • clean — forge clean to remove build artifacts
  • gas_report — forge test --gas-report for gas usage analysis
  • snapshot — forge snapshot for gas benchmarking
  • read_foundry_toml — Read and inspect project configuration
  • explain — Match errors/logs against a knowledge base of zkSync gotchas
  • cast_abi_encode — cast abi-encode

What it needs from you

Configuration is passed through the environment: AWS_KMS_KEY_ID, GCP_PROJECT_ID. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

Getting it running

foundry-zksync-mcp on npm is all you need. Most clients run it directly, so configuration is a few lines and a restart.

How it compares

This sits in the developer tooling group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Foundry's toolset — init, compile, test and 11 more — is a fair guide to whether it matches your workflow. It is maintained by Jrigada; worth a glance at recent repository activity before you build anything load-bearing on it.

We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.

Things to watch

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Foundry.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
initforge init with automatic zkSync config
compileforge build --zksync
testforge test --zksync with filter/verbosity options
run_scriptforge script --zksync with broadcast, sender, slow mode
deployforge create --zksync with structured output parsing
verifyforge verify-contract --zksync (Etherscan & zkSync Explorer)
cleanforge clean to remove build artifacts
gas_reportforge test --gas-report for gas usage analysis
snapshotforge snapshot for gas benchmarking
read_foundry_tomlRead and inspect project configuration
explainMatch errors/logs against a knowledge base of zkSync gotchas
cast_abi_encodecast abi-encode
cast_abi_decodecast abi-decode
cast_calldata_decodecast calldata-decode

How to install the Foundry MCP server

{
  "mcpServers": {
    "foundry-zksync": {
      "command": "npx",
      "args": ["-y", "foundry-zksync-mcp"],
      "env": {
        "AWS_KMS_KEY_ID": "your-value",
        "GCP_PROJECT_ID": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

VariableDescriptionRequired
AWS_KMS_KEY_IDCredential the server authenticates with.Yes
GCP_PROJECT_IDConfiguration value read at startup.Optional

Example prompts to try

  • Use Foundry to init.
  • Use Foundry to compile.
  • Use Foundry to test.

Frequently asked questions

It connects Foundry to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (init, compile, test, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Foundry directly.