MCP GetBlock Server

MCP GetBlock Server

Enables querying blockchain data from Ethereum and Solana via GetBlock.io API, including wallet balances, transactions, gas prices, and account information.

Category
访问服务器

README

MCP GetBlock Server

Model Context Protocol (MCP) server for interacting with GetBlock.io API.

Features

  • Blockchain data requests from various networks (ETH, Solana)
  • Real-time blockchain statistics
  • Wallet balance checking
  • Transaction status monitoring
  • Getting Solana account information
  • Getting current gas price in Ethereum
  • JSON-RPC interface to blockchain nodes
  • Environment-based configuration for API tokens

Installation

Option 1: Standard Node.js Installation

  1. Install dependencies:
npm install
  1. Compile TypeScript:
npm run build
  1. Create a .env file with access tokens for different blockchains (optional):
# Access tokens for different blockchains
ETH_ACCESS_TOKEN=your_eth_access_token_here
SOLANA_ACCESS_TOKEN=your_solana_access_token_here
  1. Start the server:
npm start

Option 2: Using Docker

  1. Build the Docker image:
docker build -t mcp/getblock:latest .
  1. Run the container with environment variables:
docker run -i --rm \
  -e ETH_ACCESS_TOKEN=your_eth_access_token_here \
  -e SOLANA_ACCESS_TOKEN=your_solana_access_token_here \
  mcp/getblock:latest

Development

For development, you can use the command:

npm run dev

This command will compile TypeScript and start the server.

Use with Claude Desktop, Cursor, or other IDE

Option 1: Direct Launch via Node.js

  1. Configure Claude Desktop to use this server by editing claude_desktop_config.json:
{
    "mcpServers": {
        "getblock": {
            "command": "npm",
            "args": [
                "start",
                "--prefix",
                "/ABSOLUTE/PATH/TO/mcp-getblock"
            ],
            "env": {
                "ETH_ACCESS_TOKEN": "your_eth_access_token_here",
                "SOLANA_ACCESS_TOKEN": "your_solana_access_token_here"
            }
        }
    }
}

Option 2: Launch via Docker

  1. Configure Claude Desktop to use the Docker container:
{
    "mcpServers": {
        "getblock": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "ETH_ACCESS_TOKEN",
                "-e",
                "SOLANA_ACCESS_TOKEN",
                "mcp/getblock:latest"
            ],
            "env": {
                "ETH_ACCESS_TOKEN": "your_eth_access_token_here",
                "SOLANA_ACCESS_TOKEN": "your_solana_access_token_here"
            }
        }
    }
}
  1. Restart Claude Desktop
  2. You should see the available tools in the toolbar

Available Tools

  1. get-chain-info - get general information about a blockchain network (ETH, Solana)
  2. get-wallet-balance - check wallet balance on the blockchain
  3. get-transaction - get details about a specific transaction
  4. get-latest-blocks - get information about the latest blocks
  5. get-solana-account - get information about a Solana account
  6. get-eth-gas-price - get current gas price in the Ethereum network

Detailed Tool Descriptions

get-chain-info

{
  "name": "get-chain-info",
  "description": "Get general information about a blockchain network",
  "inputSchema": {
    "properties": {
      "chain": {
        "type": "string",
        "description": "Blockchain network (e.g., eth, solana)",
        "default": "eth"
      }
    }
  }
}

get-wallet-balance

{
  "name": "get-wallet-balance",
  "description": "Get the balance of a wallet address on a blockchain",
  "inputSchema": {
    "properties": {
      "address": {
        "type": "string",
        "description": "The wallet address to check"
      },
      "chain": {
        "type": "string",
        "description": "Blockchain network (e.g., eth, solana)",
        "default": "eth"
      }
    },
    "required": ["address"]
  }
}

get-transaction

{
  "name": "get-transaction",
  "description": "Get details of a specific transaction",
  "inputSchema": {
    "properties": {
      "txid": {
        "type": "string",
        "description": "Transaction ID/hash"
      },
      "chain": {
        "type": "string",
        "description": "Blockchain network (e.g., eth, solana)",
        "default": "eth"
      }
    },
    "required": ["txid"]
  }
}

Access Token Priority Order

Access tokens are used in the following priority order:

  1. Tokens passed through environment variables (env in claude_desktop_config.json)
  2. Tokens from the .env file
  3. Default values (if not specified in items 1 and 2)

Architecture & Technology Stack

  • Language: TypeScript (compiled to JavaScript)
  • Runtime: Node.js
  • Communication Protocol: Model Context Protocol (MCP)
  • API Integration: GetBlock.io JSON-RPC API
  • Authentication: Token-based API authentication
  • Transport Layer: Standard I/O (stdio) for communication with Claude Desktop
  • Dependencies:
    • @modelcontextprotocol/sdk: For MCP implementation
    • axios: HTTP client for API requests
    • dotenv: Environment variable management

Supported Networks

As of June 2025, this MCP server supports the following blockchain networks:

Primary Networks

  • Ethereum (ETH) - Full support for balance, transaction, block, and gas price queries
  • Solana (SOL) - Support for balance, account info, transaction, and block queries

Future Expansions

Support for additional networks from GetBlock.io's infrastructure (which includes over 75+ blockchain networks [1]) can be implemented by extending the current codebase.

Examples of Usage

Checking ETH Balance

You can ask Claude to check the balance of an Ethereum wallet by using the get-wallet-balance tool:

What is the balance of this Ethereum wallet: 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045?

Viewing Transaction Details

To get information about a specific transaction:

Can you show me the details of this Ethereum transaction: 0x0ac94a788a79e3eaa72a33f1da97b79728b570054fe156a7f60e06f5791aaf36?

Getting Current Gas Price

To check the current gas prices on Ethereum:

What are the current gas prices on Ethereum?

Implementation Details

Server Architecture

The server follows a simple architecture:

  1. Initialization: The server initializes using the MCP SDK and configures the supported tools
  2. Tool Registration: Each blockchain operation is registered as a separate tool with its own input schema
  3. Request Handling: Incoming requests are processed by the main handler which:
    • Extracts the tool name and arguments
    • Validates input parameters
    • Constructs the appropriate JSON-RPC call to GetBlock API
    • Processes the response and returns formatted results
  4. Authentication: API tokens are managed with a priority system using environment variables

Code Structure

  • Tool Definitions: Each blockchain operation is defined as a separate tool with metadata
  • Request Handler: Main logic for processing tool invocations
  • API Integration: Helper functions for constructing and sending requests to GetBlock
  • Response Processing: Formatting and conversion of blockchain data (e.g., wei to ether)

Troubleshooting

API Connection Issues

If you encounter connection issues to the GetBlock API:

  1. Verify that your access tokens are correctly set in environment variables or .env file
  2. Check if the GetBlock service is operational
  3. Ensure your network can reach the GetBlock API servers

Invalid Response Format

If you receive error messages about invalid response format:

  1. Verify that the blockchain and method you're using are supported by GetBlock
  2. Check if your access token has sufficient permissions
  3. Ensure the parameters are correctly formatted for the specific blockchain

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选