Purpose
Bankless Onchain MCP Server is an MCP (Model Context Protocol) server used to interact with blockchain onchain data through the Bankless API. It provides AI models with a structured framework for accessing blockchain state and event data, enabling MCP-compatible AI models to use this server as a tool provider.
Main Capabilities
The server provides the following onchain data operations:
Contract Operations
- read_contract: Read the state of smart contracts on various blockchain networks. Parameters include network, contract address, method, inputs, outputs; returns the contract call result with typed values.
- get_proxy: Get the proxy implementation contract address. Parameters include network, contract address; returns the implementation contract address.
- get_abi: Get the contract's ABI (Application Binary Interface). Parameters include network, contract address; returns the contract ABI in JSON format.
- get_source: Get the source code of a verified contract. Parameters include network, contract address; returns the source code, ABI, compiler version, and other contract metadata.
Event Operations
- get_events: Get contract event logs based on topics. Parameters include network, addresses, topic, optional topics; returns filtered event logs.
- build_event_topic: Generate an event topic signature based on the event name and argument types. Parameters include network, event name, argument types; returns the event topic hash.
Transaction Operations
- get_transaction_history: Get the transaction history of a user address. Parameters include network, user address, optional contract, optional method ID, optional start block, include data flag; returns a transaction list containing hash, data, networkand timestamp.
- get_transaction_info: Get detailed information about a specific transaction. Parameters include network, transaction hash; returns transaction details, including block number, timestamp, from/to addresses, value, gas information, status, and receipt data.
Usage
Environment Setup
Before using the server, you need to set the Bankless API token. For detailed information on obtaining a Bankless API token, refer to https://docs.bankless.com/bankless-api/other-services/onchain-mcp。
Running the Server
The server can be run directly from the command line.
Using with LLM Tools
This server implements the Model Context Protocol (MCP) and can serve as a tool provider for compatible AI models.
Building from Source
Building from source is supported.
Integrating with AI Models
To integrate this server with an AI application that supports MCP, add the corresponding configuration to the application's server configuration.
Error Types
The server provides specific error types for different scenarios:
- BanklessValidationError: Invalid input parameters
- BanklessAuthenticationError: API token issue
- BanklessResourceNotFoundError: Requested resource not found
- BanklessRateLimitError: API rate limit exceeded
Guiding LLMs in Usage
To guide LLM models in using Bankless Onchain MCP Server, the corresponding prompts can be used.
Applicable Scenarios
Suitable for scenarios that require AI models to access blockchain onchain data in a structured way, such as reading smart contract state, querying event logs, obtaining transaction history and transaction details, and obtaining contract ABI and source code.
Limitations
This project no longer receives updates. The Bankless API token must be set before use.