KB

kukapay/blocknative-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

4 stars 6 forks 质量 47 趋势 12MIT

An MCP server that provides real-time gas price predictions across multiple blockchains.

概览

An MCP server that provides real-time gas price predictions across multiple blockchains, powered by Blocknative. - : - predict_gas_price: Fetches gas price predictions for a specified chain (default: Ethereum Mainnet, chain_id=1), including base fee and a table with confidence levels, price, max priority fee, and max fee. - estimate_gas_cost: Estimates transaction costs based on gas limit, confidence level, and chain ID, returning costs in Gwei and ETH. - get_supported_chains: Lists supported blockchains in a table with chain ID, system, and network. - : - gas_price_query: A prompt template for querying gas prices at a specific confidence level and chain ID. - : Uses httpx for non-blocking HTTP requests to Blocknative's Gas Price and Chains APIs. - : Supports low-frequency access without a Blocknative API key; high-frequency use requires setting BLOCKNATIVE_API_KEY. - : Version 3.

README

以下为原文 README 节选,完整内容请查看原文。

Blocknative MCP Server

An MCP server that provides real-time gas price predictions across multiple blockchains, powered by Blocknative.

Features

  • Tools:
    • predict_gas_price: Fetches gas price predictions for a specified chain (default: Ethereum Mainnet, chain_id=1), including base fee and a table with confidence levels, price, max priority fee, and max fee.
    • estimate_gas_cost: Estimates transaction costs based on gas limit, confidence level, and chain ID, returning costs in Gwei and ETH.
    • get_supported_chains: Lists supported blockchains in a table with chain ID, system, and network.
  • Prompt:
    • gas_price_query: A prompt template for querying gas prices at a specific confidence level and chain ID.
  • Asynchronous: Uses httpx for non-blocking HTTP requests to Blocknative’s Gas Price and Chains APIs.
  • Optional API Key: Supports low-frequency access without a Blocknative API key; high-frequency use requires setting BLOCKNATIVE_API_KEY.

Prerequisites

  • Python: Version 3.10
  • uv: For dependency management and running the project (installation guide)
  • Blocknative API Key (optional): Required for high-frequency API access. Sign up at Blocknative to obtain a free API key.

Installation

  1. Clone the Repository:

    git clone https://github.com/kukapay/blocknative-mcp.git
    cd blocknative-mcp
    
  2. Set Up the Project with uv:

    uv sync
    
  3. Set the Blocknative API Key (Optional):

    • For high-frequency access, set the environment variable:
      export BLOCKNATIVE_API_KEY="your-api-key-here"
      
    • For low-frequency access, skip this step.

Usage

The server provides three tools and one prompt, accessible via the FastMCP framework. You can run the server in development mode, execute it directly, or integrate it with Claude Desktop.

Running the Server

  1. Development Mode with MCP Inspector:

    uv run mcp dev blocknative-mcp
    

    This opens the MCP Inspector, a web interface for testing tools and prompts interactively.

  2. Direct Execution:

    uv run blocknative-mcp
    
  3. Claude Desktop Integration:

    uv run mcp install blocknative-mcp --name "Blocknative MCP Server"
    

    This installs the server for use with Claude Desktop.

Tools

  • predict_gas_price(chain_id: int = 1) -> str: Fetches gas price predictions for a chain (default: Ethereum Mainnet). Returns base fee and a Markdown table with confidence levels, price, max priority fee, and max fee.
    • Example:
      Gas Price Predictions for Chain ID 1 (ethereum/main):
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →