web3-tools-mcp
v1.3.4
Published
Model Context Protocol server for blockchain interactions using viem, Etherscan, and Hypersync
Downloads
127
Maintainers
Readme
Web3 Tools MCP Server
A Model Context Protocol (MCP) server for blockchain interactions using viem, Etherscan, and Hypersync.
Features
- Multi-chain support (Ethereum, Arbitrum, Avalanche, Base, BNB Chain, Gnosis, Sonic, Optimism, Polygon, zkSync Era, Linea, Unichain)
- 🔐 Transaction Signing via Browser Wallet (MetaMask, Rabby, Coinbase Wallet)
- Smart contract interactions (read & write functions, ABI retrieval, source code)
- Contract simulation & gas estimation (simulate transactions, estimate costs)
- Real-time gas price tracking (legacy & EIP-1559)
- ENS resolution (names ↔ addresses, text records, avatars)
- Token balances & transfers (native & ERC20, batch queries)
- Event log queries with Hypersync acceleration
- Transaction tracing and analysis
- Storage slot reading with type decoding
Quick Start
Claude Code
claude mcp add --scope user --transport stdio web3-tools -- npx -y web3-tools-mcpClaude Desktop
Add to config.json:
{
"mcpServers": {
"web3-tools": {
"command": "npx",
"args": ["-y", "web3-tools-mcp"]
}
}
}API Keys (Optional)
All API keys are optional. The server uses public RPCs by default. Add keys to unlock additional features:
Configuration options:
--etherscan-api-keyorETHERSCAN_API_KEY- Enables contract ABI/source retrieval--hypersync-api-keyorHYPERSYNC_API_KEY- Fast event queries (10-100x faster)--alchemy-api-keyorALCHEMY_API_KEY- Enhanced RPC reliability--infura-api-keyorINFURA_API_KEY- Additional RPC provider--custom-rpc- Custom RPC URLs as JSON
Get free API keys:
- Etherscan: etherscan.io/apis
- Hypersync: hypersync.xyz
- Alchemy: alchemy.com
- Infura: infura.io
Example with API keys:
# Claude Code
claude mcp add --scope user --transport stdio web3-tools -- npx -y web3-tools-mcp --etherscan-api-key YOUR_KEY --hypersync-api-key YOUR_KEY
# Environment variables
export ETHERSCAN_API_KEY=your_key
export HYPERSYNC_API_KEY=your_key
npx web3-tools-mcpSupported Networks
| Network | Chain ID | Hypersync | |---------|----------|-----------| | Ethereum Mainnet | 1 | ✅ | | Arbitrum | 42161 | ✅ | | Avalanche | 43114 | ✅ | | Base | 8453 | ✅ | | BNB Chain | 56 | ✅ | | Gnosis | 100 | ✅ | | Sonic | 146 | ✅ | | Optimism | 10 | ✅ | | Polygon | 137 | ✅ | | zkSync Era | 324 | ✅ | | Linea | 59144 | ✅ | | Unichain | 130 | ✅ | | Localhost | 31337 | ❌ |
🔐 Browser Wallet Integration
The server includes a built-in wallet interface for secure transaction signing without exposing private keys.
How It Works
- When you use a transaction tool (e.g.,
send_native_token), the server automatically:- Starts a local web server on
http://localhost:3456 - Opens your browser to connect your wallet (MetaMask, Rabby, Coinbase Wallet, etc.)
- Starts a local web server on
- You connect your wallet once in the browser
- Transaction requests appear in the browser for approval
- Sign or reject transactions directly in your wallet
Supported Wallets
- MetaMask
- Rabby
- Coinbase Wallet
- Any browser wallet supporting EIP-1193
Manual Access
Visit http://localhost:3456 anytime to:
- Check wallet connection status
- See pending transactions
- View transaction history
Note: The wallet server runs automatically when the MCP server starts. No additional setup required!
Available Tools
Signatures
get_function_signature- Generate 4-byte function selectorsget_event_signature- Generate 32-byte event topic0 hashesget_error_signature- Generate 4-byte error selectors
Contract Info
get_contract_abi- Get ABI with proxy detection and verification statusget_contract_source_code- Get verified source code with proxy supportget_contract_source_file- Retrieve specific source file from cacheis_contract- Check if address is contract or EOA
Contract Interaction
call_contract_function- Call view/pure functions (supports batch)call_contract_write- Execute state-changing contract functions via browser walletsimulate_contract- Simulate contract calls without broadcasting (includes gas estimate)
Transactions (Browser Wallet Required)
send_native_token- Send ETH/native tokens to an addresssend_erc20_token- Send ERC20 tokens to an addresssign_message- Sign messages with your walletwallet_status- Check wallet connection status
Gas & Simulation
estimate_gas- Estimate gas cost for any transactionget_gas_price- Get current gas prices (legacy & EIP-1559)
ENS
resolve_ens_name- ENS name → addressreverse_resolve_ens- Address → ENS nameget_ens_text_record- Get text records (avatar, email, twitter, etc.)get_ens_avatar- Get avatar URIbatch_resolve_ens_names- Batch resolve multiple names
Balances
get_balance- Get native or ERC20 balances (supports batch)
Events & Logs
get_logs- Query and decode events with Hypersync fallback
Advanced
get_storage_at- Read storage slots with type decodingget_block_info- Get block data (timestamp, hash, etc.)trace_transaction- Trace execution (call tree, VM, state diff)
Advanced Configuration
Custom RPC
npx web3-tools-mcp --custom-rpc '{"mainnet":"https://my-rpc.com","base":"https://base-rpc.com"}'RPC Failover
Automatic provider selection: Alchemy → Infura → Public RPCs
Batch Operations
Many tools support batching for improved efficiency (contract calls, balances, ENS resolution).
Requirements
- Node.js ≥ 20.0.0
- Internet connection for RPC calls
Testing
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:ui # UI modeLicense
MIT
