MCP ExplorerExplorer

Bun Mcp Evm Demo

@sociallayer-imon 10 months ago
1 MIT
FreeCommunity
AI Systems
A toolset for Ethereum Virtual Machine (EVM) based on Model Context Protocol (MCP), supporting multi-chain operations, token transfers, and balance queries.

Overview

What is Bun Mcp Evm Demo

bun-mcp-evm-demo is a toolset based on the Model Context Protocol (MCP) designed for Ethereum Virtual Machine (EVM) operations. It supports multi-chain operations, token transfers, and balance inquiries.

Use cases

Use cases include managing ERC20 and ERC721 tokens, conducting transactions on Ethereum networks, and developing applications that require multi-chain support.

How to use

To use bun-mcp-evm-demo, clone the project and install dependencies using ‘bun install’. Configure network settings and private keys as needed, then start the service with ‘bun run index.ts’.

Key features

Key features include ERC20 token operations (balance inquiries and transfers), ERC721 (NFT) operations (balance inquiries and transfers), and native token operations (ETH balance inquiries and transfers).

Where to use

bun-mcp-evm-demo can be used in blockchain development, decentralized finance (DeFi) applications, and any project requiring interaction with Ethereum-based tokens and networks.

Content

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

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers