MCP Etherscan Server
MCP Etherscan 服务器
一个 MCP(模型上下文协议)服务器,通过 Etherscan 的 API 提供以太坊区块链数据工具。功能包括查询 ETH 余额、查看交易历史记录、追踪 ERC20 转账、获取合约 ABI、监控 Gas 价格以及解析 ENS 域名。
特征
余额查询:获取任意以太坊地址的 ETH 余额
交易历史:查看最近交易的详细信息
代币转移:通过代币详细信息跟踪 ERC20 代币转移
合约 ABI :获取智能合约 ABI 以供开发
天然气价格:监控当前天然气价格(安全低、标准、快速)
ENS 解析:将以太坊地址解析为 ENS 名称
Related MCP server: MCP Etherscan Server
先决条件
Node.js >= 18
Etherscan API 密钥(从https://etherscan.io/apis获取)
安装
克隆存储库:
git clone [your-repo-url]
cd mcp-etherscan-server安装依赖项:
npm install在根目录中创建一个
.env文件:
ETHERSCAN_API_KEY=your_api_key_here构建项目:
npm run build运行服务器
启动服务器:
npm start该服务器将在 stdio 上运行,使其与 Claude Desktop 等 MCP 客户端兼容。
工作原理
该服务器实现了模型上下文协议 (MCP),以提供通过 Etherscan 的 API 与以太坊区块链数据交互的工具。每个工具都以 MCP 端点的形式公开,可供兼容的客户端调用。
可用工具
check-balance输入:以太坊地址
输出:以 Wei 和 ETH 为单位的 ETH 余额
get-transactions输入:以太坊地址,可选限制
输出:带有时间戳、值和地址的近期交易
get-token-transfers输入:以太坊地址,可选限制
输出:最近的 ERC20 代币转移及代币详细信息
get-contract-abi输入:合约地址
输出:JSON 格式的合约 ABI
get-gas-prices输入:无
输出:当前 Gwei 中的 gas 价格
get-ens-name输入:以太坊地址
输出:关联的 ENS 名称(如果可用)
与 Claude Desktop 一起使用
要将此服务器添加到 Claude Desktop:
使用
npm start启动服务器在 Claude Desktop 中:
前往“设置”
导航至 MCP 服务器部分
点击“添加服务器”
输入以下配置:
{ "name": "Etherscan Tools", "transport": "stdio", "command": "node /path/to/mcp-etherscan-server/build/index.js" }保存配置
Etherscan 工具现在将在您的 Claude 对话中可用
Claude 中的示例用法
您可以使用如下命令:
Check the balance of 0x742d35Cc6634C0532925a3b844Bc454e4438f44e或者
Show me recent transactions for vitalik.eth发展
要添加新功能或修改现有功能:
主服务器逻辑位于
src/server.tsEtherscan API 交互在
src/services/etherscanService.ts中处理更改后构建:
npm run build
执照
MIT 许可证 - 详情请参阅许可证文件
Available Tools
6 toolscheck-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
Scored across 6 tools
Each tool has a clearly distinct purpose targeting different Ethereum-related queries: balance checks, contract ABI retrieval, ENS name lookup, gas price monitoring, token transfer history, and transaction history. There is no overlap or ambiguity between these functions, making tool selection straightforward for an agent.
All tool names follow a consistent verb_noun pattern using snake_case (e.g., check-balance, get-contract-abi, get-ens-name). This uniformity enhances readability and predictability, allowing agents to easily understand and navigate the tool set without confusion from mixed naming conventions.
With 6 tools, the server is well-scoped for an Etherscan-like interface, covering essential Ethereum operations without being overwhelming or sparse. Each tool serves a distinct and useful function, making the count appropriate for the domain and typical agent workflows.
The tool set covers core Ethereum functionalities such as address queries, contract interactions, and network data, but has minor gaps. For example, it lacks tools for checking internal transactions, verifying contract source code, or fetching block information, which could limit some advanced use cases, though agents can still perform most common tasks effectively.
Maintenance
Related MCP Connectors
Etherscan Api - 71 tools for data, metrics, and on-chain analytics
EVM chain reads for agents: balances, gas, fees, blocks, txs, logs, ENS. 15 tools, x402 per call.
Read-only Etherscan V2 blockchain data: balances, transactions, transfers, tokens, contracts, logs.
Explore blockchain data across addresses, tokens, blocks, and transactions. Investigate any transa…
Related MCP Servers
- AlicenseAqualityDmaintenanceFacilitates interaction with Ethereum blockchain data via Etherscan's API, providing real-time access to balances, transactions, token transfers, contract ABIs, gas prices, and ENS name resolutions.613 npm30MIT
- AlicenseAqualityDmaintenanceProvides Ethereum blockchain data tools via Etherscan's API, enabling users to check balances, view transactions, track token transfers, fetch contract ABIs and code, monitor gas prices, and resolve ENS names.7MIT
- AlicenseAqualityFmaintenanceProvides MCP tools to query Etherscan for Ethereum blockchain data—ETH balances, ERC-20 tokens, transactions, contract ABIs, and gas prices—without requiring an API key.811 npmMIT
- AlicenseNot gradedqualityDmaintenanceProvides comprehensive access to Ethereum blockchain data through the Etherscan API, including account, block, contract, transaction, token, gas, statistics, logs, and RPC proxy tools.4MIT