Back to MCP directory
publicPublicdnsLocal runtime

evm-rpc-mcp-server

一个用于与EVM兼容区块链交互的RPC MCP服务器实现,提供标准化的接口供AI模型调用。

article

README

🚀 RPC MCP 服务器

这是一个用于与任何 EVM 兼容的 RPC 终端点进行交互的 Model Context Protocol (MCP) 服务器实现。它为 AI 模型提供了与以太坊及 EVM 兼容区块链交互的标准接口,极大地便利了对区块链数据的访问和操作。

✨ 主要特性

  • 支持任何 EVM 兼容的 RPC 终端点,具备广泛的适用性。
  • 可获取当前区块编号,方便了解链上最新状态。
  • 能够检查账户余额,掌握账户资产情况。
  • 可以获取交易计数(非ces),跟踪账户交易活跃度。
  • 可检索区块信息,深入了解区块链历史。
  • 能获取交易详细信息,为交易分析提供依据。
  • 支持调用合约,实现智能合约的交互操作。

📦 安装指南

先决条件

  • Node.js (v16 或更高版本)
  • npm (Node 包管理器)

具体步骤

  1. 克隆仓库:
git clone <repository-url>
cd rpc-mcp
  1. 安装依赖项:
npm install
  1. 构建项目:
npm run build
  1. 全局安装:
npm install -g .

此全局安装使 rpc-mcp 命令在系统范围内可用,这是 Cursor 找到并执行 MCP 服务器所必需的。

📚 详细文档

配置

服务器使用以下环境变量:

  • RPC_URL:连接到的 RPC 终端点 URL(例如 'https://mainnet-rpc.game7.io' 或 'https://testnet-rpc.game7.io')
  • API_URL:连接到的 API 终端点 URL(例如 'https://mainnet.game7.io/api/v2' 或 'https://testnet.game7.io/api/v2')

Cursor MCP 配置

在你的 mcp.json 文件中添加以下内容(位于 Cursor 的 Settings > MCP > Add New Global Server):

{
  "mcpServers": {
    "rpc-mcp": {
      "command": "npx",
      "args": ["-y", "rpc-mcp"],
      "env": {
        "RPC_URL": "YOUR_RPC_ENDPOINT",
        "API_URL": "YOUR_API_ENDPOINT"
      }
    }
  } 
}

此配置将在 Cursor 中提供以下工具:

  • eth_blockNumber
  • eth_getBalance
  • eth_getTransactionCount
  • eth_getBlockByNumber
  • eth_getTransactionByHash
  • eth_call
  • trace_transaction
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client