CM

crazyrabbitltc/mcp-etherscan-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

30 stars 22 forks 质量 57 趋势 0MIT

crazyrabbitltc/mcp-etherscan-server 是从 https://github.com/crazyrabbitltc/mcp-etherscan-server. 导入的 MCP 服务器候选

概览

crazyrabbitltc/mcp-etherscan-server 是从 https://github.com/crazyrabbitltc/mcp-etherscan-server. 导入的 MCP 服务器候选

概述(AI 翻译)

一个MCP(模型上下文协议)服务器,通过Etherscan的API提供以太坊区块链数据工具。功能包括检查ETH余额、查看交易历史、跟踪ERC20转账、获取合约ABI、监控燃气价格以及解析ENS名称。

特色

  • 余额检查:获取任意以太坊地址的ETH余额
  • 交易历史:查看包含详细信息的最新交易
  • 代币转移:跟踪ERC20代币转移并附带代币详情
  • 合约ABI:获取智能合约ABI用于开发
  • 天然气价格:监控当前天然气价格(安全低价、标准、快速)
  • ENS 解析:将以太坊地址解析为 ENS 名称

先修条件

安装

  1. 克隆仓库:

  2. 安装依赖:

  3. 在根目录中创建一个 .env 文件:

  4. 建设项目:

运行服务器

启动服务器:

服务器运行在 stdio,兼容 MCP 客户端如 Claude Desktop。

工作原理

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Etherscan Server

An MCP (Model Context Protocol) server that provides Ethereum blockchain data tools via Etherscan’s API. Features include checking ETH balances, viewing transaction history, tracking ERC20 transfers, fetching contract ABIs, monitoring gas prices, and resolving ENS names.

Features

  • Balance Checking: Get ETH balance for any Ethereum address
  • Transaction History: View recent transactions with detailed information
  • Token Transfers: Track ERC20 token transfers with token details
  • Contract ABI: Fetch smart contract ABIs for development
  • Gas Prices: Monitor current gas prices (Safe Low, Standard, Fast)
  • ENS Resolution: Resolve Ethereum addresses to ENS names

Prerequisites

Installation

  1. Clone the repository:
git clone [your-repo-url]
cd mcp-etherscan-server
  1. Install dependencies:
npm install
  1. Create a .env file in the root directory:
ETHERSCAN_API_KEY=your_api_key_here
  1. Build the project:
npm run build

Running the Server

Start the server:

npm start

The server will run on stdio, making it compatible with MCP clients like Claude Desktop.

How It Works

This server implements the Model Context Protocol (MCP) to provide tools for interacting with Ethereum blockchain data through Etherscan’s API. Each tool is exposed as an MCP endpoint that can be called by compatible clients.

Available Tools

  1. check-balance

    • Input: Ethereum address
    • Output: ETH balance in both Wei and ETH
  2. get-transactions

    • Input: Ethereum address, optional limit
    • Output: Recent transactions with timestamps, values, and addresses
  3. get-token-transfers

    • Input: Ethereum address, optional limit
    • Output: Recent ERC20 token transfers with token details
  4. get-contract-abi

    • Input: Contract address
    • Output: Contract ABI in JSON format
  5. get-gas-prices

    • Input: None
    • Output: Current gas prices in Gwei
  6. get-ens-name

    • Input: Ethereum address
    • Output: Associated ENS name if available

Using with Claude Desktop

To add this server to Claude Desktop:

  1. Start the server using npm start

  2. In Claude Desktop:

    • Go to Settings
    • Navigate to the MCP Servers section
    • Click “Add Server”
    • Enter the following configuration:
      {
        "name": "Etherscan Tools",
        "transport": "stdio",
        "command": "node /path/to/mcp-etherscan-server/build/index.js"
      }
      
    • Save the configuration
  3. The Etherscan tools will now be available in your Claude conversations

Example Usage in Claude

You can use commands like:

Check the balance of 0x742d35Cc6634C0532925a3b844Bc454e4438f44e

or

Show me recent transactions for vitalik.eth

Development

To add new features or modify existing ones:

  1. The main server logic is in src/server.ts
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →