@just-jelly/mcp-server
MCP server for Zama's fhEVM that provides tools to scaffold, compile, deploy, test, and analyze confidential smart contracts, with support for encryption, ACL, and error decoding.
README
Zama fhEVM AI Agent Skill Package
Give any AI coding assistant — Claude, Cursor, Windsurf, Copilot, Cline, Codex — accurate fhEVM knowledge and real executable tools for building confidential smart contracts on Zama's fhEVM.
This package has three parts that work together:
- An MCP server — a real npm package your AI agent can call to scaffold projects, compile contracts, deploy to Sepolia, check wallet balances, look up protocol addresses, verify contracts, encrypt values, check ACL, run tests, and decode errors
- Rules files — drop-in config for every major AI coding tool so it stops hallucinating fhEVM code
- Error decoder — a catalog of every known fhEVM error with root cause and exact fix
npm: @just-jelly/mcp-server — v2.2.6 — 32 tools
1. MCP Server
The MCP server is an npm package. Pick one of two ways to use it:
Option A — npx (no install, always latest)
npx -y @just-jelly/mcp-server
Use this config in your AI tool:
{
"mcpServers": {
"fhevm": {
"command": "npx",
"args": ["-y", "@just-jelly/mcp-server"],
"env": {
"FHEVM_PRIVATE_KEY": "0x_your_deployer_private_key",
"FHEVM_RPC_URL": "https://eth-sepolia.g.alchemy.com/v2/YOUR_KEY",
"ETHERSCAN_API_KEY": "optional_for_auto_verification"
}
}
}
}
Option B — Global install (faster startup, no npx delay)
npm install -g @just-jelly/mcp-server
Then use fhevm-mcp as the command instead of npx:
{
"mcpServers": {
"fhevm": {
"command": "fhevm-mcp",
"args": [],
"env": {
"FHEVM_PRIVATE_KEY": "0x_your_deployer_private_key",
"FHEVM_RPC_URL": "https://eth-sepolia.g.alchemy.com/v2/YOUR_KEY",
"ETHERSCAN_API_KEY": "optional_for_auto_verification"
}
}
}
}
Connect to your AI tool
The two key fields:
FHEVM_PRIVATE_KEYandFHEVM_RPC_URLlive in the MCP configenvblock — you never need a.envfile in your project. When deploy/test tools run Hardhat, these are automatically forwarded to the subprocess.RPC URL: Use a private RPC endpoint (Alchemy, Infura, QuickNode). The public BlastAPI fallback works for basic contract calls but rate-limits
eth_getBalance. A free Alchemy Sepolia key is all you need.Prefer not to hardcode? Set the vars in your shell profile (
export FHEVM_PRIVATE_KEY=0x...in~/.zshrc) and use a tiny wrapper script instead. See DEPLOYMENT.md for the exact pattern.
| AI Tool | Where to put the config |
|---|---|
| Claude Desktop (Mac) | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Claude Desktop (Windows) | %APPDATA%\Claude\claude_desktop_config.json |
| Claude Code CLI | claude mcp add fhevm -- npx -y @just-jelly/mcp-server then claude mcp set-env fhevm FHEVM_PRIVATE_KEY 0x... |
| Cursor | .cursor/mcp.json in project root |
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
| OpenAI Codex | ~/.codex/config.json |
| Cline (VS Code) | Cline sidebar → Settings → MCP Servers |
31 Tools
Wallet & Config
| Tool | What it does |
|---|---|
setup_mcp_config |
Generate exact config JSON for any AI tool — shows where to paste your FHEVM_PRIVATE_KEY |
check_wallet_balance |
Check ETH balance on Sepolia — auto-derives address from FHEVM_PRIVATE_KEY |
get_faucet_links |
All 5 Sepolia faucets with daily limits and requirements |
Protocol Addresses
| Tool | What it does |
|---|---|
get_protocol_addresses |
Full Sepolia address book: core fhEVM, Zama tokens, all 8 cToken wrappers, staking, governance, fees |
verify_on_etherscan |
Verify deployed contract source on Etherscan (uses ETHERSCAN_API_KEY from config) |
watch_decryption_callback |
Polling script + test pattern for FHE.requestDecryption() async callbacks |
get_confidential_wrapper_code |
Complete TypeScript for mint→wrap→transfer→balance on any cToken wrapper |
Project Setup
| Tool | What it does |
|---|---|
scaffold_fhevm_project |
Creates a complete Hardhat project — 4 templates: minimal, token, voting, auction |
generate_hardhat_config |
Generate hardhat.config.ts with all correct settings |
generate_vite_config |
Generate Vite config with required CORS headers for fhEVM WASM |
check_dependencies |
Scan package.json for common fhEVM dependency errors |
Compile & Deploy
| Tool | What it does |
|---|---|
compile_solidity |
Compiles contracts, returns fhEVM-specific error explanations |
deploy_contract |
Deploys to Sepolia or localhost — FHEVM_PRIVATE_KEY forwarded automatically |
run_hardhat_tests |
Runs tests with fhEVM failure analysis (mock + Sepolia modes) |
Code Generation
| Tool | What it does |
|---|---|
generate_confidential_contract |
Generates full contracts for 9 patterns: token, vault, voting, auction, payroll, lending, identity, game, erc7984 |
generate_fhevm_test |
Test boilerplate with encrypt/decrypt patterns |
generate_frontend_dapp |
Complete React dApp with CORS config, balance reveal, transfer UI |
Encryption
| Tool | What it does |
|---|---|
encrypt_value |
Generates complete frontend + Node.js encryption code for any type |
encrypt_multiple_values |
Packs multiple values into one input proof (gas efficient) |
get_encrypted_balance |
Reads a ciphertext handle + generates full re-encryption frontend code |
read_contract_state |
Calls any view function on a deployed contract via your FHEVM_RPC_URL |
ACL
| Tool | What it does |
|---|---|
check_acl_permission |
Live on-chain ACL check — is this address allowed to use this handle? |
explain_acl_pattern |
Returns production Solidity for 6 ACL scenarios |
Analysis & Errors
| Tool | What it does |
|---|---|
verify_fhevm_contract |
Static analysis — finds missing allowThis, unverified inputs, wrong patterns |
decode_fhevm_error |
Decodes any fhEVM error → root cause + exact fix (55+ patterns, all Solidity custom errors) |
Network & Gas
| Tool | What it does |
|---|---|
get_network_config |
All Sepolia/mainnet addresses + SDK initialization code |
estimate_fhe_gas |
Gas cost model + optimization strategies |
Tutorials
| Tool | What it does |
|---|---|
get_fhevm_tutorial |
Step-by-step tutorials: quickstart, token, voting, frontend, re-encryption, on-chain-decryption, testing, deployment, OpenZeppelin |
explain_fhe_type |
Deep reference for every FHE type — euint8→256, ebool, eaddress, casting, ops table |
explain_coprocessor |
Architecture diagram, async flow, gas model, mock vs Sepolia |
explain_erc7984 |
New — ERC-7984 + OZ Confidential Contracts reference: standard overview, IConfidentialERC20 interface, all OZ base contracts (Mintable/WithErrors/Votes/Vesting), wrap/unwrap Gateway pattern, PLACEHOLDER events, testing, migration from ERC-20 |
list_tools |
List all 32 tools with descriptions |
2. Rules Files
Drop-in rules for every major AI coding tool. Copy the right file(s) into your fhEVM project and the AI immediately knows how to write correct confidential contracts.
zama-fhevm-skill/
├── SKILL.md → Claude Code (load as a skill)
├── CLAUDE.md → Claude Code (auto-loaded in project)
├── AGENTS.md → OpenAI Codex (auto-loaded in project)
├── .cursor/rules/
│ ├── fhevm-core.mdc → Cursor — always active (alwaysApply: true)
│ ├── fhevm-solidity.mdc → Cursor — activates on *.sol files
│ ├── fhevm-frontend.mdc → Cursor — activates on src/**/*.{ts,tsx}
│ └── fhevm-testing.mdc → Cursor — activates on *.test.{ts,js}
├── .windsurfrules → Windsurf (auto-loaded in project)
├── .github/copilot-instructions.md → GitHub Copilot (auto-loaded in project)
└── .clinerules/fhevm.md → Cline / RooCode (auto-loaded in project)
Copy what you need:
# Cursor
cp -r zama-fhevm-skill/.cursor your-project/.cursor
# Windsurf
cp zama-fhevm-skill/.windsurfrules your-project/.windsurfrules
# GitHub Copilot
cp -r zama-fhevm-skill/.github your-project/.github
# OpenAI Codex
cp zama-fhevm-skill/AGENTS.md your-project/AGENTS.md
# Cline
cp -r zama-fhevm-skill/.clinerules your-project/.clinerules
# Claude Code
cp zama-fhevm-skill/CLAUDE.md your-project/CLAUDE.md
What the rules teach every AI tool
The rules enforce 10 patterns that AI consistently gets wrong without them:
FHE.allowThis()after every ciphertext assignment — without this the next tx reverts withACL: Not allowedFHE.fromExternal(enc, proof)to verify inputs before useFHE.select(condition, a, b)for branching —if(ebool)is a compile error- Initialize mapping slots before first FHE operation —
bytes32(0)reverts immediately evmVersion: "cancun"in hardhat.config.ts — missing this breaks deployment- Inherit the correct network config contract per chain
chai@^4only — v5 breaks@fhevm/hardhat-plugin@fhevm/hardhat-pluginmust be the first import in hardhat.config.ts- Plaintext divisors only —
FHE.div(a, 100)notFHE.div(a, b) - Fresh
inputProofper transaction — reusing a proof fails ZK verification
3. Error Decoder
zama-fhevm-skill/errors/ERRORS.md — 55+ fhEVM errors across 13 categories, each with root cause, exact code fix, and prevention rule. Sourced from real fhEVM Solidity contract source (FHE.sol, ACL.sol, InputVerifier.sol).
Also available as the decode_fhevm_error MCP tool — your AI can call it live during development.
13 categories:
- ACL / access control errors
- Handle and zero-handle errors (
HandlesAlreadySavedForRequestID,NoHandleFoundForRequestID,UnsupportedHandleType) - Input proof / ZK verification errors (
InputLengthAbove64Bytes/128Bytes/256Bytes,InvalidKMSSignatures) - Input length / type errors — real Solidity custom errors from fhEVM source
- Decryption / KMS / callback errors
- Hardhat and compilation errors
- Solidity type errors
- Gas / computation errors
- Frontend SDK / WASM errors
- Testing errors
- Deployment / network errors
- OpenZeppelin confidential contracts errors
- MCP server / config errors
Sepolia Addresses
Core fhEVM
| Contract | Address |
|---|---|
| ACL | 0x687820221192C5B662b25367F70076A37bc79b6c |
| KMS Verifier | 0x1364cBBf2cDF5032C47d8226a6f6FBD2AFCDacAC |
| Input Verifier | 0xbc91f3daD1A5F19F8390c400196e58073B6a0BC4 |
| Chain ID | 11155111 |
| Relayer | https://relayer.testnet.zama.cloud |
Confidential Token Wrappers (Mock — freely mintable underlying)
| Symbol | Wrapper Address |
|---|---|
cUSDCMock |
0x7c5BF43B851c1dff1a4feE8dB225b87f2C223639 |
cUSDTMock |
0x4E7B06D78965594eB5EF5414c357ca21E1554491 |
cWETHMock |
0x46208622DA27d91db4f0393733C8BA082ed83158 |
cBRONMock |
0xaa5612FA27c927a0c7961f5AEFEE5ba3A0F9C891 |
cZAMAMock |
0xf2D628d2598aF4eAF94CB76a437Ff86CA78FfbFB |
Use get_protocol_addresses for the full book including staking, governance, and fee contracts.
License
BSD-3-Clause-Clear — same as Zama's fhEVM codebase.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.