Dune API MCP Server

Dune API MCP Server

Allows LLM agents and MCP clients to analyze blockchain data including wallet balances, token information, and transaction history across EVM and Solana chains through the Dune API.

Category
访问服务器

README

ChatGPT Image May 23, 2025, 10_25_41 AM

Dune API MCP Server

This project implements a Model Context Protocol (MCP) server that exposes functionality from the Dune API, allowing LLM agents and other MCP clients to analyze blockchain information.

Features

The server provides the following MCP tools and resources based on the Dune API:

EVM Tools:

  • get_evm_balances: Fetches EVM token balances for a wallet.
  • get_evm_activity: Fetches EVM account activity.
  • get_evm_collectibles: Fetches EVM NFT collectibles.
  • get_evm_transactions: Retrieves granular EVM transaction details.
  • get_evm_token_info: Fetches metadata and price for EVM tokens.
  • get_evm_token_holders: Discovers EVM token holder distributions.

SVM Tools:

  • get_svm_balances: Fetches SVM token balances.
  • get_svm_transactions: Fetches SVM transactions (Solana only).

Resources:

  • dune://evm/supported-chains: Provides a list of EVM chains supported by the Dune API.

Prompts:

  • /evm_wallet_overview {walletAddress}: Get a quick overview of an EVM wallet.
  • /analyze_erc20_token {chainId} {tokenAddress}: Analyze a specific ERC20 token.
  • /svm_address_check {walletAddress}: Check basic information for an SVM address.

Quick Start

# Clone the repository
git clone https://github.com/crazyrabbitLTC/mcp-web3-stats.git
cd mcp-web3-stats

# Install dependencies
bun install

# Create .env file with your Dune API key
echo "DUNE_API_KEY=your_actual_dune_api_key_here" > .env

# Start the server
bun start

# In a separate terminal, run the MCP Inspector to test the tools
npx @modelcontextprotocol/inspector bun run index.ts

Installation from npm

You can install the Web3 Stats Server globally via npm:

# Install globally
npm install -g mcp-web3-stats

# Set your Dune API key as an environment variable
export DUNE_API_KEY=your_actual_dune_api_key_here

# Run the server
mcp-web3-stats

# In a separate terminal, test with the MCP Inspector
npx @modelcontextprotocol/inspector mcp-web3-stats

Alternatively, you can run it directly with npx:

# Set your Dune API key as an environment variable
export DUNE_API_KEY=your_actual_dune_api_key_here

# Run the server with npx
npx mcp-web3-stats

# In a separate terminal, test with the MCP Inspector
npx @modelcontextprotocol/inspector npx mcp-web3-stats

What You Can Do With This

This MCP server allows you and your AI assistant to analyze blockchain data and wallet information directly. Here are some example use cases:

1. Check Wallet Balances

You can quickly view all tokens (including ERC20s and NFTs) held by any wallet address:

Assistant: Let me check the balances in this wallet for you.

[Uses get_evm_balances with walletAddress=0xYourWalletAddress]

This wallet contains:
- 1.25 ETH (~$3,800)
- 500 USDC ($500)
- Several NFTs including a CryptoPunk and two Bored Apes

2. Analyze Token Information and Holders

You can research specific tokens and their distribution:

Assistant: Let me analyze this token for you.

[Uses get_evm_token_info with chainId=1 and tokenAddress=0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984]

UNI Token Information:
- Current price: $5.32
- Market cap: $2.7B 
- 24h trading volume: $89M

[Uses get_evm_token_holders with chainId=1 and tokenAddress=0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984]

Top UNI Token Holders:
1. 0x47173B170C64d16393a52e6C480b3Ad8c302ba1e: 5.2% of supply
2. 0x1a9C8182C09F50C8318d769245beA52c32BE35BC: 3.8% of supply
...

3. Review Recent Transactions

You can analyze transaction history for any address:

Assistant: Here's a summary of recent transactions.

[Uses get_evm_transactions with walletAddress=0xYourWalletAddress]

Recent activity:
- Yesterday: Swapped 2 ETH for 3,500 UNI on Uniswap
- 3 days ago: Withdrew 5 ETH from Binance
- Last week: Minted an NFT for 0.08 ETH

4. Check Solana Balances

You can also analyze Solana wallets:

Assistant: Let me check your Solana wallet balances.

[Uses get_svm_balances with walletAddress=YourSolanaAddress]

This wallet contains:
- 12.5 SOL (~$875)
- 2,500 USDC ($2,500)
- Several SPL tokens including 150 BONK

Configure this server with Claude Desktop or other MCP clients to enable your AI assistant to retrieve and analyze on-chain data in real time.

Prerequisites

  • Bun (latest version recommended)
  • A Dune API Key from Sim API

Setup

  1. Clone the repository (if applicable) or ensure you have the project files.

  2. Install dependencies:

    bun install
    
  3. Configure Environment Variables: Create a .env file in the project root and add your Dune API key:

    DUNE_API_KEY=your_actual_dune_api_key_here
    

    Replace your_actual_dune_api_key_here with your valid key.

Running the Server

  • To run the server directly using Bun (for development/testing):

    bun start
    

    The server will start and listen for MCP messages via stdio.

  • To build the server to JavaScript (for environments that require JS): Use the configured build script which utilizes the TypeScript compiler (tsc):

    bun run build
    

    This command executes bunx tsc as defined in package.json. tsc uses the tsconfig.json file to determine entry points (like index.ts) and compilation options, outputting the JavaScript files to the ./dist directory.

    You can then run the built server with Node.js or Bun:

    node dist/index.js 
    # or
    bun dist/index.js
    

    Alternatively, if you wish to use Bun's built-in bundler directly (which may have different behavior or configuration needs than tsc), you would typically specify the entry point explicitly: bun build ./index.ts --outdir ./dist However, this project is set up to use tsc for builds via the bun run build script.

Testing with MCP Inspector

Once the server is running (e.g., via bun start in one terminal), you can connect to it using the MCP Inspector in another terminal:

# If running the TypeScript source directly
npx @modelcontextprotocol/inspector bun run index.ts

Or, if you have built the server and are running the JavaScript version:

# If running the built JavaScript version from ./dist
npx @modelcontextprotocol/inspector node dist/index.js

This will launch the Inspector UI, allowing you to discover and test the tools, resources, and prompts provided by this server.

Integrating with MCP Clients (e.g., Claude Desktop)

To use this server with an MCP client like Claude Desktop, you'll need to configure the client to launch this server. For Claude Desktop, you would modify its claude_desktop_config.json file (typically found at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows).

Below are example configurations. You can choose a server name (e.g., dune_api_server or web3_stats_server) that makes sense to you.

Example 1: Running the built JavaScript version with Node.js (Recommended for stability)

This assumes you have already run bun run build to create the ./dist directory.

{
  "mcpServers": {
    "dune_api_server": { // You can name this server entry whatever you like
      "command": "node",
      "args": [
        "/ABSOLUTE/PATH/TO/YOUR/mcp-web3-stats/dist/index.js"
      ],
      "env": {
        "DUNE_API_KEY": "your_actual_dune_api_key_here" // Replace with your key
      }
    }
  }
}

Example 2: Running the TypeScript source directly with Bun

This is convenient for development but might require specifying the full path to your Bun executable.

{
  "mcpServers": {
    "dune_api_server_dev": { // You can name this server entry whatever you like
      "command": "/full/path/to/your/bun/executable", // e.g., /Users/username/.bun/bin/bun or C:\Users\username\.bun\bin\bun.exe
      "args": [
        "run",
        "/ABSOLUTE/PATH/TO/YOUR/mcp-web3-stats/index.ts"
      ],
      "env": {
        "DUNE_API_KEY": "your_actual_dune_api_key_here" // Replace with your key
      }
    }
  }
}

Important Configuration Notes:

  • API Key: You MUST replace "your_actual_dune_api_key_here" in the env block with your actual Dune API key. While the server script includes dotenv to load a local .env file, relying on the client (like Claude Desktop) to pass the environment variable via its configuration is more reliable for servers launched by external hosts.
  • Absolute Paths: You MUST replace /ABSOLUTE/PATH/TO/YOUR/... with the correct and full absolute path to the dist/index.js file (for Node) or index.ts file (for Bun direct execution) and to the Bun executable if running TypeScript directly.
  • Bun Executable Path: If using Bun directly (Example 2), the command might need to be the full, absolute path to your Bun executable (e.g., ~/.bun/bin/bun on macOS/Linux, or the equivalent path on Windows) if it's not universally in the PATH for applications like Claude Desktop.
  • Restart Client: After saving changes to claude_desktop_config.json, you must restart Claude Desktop for the changes to take effect.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选