Labsco
mcpdotdirect logo

EVM MCP Server

377

from mcpdotdirect

Provides blockchain services for over 30 EVM-compatible networks through a unified interface.

🔥🔥🔥🔥✓ VerifiedFreeAdvanced setup

EVM MCP Server

License: MIT EVM Networks TypeScript MCP Viem

A comprehensive Model Context Protocol (MCP) server that provides blockchain services across 60+ EVM-compatible networks. This server enables AI agents to interact with Ethereum, Optimism, Arbitrum, Base, Polygon, and many other EVM chains with a unified interface through 22 tools and 10 AI-guided prompts.

📋 Contents

🔭 Overview

The MCP EVM Server leverages the Model Context Protocol to provide blockchain services to AI agents. It supports a wide range of services including:

  • Reading blockchain state (balances, transactions, blocks, etc.)
  • Interacting with smart contracts with automatic ABI fetching from block explorers
  • Transferring tokens (native, ERC20, ERC721, ERC1155)
  • Querying token metadata and balances
  • Chain-specific services across 60+ EVM networks (34 mainnets + 26 testnets)
  • ENS name resolution for all address parameters (use human-readable names like 'vitalik.eth' instead of addresses)
  • AI-friendly prompts that guide agents through complex workflows

All services are exposed through a consistent interface of MCP tools, resources, and prompts, making it easy for AI agents to discover and use blockchain functionality. Every tool that accepts Ethereum addresses also supports ENS names, automatically resolving them to addresses behind the scenes. The server includes intelligent ABI fetching, eliminating the need to know contract ABIs in advance.

✨ Features

Blockchain Data Access

  • Multi-chain support for 60+ EVM-compatible networks (34 mainnets + 26 testnets)
  • Chain information including blockNumber, chainId, and RPCs
  • Block data access by number, hash, or latest
  • Transaction details and receipts with decoded logs
  • Address balances for native tokens and all token standards
  • ENS resolution for human-readable Ethereum addresses (use 'vitalik.eth' instead of '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045')

Token services

  • ERC20 Tokens

    • Get token metadata (name, symbol, decimals, supply)
    • Check token balances
    • Transfer tokens between addresses
    • Approve spending allowances
  • NFTs (ERC721)

    • Get collection and token metadata
    • Verify token ownership
    • Transfer NFTs between addresses
    • Retrieve token URIs and count holdings
  • Multi-tokens (ERC1155)

    • Get token balances and metadata
    • Transfer tokens with quantity
    • Access token URIs

Smart Contract Interactions

  • Read contract state through view/pure functions
  • Write to contracts - Execute any state-changing function with automatic ABI fetching
  • Contract verification to distinguish from EOAs
  • Event logs retrieval and filtering
  • Automatic ABI fetching from Etherscan v2 API across all 60+ networks (no need to know ABIs in advance)
  • ABI parsing and validation with function discovery

Comprehensive Transaction Support

  • Flexible Wallet Support - Configure with Private Key or Mnemonic (BIP-39) with HD path support
  • Native token transfers across all supported networks
  • Gas estimation for transaction planning
  • Transaction status and receipt 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 Sign-In With Ethereum authentication flows
  • Permit Signatures - 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 fetching and contract analysis
  • Contract interaction - Safe execution of write operations on smart contracts
  • Network information - Learning about EVM networks and comparisons
  • Approval auditing - Reviewing and managing token approvals
  • Error diagnosis - Troubleshooting transaction failures

🌐 Supported Networks

Mainnets

  • Ethereum (ETH)
  • Optimism (OP)
  • Arbitrum (ARB)
  • Arbitrum Nova
  • Base
  • Polygon (MATIC)
  • Polygon zkEVM
  • Avalanche (AVAX)
  • Binance Smart Chain (BSC)
  • zkSync Era
  • Linea
  • Celo
  • Gnosis (xDai)
  • Fantom (FTM)
  • Filecoin (FIL)
  • Moonbeam
  • Moonriver
  • Cronos
  • Scroll
  • Mantle
  • Manta
  • Blast
  • Fraxtal
  • Mode
  • Metis
  • Kroma
  • Zora
  • Aurora
  • Canto
  • Flow
  • Lumia

Testnets

  • Sepolia
  • Optimism Sepolia
  • Arbitrum Sepolia
  • Base Sepolia
  • Polygon Amoy
  • Avalanche Fuji
  • BSC Testnet
  • zkSync Sepolia
  • Linea Sepolia
  • Scroll Sepolia
  • Mantle Sepolia
  • Manta Sepolia
  • Blast Sepolia
  • Fraxtal Testnet
  • Mode Testnet
  • Metis Sepolia
  • Kroma Sepolia
  • Zora Sepolia
  • Celo Alfajores
  • Goerli
  • Holesky
  • Flow Testnet
  • Filecoin Calibration
  • Lumia Testnet

📚 API Reference

Tools

The server provides 25 focused MCP tools for agents. All tools that accept address parameters support both Ethereum addresses and ENS names.

Wallet Information

Tool NameDescriptionKey Parameters
get_wallet_addressGet the address of the configured wallet (from EVM_PRIVATE_KEY)none

Network Information

Tool NameDescriptionKey Parameters
get_chain_infoGet network informationnetwork
get_supported_networksList all supported EVM networksnone
get_gas_priceGet current gas prices on a networknetwork

ENS Services

Tool NameDescriptionKey Parameters
resolve_ens_nameResolve ENS name to addressensName, network
lookup_ens_addressReverse lookup address to ENS nameaddress, network

Block & Transaction Information

Tool NameDescriptionKey Parameters
get_blockGet block datablockNumber or blockHash, network
get_latest_blockGet latest block datanetwork
get_transactionGet transaction detailstxHash, network
get_transaction_receiptGet transaction receipt with logstxHash, network
wait_for_transactionWait for transaction confirmationtxHash, confirmations, network

Balance & Token Information

Tool NameDescriptionKey Parameters
get_balanceGet native token balanceaddress (address/ENS), network
get_token_balanceCheck ERC20 token balancetokenAddress (address/ENS), ownerAddress (address/ENS), network
get_allowanceCheck token spending allowancetokenAddress (address/ENS), ownerAddress (address/ENS), spenderAddress (address/ENS), network

Smart Contract Interactions

Tool NameDescriptionKey Parameters
get_contract_abiFetch contract ABI from block explorer (60+ networks)contractAddress (address/ENS), network
read_contractRead smart contract state (auto-fetches ABI if needed)contractAddress, functionName, args[], abiJson (optional), network
write_contractExecute state-changing functions (auto-fetches ABI if needed)contractAddress, functionName, args[], value (optional), abiJson (optional), network
multicallBatch multiple read calls into a single RPC request (uses Multicall3)calls[] (array of contract calls), allowFailure (optional), network

Token Transfers

Tool NameDescriptionKey Parameters
transfer_nativeSend native tokens (ETH, etc.)to (address/ENS), amount, network
transfer_erc20Transfer ERC20 tokenstokenAddress (address/ENS), to (address/ENS), amount, network
approve_token_spendingApprove token allowancestokenAddress (address/ENS), spenderAddress (address/ENS), amount, network

NFT Services

Tool NameDescriptionKey Parameters
get_nft_infoGet NFT (ERC721) metadatatokenAddress (address/ENS), tokenId, network
get_erc1155_balanceCheck ERC1155 balancetokenAddress (address/ENS), tokenId, ownerAddress (address/ENS), network

Message Signing

Tool NameDescriptionKey Parameters
sign_messageSign arbitrary messages for authentication and verification (SIWE, off-chain signatures)message
sign_typed_dataSign EIP-712 structured data for gasless transactions, permits, and meta-transactionsdomainJson, typesJson, primaryType, messageJson

Resources

The server exposes blockchain data through the following MCP resource URIs. All resource URIs that accept addresses also support ENS names, which are automatically resolved to addresses.

Blockchain Resources

Resource URI PatternDescription
evm://{network}/chainChain information for a specific network
evm://chainEthereum mainnet chain information
evm://{network}/block/{blockNumber}Block data by number
evm://{network}/block/latestLatest block data
evm://{network}/address/{address}/balanceNative token balance
evm://{network}/tx/{txHash}Transaction details
evm://{network}/tx/{txHash}/receiptTransaction receipt with logs

Token Resources

Resource URI PatternDescription
evm://{network}/token/{tokenAddress}ERC20 token information
evm://{network}/token/{tokenAddress}/balanceOf/{address}ERC20 token balance
evm://{network}/nft/{tokenAddress}/{tokenId}NFT (ERC721) token information
evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}NFT ownership verification
evm://{network}/erc1155/{tokenAddress}/{tokenId}/uriERC1155 token URI
evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}ERC1155 token balance

🔒 Security Considerations

  • Private keys are used only for transaction signing and are never stored by the server
  • Consider implementing additional authentication mechanisms for production use
  • Use HTTPS for the HTTP server in production environments
  • Implement rate limiting to prevent abuse
  • For high-value services, consider adding confirmation steps

📁 Project Structure

mcp-evm-server/
├── src/
│   ├── index.ts                # Main stdio server entry point
│   ├── server/                 # Server-related files
│   │   ├── http-server.ts      # HTTP server with SSE
│   │   └── server.ts           # General server setup
│   ├── core/
│   │   ├── chains.ts           # Chain definitions and utilities
│   │   ├── resources.ts        # MCP resources implementation
│   │   ├── tools.ts            # MCP tools implementation
│   │   ├── prompts.ts          # MCP prompts implementation
│   │   └── services/           # Core blockchain services
│   │       ├── index.ts        # Operation exports
│   │       ├── balance.ts      # Balance services
│   │       ├── transfer.ts     # Token transfer services
│   │       ├── utils.ts        # Utility functions
│   │       ├── tokens.ts       # Token metadata services
│   │       ├── contracts.ts    # Contract interactions
│   │       ├── transactions.ts # Transaction services
│   │       └── blocks.ts       # Block services
│   │       └── clients.ts      # RPC client utilities
├── package.json
├── tsconfig.json
└── README.md

🛠️ Development

To modify or extend the server:

  1. Add new services in the appropriate file under src/core/services/
  2. Register new tools in src/core/tools.ts
  3. Register new resources in src/core/resources.ts
  4. Add new network support in src/core/chains.ts
  5. To change server configuration, edit the hardcoded values in src/server/http-server.ts

📄 License

This project is licensed under the terms of the MIT License.