Foundry Zksync

io.github.JrigadaPublished by GitHub account Jrigadav0.2.3Updated Oct 24, 2026

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

VerifiedSTDIODesktop onlyFinanceDeveloper Tools

Overview

AI-generated overview

Exposes foundry-zksync CLI tools so an assistant can compile, test, deploy, and interact with zkSync Era smart contracts.

What you can do
Wraps the foundry-zksync toolchain (forge, cast, anvil-zksync) as MCP tools. It covers project setup, compilation, testing with filters and verbosity, gas reports and snapshots, script execution, contract deployment with structured output, and contract verification on Etherscan and the zkSync Explorer. Cast tools handle ABI encoding and decoding, calldata decoding, read-only calls, state-changing sends, balance and nonce queries. It also reads foundry.toml, explains errors against a zkSync knowledge base, looks up documentation, and starts or checks a local anvil-zksync node.
When to use it
Use it when developing or testing zkSync Era smart contracts and you want an assistant to drive the forge and cast workflow directly. It suits local development against anvil-zksync as well as deployment and verification on zkSync networks.
Requirements
Runs locally over stdio as an npm package (foundry-zksync-mcp), typically via npx. Needs Node.js 18 or newer and foundry-zksync installed through foundryup-zksync. Signing tools need a wallet method: a named keystore account, a keystore file with password file, a hardware wallet, cloud KMS, or a private key. Cloud KMS options reference environment variables such as AWS_KMS_KEY_ID and GCP_PROJECT_ID. No authentication is declared for the server itself.
Before you install
Signing tools (deploy, cast_send, run_script) can move funds and change on-chain state. The README warns that privateKey parameters are visible to the AI assistant and may be logged, and that private keys holding real funds should never be passed that way; named keystores, keystore files, hardware wallets, or cloud KMS are recommended for production. Verification sends contract data to Etherscan and the zkSync Explorer. Commands such as install, clean, and deploy write to the project or network.

Installation

In SourceWeft

  1. Open Foundry Zksync in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

foundry-zksync-mcp

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

Tools

ToolDescription
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)
installforge install for dependency management
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
cast_callcast call for read-only contract interaction
cast_sendcast send for state-changing transactions
cast_balancecast balance for ETH balance queries
cast_noncecast nonce for transaction nonce queries
get_zksync_docsLook up foundry-zksync documentation by topic
anvil_zksyncStart or check a local anvil-zksync dev node

Prerequisites

Quick Start (npx)

No install needed — run directly with npx:

bash
claude mcp add foundry-zksync -- npx -y foundry-zksync-mcp

Or add to claude_desktop_config.json / ~/.claude.json:

json
{  "mcpServers": {    "foundry-zksync": {      "command": "npx",      "args": ["-y", "foundry-zksync-mcp"]    }  }}

Install from Source

bash
git clone https://github.com/Jrigada/foundry-zksync-mcp.gitcd foundry-zksync-mcpnpm installnpm run build

Then register with Claude Code:

bash
claude mcp add foundry-zksync node /absolute/path/to/foundry-zksync-mcp/dist/index.js

Key Management

All signing tools (deploy, cast_send, run_script) support multiple wallet methods. Choose based on your security needs:

Local Development (anvil-zksync)

For local dev with well-known test keys, use privateKey directly:

privateKey: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"

These are the default anvil-zksync test accounts — they hold no real value.

Warning: Never use privateKey with keys that hold real funds. MCP tool parameters are visible to the AI assistant and may be logged.

Recommended for Production: Named Keystores

Keys are encrypted on disk — only the account name travels through MCP.

bash
# Import a private key into a named keystore (interactive, key never shown)cast wallet import deployer --interactive
# List your keystoresls ~/.foundry/keystores/

Then use account: "deployer" in any signing tool. Forge will prompt for the password at runtime, or you can point to a password file with passwordFile.

Keystore Files

If you have an existing encrypted keystore JSON file (e.g. from Geth, MetaMask export):

keystore: "/path/to/keystore.json"passwordFile: "/path/to/password.txt"

Hardware Wallets

ledger: true    # Ledgertrezor: true    # Trezor

Cloud KMS

aws: true       # AWS KMS (set AWS_KMS_KEY_ID env var)gcp: true       # Google Cloud KMS (set GCP_PROJECT_ID, GCP_LOCATION, etc.)

Signing Method Summary

MethodKey ExposureBest For
Hardware walletNone (key never leaves device)High-value production
Cloud KMSNone (key in HSM)Automated production
Named keystore (account)None through MCP (encrypted on disk)General production use
Keystore fileNone through MCP (encrypted on disk)Existing workflows
privateKeyVisible to AI assistantLocal dev with test keys only

Project Structure

src/  index.ts              MCP server entry point, registers all 21 tools  knowledge.ts          Knowledge base (45+ entries) and system addresses  tools/    shared.ts           Profile field and env builder shared across forge tools    init.ts             forge init with zkSync config    compile.ts          forge build --zksync    test.ts             forge test --zksync    run_script.ts       forge script --zksync    deploy.ts           forge create --zksync (structured output)    verify.ts           forge verify-contract --zksync    install.ts          forge install    clean.ts            forge clean    gas_report.ts       forge test --gas-report    snapshot.ts         forge snapshot    read_foundry_toml.ts  Read project config    explain.ts          Error/log explanation with knowledge base    get_zksync_docs.ts  Documentation lookup with embedded content    cast_abi_encode.ts  cast abi-encode    cast_abi_decode.ts  cast abi-decode    cast_calldata_decode.ts  cast calldata-decode    cast_call.ts        cast call    cast_send.ts        cast send    cast_balance.ts     cast balance    cast_nonce.ts       cast nonce    anvil_zksync.ts     anvil-zksync node management  __tests__/            133 tests (vitest)

Source: README.md at commit 0c030bc

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.2.3LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts