跳转至主要内容
返回示例应用

EVM MCP 服务器

EVM MCP Server connects AI assistants like Claude or Cursor to blockchain data across Ethereum and other EVM-compatible chains. This MCP server tool lets Claude check wallet balances, analyze contracts, and monitor gas prices through natural conversation, making crypto data accessible to AI agents.

前端框架/库:
Viem
语言:
TypeScript
构建工具/开发服务器:
Model Context Protocol
示例应用预览

概述

模型上下文协议(MCP)使大型语言模型(LLMs)能够通过一种基于消息的标准化协议与外部工具(如 HTTP API、文件,甚至区块链)进行交互。可以将其视为一种“函数调用”接口,像 Claude 或 Cursor 这样的智能代理可以接入该接口,从而将脚本或服务转化为原生 AI 扩展。

In this guide, you'll learn how to build and deploy a MCP server that enables LLM agents to access blockchain data across multiple EVM-compatible networks. This powerful integration allows AI models like Claude to interact directly with blockchain data, opening up new possibilities for Web3 automation and analysis.

Tech Stack

Written tutorial of this project: Create an EVM MCP Server with Claude Desktop

入门指南

安装依赖项


  1. Clone the repository
git clone https://github.com/quiknode-labs/qn-guide-examples.git
cd qn-guide-examples/AI/evm-mcp-server

  1. Install dependencies
npm 安装

  1. Build the project

Compile the TypeScript code:

npm 运行 build

Configure Claude Desktop

Environment variables are used to configure the server. These variables will be defined in Claude Desktop's configuration file, claude_desktop_config.json.

To configure, open the 克劳德桌面 app, go to 克劳德 > Settings > Developer. Then, modify the claude_desktop_config.json file with the following content: (if you already have other configurations, add the new configuration under the mcpServers object)

{
"mcpServers": {
"evm": {
"command": "node",
"args": [
"/absolute-path-to/evm-mcp-server/build/index.js"
],
"env": {
"QN_ENDPOINT_NAME": "your-quicknode-endpoint-name",
"QN_TOKEN_ID": "your-quicknode-token-id"
}
}
}
}

  • 替换 your-quicknode-endpoint-name with the name of your Quicknode endpoint.
  • 替换 your-quicknode-token-id with the token ID of your Quicknode endpoint.
  • 替换 /absolute-path-to with the absolute path to the evm-mcp-server directory.

Test the MCP Server

Restart Claude Desktop and test the server by asking Claude Desktop to perform a task that requires the EVM MCP Server. For example, ask Claude Desktop to get balance of an address on any supported chain.

Example Agent Interactions


  1. Check a wallet balance:
Give the balance of the 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 address on Ethereum

  1. Analyze a contract:
Analyze 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 on Ethereum

  1. Get current gas prices:
Analyze the current gas prices on Ethereum, is it a good time to use the chain?
投稿与反馈
我们非常希望听到您的反馈,并欢迎大家为这个示例应用做出任何贡献!
如需报告问题或提供反馈,请在 qn-guide-示例 存储库。
如需贡献,请按照以下步骤操作:
  1. 分叉该仓库
  2. 创建一个功能分支:
    git checkout -b feature/amazing-feature
  3. 提交您的更改:
    git commit -m "添加超棒的功能"
  4. 推送您的分支:
    git push origin feature/amazing-feature
  5. 提交一个拉取请求。