本项目中的模型上下文协议 (MCP) 服务器,能让 Claude 借助 ethers.js v5 对 Ethereum 及 EVM 兼容区块链进行操作。它支持创建钱包、查询余额、发送交易以及与智能合约交互等功能。
重启 Claude Desktop 后,Claude 就能通过 MCP 服务器与以太坊区块链交互。例如:
能否为我创建一个新的以太坊钱包?
0x742d35Cc6634C0532925a3b844Bc454e4438f44e 的余额是多少?
能否帮助我向 0x742d35Cc6634C0532925a3b844Bc454e4438f44e 发送 0.1 ETH?
Claude 将通过 MCP 服务器直接与以太坊区块链交互。
MCP 服务器向 Claude 提供以下工具:
wallet_create_random:创建一个新的随机钱包wallet_from_private_key:从私钥创建钱包wallet_from PublicKey:从未公开密钥创建钱包wallet_from_mnemonic:从助记词创建钱包钱包恢复:恢复现有钱包钱包导出:导出钱包信息钱包导入:导入外部钱包资产余额查询:检查钱包中的代币和 ETH 平衡代币转移:向其他地址发送代币ETH 转移:向其他地址发送 ETH合约部署:在区块链上部署新智能合约合约调用:与已部署的智能合约进行交互交易状态查询:检查交易的状态和详细信息https://nodejs.org/
npm install ethers
https://metamask.io/
git clone https://github.com/dcSpark/mcp-cryptowallet-evm.git
cd mcp-cryptowallet-evm
npm install
npm run build
node build/index.js
node src/index.js
将以下内容添加到 ~/.env 文件中:
WALLET_PROVIDER=metamask
metamask_rpc_url=https://eth-mainnet.alchemyapi.io/YOUR_API_KEY
创建 wallet.config.js 文件:
module.exports = {
mnemonic: 'your 12-word mnemonic',
accounts: ['0xYourAccountAddress'],
hdPath: "m/44'/60'/0'/0",
chainId: 1,
gasPrice: 2000000000,
gasLimit: 200000,
confirmations: 3
}
要添加新的工具到 MCP 服务器:
src/tools.ts 中定义工具handlers 对象中npm run build
MIT