eth-mcp-server 是一个专注于以太坊的 MCP 服务器,其开发者仍在探索它的最终应用场景。目前,它主要是为了给大家带来乐趣而创建的!
pip install web3 requests
pip install mcp mcp[cli]
pip install uv
ETHERSCAN_API_KEY = "YOUR_API_KEY_HERE"
打开Cursor的MCP设置
点击“添加新的全局MCP服务器”按钮
设置如下配置,其中请用您自己的路径替换路径:
{
"mcpServers": {
"eth": {
"type": "stdio",
"command": "/path/to/python /path/to/blockchain.py"
}
}
}
模型上下文协议(MCP)允许AI模型通过标准化工具和资源实时访问数据并执行操作。此实现为AI助手提供了以太坊区块链功能。
get_eth_balance(address) - 获取地址的ETH余额get_eth_price() - 获取当前以太坊价格(USD)get_gas_price() - 获取以太坊网络当前_gas_价格get_latest_block() - 获取最新区块信息get_transaction(tx_hash) - 获取交易详情estimate_tx_fee(gas_amount) - 估算交易费用get_account_transactions(address, page, offset) - 获取账户交易历史ethereum://price - 以太坊价格信息ethereum://stats - 以太坊网络统计信息ethereum://address/{address} - 地址信息ethereum://address/{address}/transactions - 地址交易历史该服务使用的外部API包括: