MCPInstall
bun-mcp-evm-demo logo

bun-mcp-evm-demo

by sociallayer-im 1 stars sociallayer-im/bun-mcp-evm-demo

A toolset for Ethereum Virtual Machine (EVM) based on Model Context Protocol (MCP), supporting multi-chain operations, token transfers, and balance queries.

READMEmain

bun-mcp-evm

这是一个基于 Model Context Protocol (MCP) 的以太坊虚拟机(EVM)工具集,支持多链操作、代币转账和余额查询等功能。

环境要求

  • Bun v1.2.2 或更高版本
  • Node.js 环境(用于某些依赖包)

安装

  1. 克隆项目并安装依赖:
bun install

配置

网络配置

在使用之前,需要先配置网络信息。支持配置多个网络,每个网络需要提供以下信息:

  • 网络名称(例如:mainnet、sepolia)
  • RPC URL
  • 链 ID

示例配置命令:

bun run index.ts --configure-network mainnet --rpc-url "https://eth-mainnet.g.alchemy.com/v2/your-api-key" --chain-id 1

私钥管理

为了进行转账操作,需要配置私钥。可以为私钥设置别名以方便使用:

bun run index.ts --private-key "0x你的私钥" --alias "my-wallet"

使用说明

启动服务

bun run index.ts

支持的功能

  1. ERC20 代币操作

    • 查询余额
    • 转账
  2. ERC721 (NFT) 操作

    • 查询余额
    • 转账
  3. 原生代币操作

    • 查询 ETH 余额
    • 转账 ETH

常见问题

  1. Q: 如何更改默认的私钥? A: 使用 --set-default-key 参数设置默认私钥:

    bun run index.ts --set-default-key "my-wallet"
    
  2. Q: 如何查看已配置的网络? A: 使用 --list-networks 参数查看所有配置的网络:

    bun run index.ts --list-networks
    

安全提示

  • 请勿在不安全的环境中暴露私钥
  • 建议使用环境变量来存储敏感信息
  • 定期备份数据库文件(evm.sqlite 和 security.sqlite)

故障排除

  1. 如果遇到网络连接问题:

    • 检查 RPC URL 是否正确
    • 确认网络配置的链 ID 是否匹配
    • 验证 API key 是否有效
  2. 如果转账失败:

    • 确认账户余额是否充足
    • 检查 gas 设置是否合理
    • 验证接收地址格式是否正确

贡献

欢迎提交 Issue 和 Pull Request!

许可证

MIT

More Web3 & Blockchain MCP servers

Similar servers from the same category.

ZBD Payments

zebedeeio

Integrates with ZBD Payments API to enable Bitcoin and Lightning Network transactions including sending/receiving payments, wallet operations, voucher management, and OAuth2 authentication flows

authenticationpayment

Moralis Web3 API

moralisweb3

Integrates with Moralis Web3 API to enable blockchain data access, token analysis, and smart contract interactions without requiring deep Web3 development knowledge

Web3 & Blockchain

Provides a bridge to the NFTGo Developer API for accessing Ethereum NFT data including collections, assets, market trends, and wallet information through authenticated HTTP requests.

API

Provides blockchain context through Nodit's APIs, enabling real-time interaction with multiple protocols including Ethereum, Polygon, and Aptos for token information and on-chain activity analysis.

Web3 & Blockchain