BO

Bankless Onchain

Created 6 months ago

MCP server for blockchain data interaction through the Bankless API.

development blockchain API MCP data interaction

What is Bankless Onchain?

Query Onchain data, like ERC20 tokens, transaction history, smart contract state.

Documentation

Bankless Onchain MCP Server

Overview

The Bankless Onchain MCP Server provides a framework for interacting with on-chain data via the Bankless API. It implements the Model Context Protocol (MCP) to allow AI models to access blockchain state and event data in a structured way.

Features

The server provides the following onchain data operations:

Contract Operations

  • Read Contract State (read_contract): Read state from smart contracts on various blockchain networks.
  • Get Proxy (get_proxy): Retrieve proxy implementation contract addresses.
  • Get ABI (get_abi): Fetch the ABI (Application Binary Interface) for a contract.
  • Get Source (get_source): Retrieve the source code for a verified contract.

Event Operations

  • Get Events (get_events): Fetch event logs for a contract based on topics.
  • Build Event Topic (build_event_topic): Generate an event topic signature from event name and argument types.

Transaction Operations

  • Get Transaction History (get_transaction_history): Retrieve transaction history for a user address.
  • Get Transaction Info (get_transaction_info): Get detailed information about a specific transaction.

Installation

npm install @bankless/onchain-mcp

Usage# Environment Setup

Before using the server, set your Bankless API token. For details on how to obtain your Bankless API token, head to https://docs.bankless.com/bankless-api/other-services/onchain-mcp

export BANKLESS_API_TOKEN=your_api_token_here

Running the Server

The server can be run directly from the command line:

npx @bankless/onchain-mcp

Usage with LLM Tools

This server implements the Model Context Protocol (MCP), which allows it to be used as a tool provider for compatible AI models.

Development# Building from Source

 git clone https://github.com/Bankless/onchain-mcp.git
 cd onchain-mcp
 # Install dependencies
 npm install
 # Build the project
 npm run build

Debug Mode

npm run debug

Integration with AI Models

To integrate this server with AI applications that support MCP, add the following to your app's server configuration:

{
  "mcpServers": {
    "bankless": {
      "command": "npx",
      "args": [
        "@bankless/onchain-mcp"
      ],
      "env": {
        "BANKLESS_API_TOKEN": "your_api_token_here"
      }
    }
  }
}

Error Handling

The server provides specific error types for different scenarios:

  • BanklessValidationError: Invalid input parameters
  • BanklessAuthenticationError: API token issues
  • BanklessResourceNotFoundError: Requested resource not found
  • BanklessRateLimitError: API rate limit exceeded

License

MIT

Server Config

{
  "mcpServers": {
    "bankless-onchain-server": {
      "command": "npx",
      "args": [
        "bankless-onchain"
      ]
    }
  }
}

Links & Status

Repository: github.com
Hosted: No
Global: No
Official: Yes

Project Info

Hosted Featured
Created At: May 23, 2025
Updated At: Aug 07, 2025
Author: Bankless
Category: official
License: MIT
Tags:
development blockchain API