Skip to main content
Glama

MCP Etherscan 服务器

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

特征

  • 余额查询:获取任意以太坊地址的 ETH 余额

  • 交易历史:查看最近交易的详细信息

  • 代币转移:通过代币详细信息跟踪 ERC20 代币转移

  • 合约 ABI :获取智能合约 ABI 以供开发

  • 天然气价格:监控当前天然气价格(安全低、标准、快速)

  • ENS 解析:将以太坊地址解析为 ENS 名称

Related MCP server: Etherscan MCP Python

先决条件

安装

  1. 克隆存储库:

git clone [your-repo-url]
cd mcp-etherscan-server
  1. 安装依赖项:

npm install
  1. 在根目录中创建一个.env文件:

ETHERSCAN_API_KEY=your_api_key_here
  1. 构建项目:

npm run build

运行服务器

启动服务器:

npm start

该服务器将在 stdio 上运行,使其与 Claude Desktop 等 MCP 客户端兼容。

工作原理

该服务器实现了模型上下文协议 (MCP),以提供通过 Etherscan 的 API 与以太坊区块链数据交互的工具。每个工具都以 MCP 端点的形式公开,可供兼容的客户端调用。

可用工具

  1. check-balance

    • 输入:以太坊地址

    • 输出:以 Wei 和 ETH 为单位的 ETH 余额

  2. get-transactions

    • 输入:以太坊地址,可选限制

    • 输出:带有时间戳、值和地址的近期交易

  3. get-token-transfers

    • 输入:以太坊地址,可选限制

    • 输出:最近的 ERC20 代币转移及代币详细信息

  4. get-contract-abi

    • 输入:合约地址

    • 输出:JSON 格式的合约 ABI

  5. get-gas-prices

    • 输入:无

    • 输出:当前 Gwei 中的 gas 价格

  6. get-ens-name

    • 输入:以太坊地址

    • 输出:关联的 ENS 名称(如果可用)

与 Claude Desktop 一起使用

要将此服务器添加到 Claude Desktop:

  1. 使用npm start启动服务器

  2. 在 Claude Desktop 中:

    • 前往“设置”

    • 导航至 MCP 服务器部分

    • 点击“添加服务器”

    • 输入以下配置:

      {
        "name": "Etherscan Tools",
        "transport": "stdio",
        "command": "node /path/to/mcp-etherscan-server/build/index.js"
      }
    • 保存配置

  3. Etherscan 工具现在将在您的 Claude 对话中可用

Claude 中的示例用法

您可以使用如下命令:

Check the balance of 0x742d35Cc6634C0532925a3b844Bc454e4438f44e

或者

Show me recent transactions for vitalik.eth

发展

要添加新功能或修改现有功能:

  1. 主服务器逻辑位于src/server.ts

  2. Etherscan API 交互在src/services/etherscanService.ts中处理

  3. 更改后构建: npm run build

执照

MIT 许可证 - 详情请参阅许可证文件

Available Tools

6 tools
check-balanceB

Check the ETH balance of an Ethereum address

Inputs: address (required).

get-contract-abiC

Get the ABI for a smart contract

Inputs: address (required).

get-ens-nameB

Get the ENS name for an Ethereum address

Inputs: address (required).

get-gas-pricesA

Get current gas prices in Gwei

Inputs: no named parameters.

get-token-transfersC

Get ERC20 token transfers for an Ethereum address

Inputs: address (required), limit.

get-transactionsB

Get recent transactions for an Ethereum address

Inputs: address (required), limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose targeting different Ethereum-related functions: checking balances, retrieving contract ABIs, resolving ENS names, getting gas prices, fetching token transfers, and listing transactions. There is no overlap or ambiguity in their intended use cases.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using snake_case (e.g., check-balance, get-contract-abi, get-ens-name). The naming is uniform and predictable across all six tools.

    Tool Count5/5

    With 6 tools, this server is well-scoped for its Ethereum/blockchain domain. Each tool serves a specific, essential function without redundancy, making the count appropriate and manageable.

    Completeness4/5

    The toolset covers key read-only operations for Ethereum interactions, including balance checks, contract data, ENS resolution, gas prices, token transfers, and transactions. A minor gap exists in write operations (e.g., sending transactions or interacting with contracts), but the provided tools are sufficient for common querying tasks.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers