Purpose
evm-mcp-server is a comprehensive Model Context Protocol (MCP) server designed to provide large language models (LLMs) and AI agents with tools for interacting with EVM-compatible blockchain networks. It enables AI agents to interact with more than 60 EVM chains, including Ethereum, Optimism, Arbitrum, Base, Polygon, and others, through a unified interface, covering 34 mainnets and 26 testnets.
Main Capabilities
Blockchain Data Access
- Multi-chain support for more than 60 EVM-compatible networks.
- Retrieve chain information, including blockNumber, chainId, and RPC.
- Access block data by number, hash, or latest state.
- Retrieve transaction details and receipts, including decoded logs.
- Query the native token and all token standard balances of an address.
- Support ENS resolution, allowing the use of human-readable Ethereum addresses (such as 'vitalik.eth' instead of '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045').
Token Operations
- ERC20 tokens: Retrieve token metadata (name, symbol, decimals, supply), check token balances, transfer tokens between addresses, approve spending limits.
- NFTs (ERC721): Retrieve collection and token metadata, verify token ownership, transfer NFTs between addresses, retrieve token URIs and held quantities.
- Multi-tokens (ERC1155): Retrieve token balances and metadata, transfer tokens by quantity, access token URIs.
Smart Contract Interaction
- Read contract state through view/pure functions.
- Write to contracts: execute any state-changing function and automatically retrieve the ABI.
- Contract verification to distinguish from EOAs.
- Event log retrieval and filtering.
- Automatically retrieve ABIs from the Etherscan v2 API, covering all more than 60 networks, without needing to know the ABI in advance.
- ABI parsing and validation, supporting function discovery.
Transaction Support
- Flexible wallet support: configure using a private key or mnemonic (BIP-39), with HD path support.
- Native token transfers on all supported networks.
- Gas estimation for transaction planning.
- Transaction status and receAccording to the information.
- Error handling with descriptive messages.
Message Signing Capabilities
- Personal message signing: Sign arbitrary messages for authentication and verification.
- EIP-712 typed data signing: Sign structured data for gasless transactions and meta-transactions.
- SIWE support: Enable the Sign-In With Ethereum authentication flow.
- Permit signing: Create off-chain approvals for gasless token operations.
- Meta-transaction support: Sign transaction data for relay services and gasless transfers.
AI-Guided Workflows (Prompts)
- Transaction preparation: Guidance for planning and executing transfers.
- Wallet analysis: Tools for analyzing wallet activity and holdings.
- Smart contract exploration: Interactive ABI retrieval and contract analysis.
- Contract interaction: Safely execute write operations on smart contracts.
- Network information: Learn about and compare EVM networks.
- Approval audit: Review and manage token approvals.
- Error diagnosis: Troubleshoot transaction failures.
Usage
Prerequisites
- Bun 1.0.0 or later (recommended).
- Node.js 20.0.0 or later (if not using Bun).
- Optional: Etherscan API key for ABI retrieval.
Configuration
The server uses the following environment variables. For write operations and ABI retrieval, these variables must be configured:
- Wallet configuration: A private key or mnemonic can be used.
- Option 1: Private key.
- Option 2: Mnemonic (recommended for HD wallets). The mnemonic option supports hierarchical deterministic (HD) wallet derivation: uses BIP-39 standard mnemonics (12 or 24 words), supports BIP-44 derivation paths: m/44'/60'/0'/0/{accountIndex}, EVM_ACCOUNT_INDEX allows deriving different accounts from the same mnemonic, and the default account index is 0.
- The wallet is used for: transferring native tokens (transfer_native tool), transferring ERC20 tokens (transfer_erc20 tool), approving token spending (approve_token_spending tool), writing to smart contracts (write_contract tool), signing messages for authentication (sign_message tool), and signing structured data for gasless transactions (sign_typed_data tool).
- Security note: Never commit private keys or mnemonics to version control, use environment variables or a secure key management system, store mnemonics securely, and consider using different account indexes for different purposes.
- Etherscan API key: Optional, but required for automatically fetching ABIs from the block explorer (get_contract_abi tool), automatically fetching ABIs when reading contracts (read_contract tool with the abiJson parameter), and the fetch_and_analyze_abi prompt. Get a free API key from Etherscan; the same key works across all 60+ EVM networks via the Etherscan v2 API.
Default configuration
- Default chain ID: 1 (Ethereum Mainnet).
- Server port: 3001.
- Server host: 0.0.0.0 (accessible from any network interface). These values are hardcoded in the application. To modify them, you can edit the following files: chain configuration: src/core/chains.ts; server configuration: src/server/http-server.ts.
Running the server
- Using npx (no installation required): You can run the MCP EVM server directly with npx.
- Running the server locally: Start the server with stdio (for embedding in CLI tools), or start the HTTP server with SSE (for web applications).
Connecting to the server
Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use MCP Inspector.
Connecting from Cursor
- Open Cursor and go to Settings (the gear icon in the lower left corner).
- Click "Features" in the left sidebar.
- Scroll down to the "MCP Servers" section.
- Click "Add new MCP server".
- Enter the following details: Server name: evm-mcp-server; Type: command; Command: npx @mcpdotdirect/evm-mcp-server. Once connected, you can use the MCP server's features directly in Cursor. The server will appear in the MCP Servers list and can be enabled/disabled as needed.Use.
Using mcp.json with Cursor
For a more portable configuration, you can create a .cursor/mcp.json file in the project root directory. Place this file in the project's .cursor directory (create it if it does not exist), and Cursor will automatically detect and use these MCP server configurations when working in that project. This approach facilitates: sharing MCP configurations with the team, version-controlling MCP settings, and using different server configurations for different projects.
Example: HTTP mode using SSE
If you are developing a web application and want to connect to an HTTP server with Server-Sent Events (SSE), you can use this configuration. This connects directly to the HTTP server's SSE endpoint and is suitable for: web applications that need to connect to an MCP server from the browser, environments where running local commands is not ideal, and sharing a single MCP server instance among multiple users or applications.
Connecting using Claude CLI
If you use Claude CLI, you can connect to the MCP server with just two commands.
Applicable scenarios
evm-mcp-server is suitable for the following scenarios:
- AI agents need to interact with blockchain networks, such as querying balances, transferring tokens, or interacting with smart contracts.
- Developers want to integrate blockchain functionality into AI assistants or chatbots.
- Tools that require unified operations across multiple EVM networks.
- Using natural language for blockchain operations, such as asking "check vitalik.eth's current ETH balance" through Cursor or Claude CLI.
Limitations
- A wallet private key or mnemonic must be configured to perform write operations.
- Automatic ABI retrieval requires an Etherscan API key.
- The default configuration is hardcoded, and modifications require editing the source code.
- Security considerations: the private key is used only for transaction signing, and the server never stores it. For production use, consider implementing additional authentication mechanisms, using HTTPS, implementing rate limiting, and for high-value services, consider adding a confirmation step.
- The project uses the MIT license.