这是一个用于与任何 EVM 兼容的 RPC 终端点进行交互的 Model Context Protocol (MCP) 服务器实现。它为 AI 模型提供了与以太坊及 EVM 兼容区块链交互的标准接口,极大地便利了对区块链数据的访问和操作。
git clone
cd rpc-mcp
npm install
npm run build
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')在你的 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_blockNumbereth_getBalanceeth_getTransactionCounteth_getBlockByNumbereth_getTransactionByHasheth_calltrace_transaction