Cover image
Try Now
2025-04-07

Etherscan V2 API MCP服务器

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

Etherscan MCP Server

A Go implementation of an Etherscan API client for the Model Context Protocol (MCP) that enables LLM applications to access Etherscan blockchain data.

Features

  • Access Etherscan API V2 for multi-chain support
  • Use a single API key for over 50 supported chains
  • Supports various blockchain data retrieval methods:
    • Account balances
    • Block information
    • Contract data (ABI, source code)
    • Gas oracle
    • Token information
    • Transaction data
    • And more

Requirements

Installation

  1. Clone the repository:

    git clone https://github.com/huahuayu/etherscan-mcp-server.git
    cd etherscan-mcp-server
    
  2. Set Etherscan API key env variable:

    ETHERSCAN_API_KEY=your_api_key_here
    
  3. Build the server:

    make build
    
  4. Install the server:

    make install # install to /usr/local/bin
    

Usage

Default Mode (Standard Input/Output)

Run the server using stdin/stdout communication (default mode):

./bin/etherscan-mcp-server

This mode is useful for direct integration with LLM applications that communicate via stdin/stdout.

MCP config:

{
  "mcpServers": {
    "etherscan-mcp-server": {
      "command": "etherscan-mcp-server",
      "env": {
        "ETHERSCAN_API_KEY": "$your_api_key"
      }
    }
   }
}

Restart cursor and check if it's success:

SSE Mode

Run the server in Server-Sent Events mode:

./bin/etherscan-mcp-server --sse

In SSE mode, the server listens on HTTP and provides an SSE endpoint.

SSE MCP config:

{
  "mcpServers": {
    "etherscan-mcp-server": {
      "url": "http://localhost:4000/sse",
      "env": {
        "ETHERSCAN_API_KEY": "$your_api_key"
      }
    }
   }
}

Server Options

  • --sse: Enable SSE server mode (default is stdin/stdout mode)
  • --port <port>: Specify the port for SSE server (defaults to PORT env var or 4000)

Connection Endpoints (SSE Mode)

When running in SSE mode, the server provides:

  • SSE Endpoint: http://localhost:4000/sse

Supported Chains

50+ chains supported, plz refer https://docs.etherscan.io/etherscan-v2/getting-started/supported-chains

Example Queries

You can use natural language queries like these:

Account and Balance Information

  • "What's the ETH balance of address 0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae?"
  • "Show me the token balance for USDT on address 0x123abc... on BSC"
  • "How many transactions has 0xvitalik.eth made from this address?"

Block Information

  • "Get information about the latest Polygon block"
  • "What are the rewards for miners in block 17000000?"
  • "Who mined block 16900000 on Ethereum?"

Contract Interaction

  • "Show me the source code at 0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"
  • "What's the ABI for the USDC contract on Polygon?"
  • "Call the balanceOf function of USDT contract with my address as parameter"

Transaction Information

  • "Give me details for transaction 0x123456789abcdef..."
  • "Has transaction 0xabcdef... been confirmed yet?"
  • "What was the gas price used in transaction 0x789abc..."

Gas and Network

  • "What are the current gas prices on Ethereum?"
  • "What's the recommended gas price for a fast transaction right now?"
  • "How many transactions are pending on Ethereum network?"

Token Information

  • "Tell me about the LINK token contract"
  • "What ERC-721 NFTs does address 0x123... own?"
  • "Show recent token transfers for 0xvitalik.eth"

Custom Queries

  • "Track all USDC transfers to Binance hot wallet in the last 1000 blocks"
  • "Which addresses received the most ETH in block 17000000?"
  • "Compare gas usage on Ethereum vs Arbitrum for similar transactions"

Available Tools

The Etherscan MCP Server provides the following tools for accessing blockchain data:

  1. getAccountBalance - Get the balance of an account on a specific blockchain
  2. getBlockByNumber - Get block information by block number
  3. getBlockRewards - Get block rewards by block number
  4. getContractABI - Get the ABI for a verified contract
  5. getContractSourceCode - Get the source code of a verified contract
  6. executeContractMethod - Execute a read contract function
  7. getGasOracle - Get current gas price oracle output
  8. getTokenBalance - Get the token balance of an account on a specific blockchain
  9. getTokenDetails - Get comprehensive token information
  10. getTransactionByHash - Get transaction details by hash
  11. getTransactionByBlockNumberAndIndex - Get transaction by block number and index
  12. getTransactionCount - Get the number of transactions sent from an address
  13. getTransactionReceipt - Check transaction receipt status
  14. getTransactionStatus - Check contract execution status
  15. getTransactionsByAddress - Get list of transactions by address
  16. getInternalTransactionsByAddress - Get list of internal transactions by address
  17. getTokenTransfersByAddress - Get list of token transfers by address
  18. getERC721Transfers - Get list of ERC721 token transfers by address
  19. getLatestBlockNumber - Get the latest block number

Each tool accepts specific parameters and provides blockchain data in a structured format.

License

MIT

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • chongdashu
  • 使用模型上下文协议(MCP),启用Cursor,Windsurf和Claude Desktop等AI助手客户,以通过自然语言控制虚幻引擎。

    Reviews

    2 (1)
    Avatar
    user_jNIzefW5
    2025-04-17

    I'm a big fan of the etherscan-mcp-server by huahuayu. This tool is a game-changer for anyone working with Ethereum blockchain data. The repository is well-organized and the documentation is clear, making it easy to get started. If you're serious about blockchain analysis, this is a must-have tool. Check it out at https://github.com/huahuayu/etherscan-mcp-server.