Blocknative MCP Server is an MCP (Model Context Protocol) server used to provide real-time Gas price predictions for multiple blockchains, powered by Blocknative's Gas Price and Chains API.
Purpose: To provide a tool-based interface for scenarios that need to query or estimate blockchain transaction Gas costs, supporting invocation by AI assistants or development tools through the MCP framework.
Main capabilities:
- predict_gas_price: Get the Gas price prediction for a specified chain (default Ethereum mainnet, chain_id=1), returning the Base Fee Per Gas and a Markdown table containing confidence, price, max priority fee, and max fee.
- estimate_gas_cost: Estimate transaction cost based on gas limit, confidence (default 99), and chain ID (default 1), returned in Gwei and ETH.
- get_supported_chains: List supported blockchains in a Markdown table, including chain ID, system, and network.
- gas_price_query: A prompt template for querying Gas prices by specified confidence and chain ID.
Technical features: Uses httpx for asynchronous non-blocking HTTP requests; supports an optional API Key—low-frequency access does not require a Blocknative API Key, while high-frequency use requires setting the BLOCKNATIVE_API_KEY environment variable.
Usage: Environment requirements: Python 3.10; uv for dependency management and running the project. Installation steps:
- Clone the repository: git clone https://github.com/kukapay/blocknative-mcp.git Then cd blocknative-mcp
- Set up the project with uv: uv sync
- Set the Blocknative API Key (optional): high-frequency access requires setting the environment variable export BLOCKNATIVE_API_KEY="your-api-key-here"; low-frequency access can skip this step.
Run the server:
- Development mode (MCP Inspector): uv run mcp dev blocknative-mcp, open the MCP Inspector web interface to interactively test tools and prompts.
- Direct execution: uv run blocknative-mcp
- Integrate with Claude Desktop: uv run mcp install blocknative-mcp --name "Blocknative MCP Server"
Tool examples: predict_gas_price(chain_id: int = 1) -> str: Returns the base fee and confidence table, for example, in the prediction for chain ID 1, at 99% confidence the price is 0.52 Gwei, max priority fee 0.14 Gwei, max fee 0.9 Gwei. estimate_gas_cost(gas_limit: int, confidence: int = 99, chain_id: int = 1) -> str: For example, with gas limit 21000, confidence 90%, and chain ID 1, the max fee per Gas is 0.85 Gwei, and the total cost is 17850 Gwei (0.00001785 ETH). get_supported_chains(ctx: Optional[Context] = None) -> str: For example, list chain ID 1 (ethereum/main), 137 (polygon/mainnet), 8453 (base/mainnet), 11155111 (ethereum/sepolia). gas_price_query(confidence: int, chain_id: int = 1) -> List[base.Message]: Prompt template, for example, when a user asks "What is the current Gas price for a transaction on chain ID 1 at 90% confidence?"
Applicable scenarios: Blockchain development, transaction assistance, AI assistant integration, and other scenarios that require real-time Gas price prediction or transaction cost estimation.
Limitations: The project uses the MIT license; high-frequency API access requires a Blocknative API Key; the specific list of supported chains is subject to what get_supported_chains returns.