blocknative-mcp

blocknative-mcp

blocknative-mcp

Category
访问服务器

Tools

predict_gas_price

Predict gas prices for a specified chain, including base fee and detailed prediction data in a Markdown table. Parameters: - chain_id (int): The ID of the blockchain network (e.g., 1 for Ethereum Mainnet). Default: 1. - ctx (Optional[Context]): The MCP context object. Default: None.

estimate_gas_cost

Estimate gas cost for a transaction based on gas limit, confidence level, and chain. Parameters: - gas_limit (int): The gas limit for the transaction (e.g., 21000 for a simple transfer). - confidence (int): The confidence level for gas price prediction (0-100). - chain_id (int): The ID of the blockchain network (e.g., 1 for Ethereum Mainnet). Default: 1. - ctx (Optional[Context]): The MCP context object. Default: None.

get_supported_chains

List the blockchain networks supported by the Blocknative Gas Platform, formatted as a Markdown table. Parameters: - ctx (Optional[Context]): The MCP context object. Default: None. Returns: - A Markdown table listing supported chains with their chain ID, system, and network.

README

Blocknative MCP Server

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

GitHub License Python Version Status

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):
      - Base Fee Per Gas: 0.382910791 Gwei
      
      | Confidence | Price (Gwei) | Max Priority Fee (Gwei) | Max Fee (Gwei) |
      |------------|--------------|-------------------------|----------------|
      | 99%        | 0.52         | 0.14                    | 0.9            |
      | 95%        | 0.48         | 0.094                   | 0.86           |
      | 90%        | 0.47         | 0.089                   | 0.85           |
      | 80%        | 0.46         | 0.079                   | 0.84           |
      | 70%        | 0.45         | 0.069                   | 0.83           |
      
  • estimate_gas_cost(gas_limit: int, confidence: int = 99, chain_id: int = 1) -> str: Estimates transaction costs based on gas limit, confidence level, and chain ID. Returns costs in Gwei and ETH.

    • Example:
      Estimated Gas Cost (Confidence 90%, Chain ID 1):
      - Gas Limit: 21000
      - Max Fee Per Gas: 0.85 Gwei
      - Total Cost: 17850 Gwei (0.00001785 ETH)
      
  • get_supported_chains(ctx: Optional[Context] = None) -> str: Lists supported chains in a Markdown table with chain ID, system, and network.

    • Example:
      Supported Chains:
      
      | Chain ID   | System   | Network   |
      |------------|----------|-----------|
      | 1          | ethereum | main      |
      | 137        | polygon  | mainnet   |
      | 8453       | base     | mainnet   |
      | 11155111   | ethereum | sepolia   |
      

Prompts

  • gas_price_query(confidence: int, chain_id: int = 1) -> List[base.Message]: A prompt template for querying gas prices at a specific confidence level and chain ID.
    • Example:
      - User: What is the current gas price for chain ID 1 transactions with 90% confidence?
      - Assistant: Let me fetch the gas price predictions for chain ID 1.
      

License

This project is licensed under the MIT License. See the LICENSE file for details.

推荐服务器

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

官方
精选