Skip to main content
Glama
kukapay

blocknative-mcp

by kukapay

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.

Related MCP server: chainlink-feeds-mcp

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.

Available Tools

3 tools
estimate_gas_costB
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.
ParametersJSON Schema
NameRequiredDescriptionDefault
gas_limitYes
confidenceNo
chain_idNo
ctxNo

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool estimates gas cost but doesn't explain how the estimation works (e.g., based on historical data, network conditions), whether it's a read-only operation, potential rate limits, or error conditions. For a tool with financial implications, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and concise: a clear purpose statement followed by a bulleted list of parameters with explanations. Every sentence adds value, and there's no redundant information. It could be slightly more front-loaded with usage context, but it's efficient overall.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (financial estimation tool), lack of annotations, and no output schema, the description is moderately complete. It covers parameters well but misses behavioral details like estimation methodology, error handling, or return format. For a tool that could impact transaction costs, more context on reliability and limitations would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context beyond the schema, which has 0% description coverage. It explains each parameter's purpose with examples (e.g., '21000 for a simple transfer', '0-100' for confidence, '1 for Ethereum Mainnet'), clarifying their roles in gas cost estimation. This compensates well for the schema's lack of descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Estimate gas cost for a transaction based on gas limit, confidence level, and chain.' It specifies the verb ('estimate'), resource ('gas cost'), and key inputs. However, it doesn't explicitly differentiate from sibling tools like 'predict_gas_price', which might be related but serves a different purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_supported_chains' or 'predict_gas_price', nor does it specify prerequisites, scenarios, or exclusions for usage. The agent must infer context from tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_supported_chainsA
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.
ParametersJSON Schema
NameRequiredDescriptionDefault
ctxNo

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly describes the output format (Markdown table) and the data included (chain ID, system, network), which is helpful. However, it doesn't mention whether this is a read-only operation, if there are rate limits, authentication requirements, or potential side effects, which are important for a tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with three sentences that each serve a distinct purpose: stating the tool's purpose, documenting parameters, and specifying the return format. It's front-loaded with the core functionality and avoids unnecessary verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read-only listing tool with one optional parameter and no output schema, the description provides adequate context. It explains what the tool does, documents the parameter, and specifies the return format. While it could benefit from more behavioral details (given no annotations), it covers the essential information needed to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description explicitly documents the single parameter 'ctx' as optional with a default value, and provides a clear explanation of its purpose as the MCP context object. With 0% schema description coverage, the description fully compensates by adding meaningful semantics beyond what the bare schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('List'), resource ('blockchain networks supported by the Blocknative Gas Platform'), and output format ('formatted as a Markdown table'). It distinguishes itself from sibling tools like 'estimate_gas_cost' and 'predict_gas_price' by focusing on listing supported chains rather than gas-related operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, dependencies, or scenarios where this tool is preferred over others, leaving the agent to infer usage from the purpose alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

predict_gas_priceC
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.
ParametersJSON Schema
NameRequiredDescriptionDefault
chain_idNo
ctxNo

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the output format ('Markdown table') but doesn't describe what the prediction entails (e.g., time horizon, confidence intervals, data sources), whether it's cached or real-time, potential rate limits, or error conditions. For a prediction tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose in the first sentence. The parameter section is clear but could be more integrated. There's minimal waste, though the 'ctx' explanation in the schema (not the description) suggests some context could be condensed if included in the description itself.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a prediction tool with no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It lacks details on prediction methodology, output structure beyond 'Markdown table', error handling, and differentiation from siblings. This makes it inadequate for reliable agent use without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides basic semantics for 'chain_id' (ID of blockchain network with an example) and notes 'ctx' is optional with a default, but doesn't explain what 'Context' does or why it might be needed. The description adds some value but doesn't fully compensate for the schema coverage gap, especially for the 'ctx' parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Predict gas prices for a specified chain, including base fee and detailed prediction data in a Markdown table.' This specifies the verb ('predict'), resource ('gas prices'), and output format ('Markdown table'). However, it doesn't explicitly differentiate from sibling tools like 'estimate_gas_cost' or 'get_supported_chains', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its siblings ('estimate_gas_cost' and 'get_supported_chains'). It mentions the chain_id parameter but doesn't explain when prediction is appropriate versus estimation or chain listing. There's no mention of prerequisites, limitations, or alternative scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.5/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: estimate_gas_cost calculates transaction costs, get_supported_chains lists available networks, and predict_gas_price forecasts prices. The descriptions clearly differentiate these gas platform functionalities, making tool selection unambiguous for an agent.

Naming Consistency5/5

All three tools follow a consistent verb_noun naming pattern (estimate_gas_cost, get_supported_chains, predict_gas_price) with clear action-object relationships. The naming is uniform throughout, using snake_case consistently without any deviations or mixed conventions.

Tool Count3/5

With only 3 tools, the server feels somewhat thin for a gas platform domain that could benefit from additional operations like historical gas price analysis, transaction simulation, or multi-chain batch operations. While the core functions are covered, the limited tool count may restrict agent capabilities in more complex scenarios.

Completeness4/5

The toolset covers the essential gas platform operations well: cost estimation, chain discovery, and price prediction. However, there are minor gaps such as the inability to simulate transactions with actual data, compare gas prices across multiple chains simultaneously, or access historical gas price trends, which could limit some advanced workflows.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kukapay/blocknative-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server