Foundry Zksync

io.github.Jrigada由 GitHub 帳號 Jrigada 發布v0.2.3更新於 Oct 24, 2026

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

已驗證STDIO僅桌面金融開發者工具

概覽

AI 產生的概覽

暴露 foundry-zksync 命令列工具,讓助理能編譯、測試、部署並與 zkSync Era 智慧合約互動。

可以做什麼
把 foundry-zksync 工具鏈(forge、cast、anvil-zksync)封裝成 MCP 工具。涵蓋專案初始化、編譯、可帶篩選與詳細度選項的測試、gas 報告與快照、腳本執行、具結構化輸出的合約部署,以及在 Etherscan 與 zkSync Explorer 上驗證合約。cast 工具負責 ABI 編碼與解碼、calldata 解碼、唯讀呼叫、會改變狀態的發送、餘額與 nonce 查詢。也能讀取 foundry.toml、依 zkSync 知識庫解釋錯誤、查詢文件,並啟動或檢查本機 anvil-zksync 節點。
適用情境
適合開發或測試 zkSync Era 智慧合約,並希望助理直接操作 forge 與 cast 工作流程的情況。無論是搭配 anvil-zksync 的本機開發,或在 zkSync 網路上部署與驗證合約都適用。
執行需求
以 npm 套件(foundry-zksync-mcp)透過 stdio 在本機執行,通常使用 npx。需要 Node.js 18 以上版本,以及透過 foundryup-zksync 安裝的 foundry-zksync。簽章工具需要一種錢包方式:具名 keystore 帳戶、搭配密碼檔的 keystore 檔案、硬體錢包、雲端 KMS 或私鑰。雲端 KMS 選項會用到 AWS_KMS_KEY_ID、GCP_PROJECT_ID 等環境變數。伺服器本身未宣告驗證機制。
安裝前請注意
簽章工具(deploy、cast_send、run_script)可轉移資金並改變鏈上狀態。README 警告 privateKey 參數對 AI 助理可見且可能被記錄,持有真實資金的私鑰絕不應以此方式傳入;正式環境建議使用具名 keystore、keystore 檔案、硬體錢包或雲端 KMS。驗證會把合約資料傳送給 Etherscan 與 zkSync Explorer。install、clean、deploy 等指令會寫入專案或網路。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Foundry Zksync,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

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)

來源:README.md,提交 0c030bc

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.3最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分