Read contract state from a blockchain network
Gets the proxy implementation address for a given network and contract
Fetches event logs for a given network and filter criteria
Builds an event topic signature based on event name and arguments
Fetch the ABI (Application Binary Interface) for a contract
Retrieve the source code for a verified contract
Retrieve transaction history for a user address
Get detailed information about a specific transaction
Bankless Onchain provides a powerful interface for AI models to access and interact with blockchain data across multiple networks. Through the Bankless API, it enables reading contract states, retrieving event logs, accessing transaction history, and more - all in a structured format that's easy for AI models to process. This MCP server bridges the gap between AI and blockchain technology, allowing models to query real-time on-chain data without requiring deep blockchain expertise. Whether you need to check token balances, monitor smart contract events, or analyze transaction history, Bankless Onchain provides the tools to access this data efficiently.
Bankless Onchain MCP Server provides a framework for AI models to interact with blockchain data through the Bankless API. It implements the Model Context Protocol (MCP) to enable structured access to blockchain state and event data across various networks including Ethereum, Polygon, Base, and others.
To use the Bankless Onchain MCP Server, you'll need to install the package and obtain a Bankless API token.
npm install @bankless/onchain-mcp
Obtain a Bankless API token by visiting https://docs.bankless.com/bankless-api/other-services/onchain-mcp
Set your API token as an environment variable:
export BANKLESS_API_TOKEN=your_api_token_here
To integrate this MCP server with AI applications that support MCP, add the following configuration to your app's server settings:
{
"mcpServers": {
"bankless": {
"command": "npx",
"args": [
"@bankless/onchain-mcp"
],
"env": {
"BANKLESS_API_TOKEN": "your_api_token_here"
}
}
}
}
The Bankless Onchain MCP Server provides several tools for interacting with blockchain data:
read_contract
to read state from smart contractsget_proxy
to retrieve proxy implementation contract addressesget_abi
to fetch the ABI for a contractget_source
to retrieve the source code for a verified contractget_events
to fetch event logs for a contract based on topicsbuild_event_topic
to generate an event topic signatureget_transaction_history
to retrieve transaction history for a user addressget_transaction_info
to get detailed information about a specific transactionThe server provides specific error types for different scenarios:
BanklessValidationError
: Invalid input parametersBanklessAuthenticationError
: API token issuesBanklessResourceNotFoundError
: Requested resource not foundBanklessRateLimitError
: API rate limit exceededWhen working with AI models, you can guide them to use the Bankless Onchain MCP Server effectively by providing context about blockchain operations. For example:
get_proxy
By providing clear instructions, you can help AI models leverage the full capabilities of the Bankless Onchain MCP Server for blockchain data analysis.