BN

BNBChain MCP Server for BSC, opBNB, Greenfield

Deploy a high-performance MCP server for BNB Chain supporting BSC, opBNB, Greenfield and other EVM-compatible networks.

Quick Install
npx -y @bnb-chain/bnbchain-mcp

Overview

The BNBChain MCP Server implements the Model Context Protocol (MCP) with first-class support for BNB Chain ecosystems: BSC (Binance Smart Chain), opBNB, Greenfield, and other EVM-compatible networks. It provides a low-latency, scalable HTTP service that collects, indexes, and serves blockchain context (transactions, events, account state, and derived embeddings) so downstream machine learning models and developer tools can fetch relevant on‑chain context efficiently.

For developers building AI-powered dApps, agents, wallets, or analytics tools, an MCP server removes the heavy lifting of streaming and shaping on‑chain data into model-friendly contexts. Deploying this server near your application or model inference layer reduces latency, simplifies prompt construction, and enables consistent, reproducible context retrieval across multiple chains.

Features

  • High-performance HTTP API for storing and retrieving model context
  • Multi-chain support out of the box: BSC, opBNB, Greenfield, and other EVM-compatible networks
  • Pluggable chain connectors (RPC endpoints) and configurable chain list
  • Persistent storage for contexts (file, SQLite, or Postgres backends)
  • Metrics and health endpoints (Prometheus-compatible)
  • Docker and source build options for flexible deployment
  • Example configuration and CLI utilities to manage the server and chains

Installation / Configuration

Prerequisites:

  • Docker and Docker Compose (recommended) or Go toolchain (for building from source)
  • RPC endpoints for the chains you want to index (BSC/opBNB/Greenfield)

Clone the repo:

git clone https://github.com/bnb-chain/bnbchain-mcp.git
cd bnbchain-mcp

Run with Docker Compose (example)

# docker-compose.yml
version: "3.8"
services:
  mcp:
    image: bnbchain/bnbchain-mcp:latest
    ports:
      - "8080:8080"     # HTTP API
      - "9090:9090"     # Metrics
    environment:
      - MCP_DB_URL=postgres://mcp:mcp@db:5432/mcp?sslmode=disable
      - MCP_CONFIG=/etc/mcp/config.yaml
    volumes:
      - ./config.yaml:/etc/mcp/config.yaml:ro
  db:
    image: postgres:15
    environment:
      POSTGRES_USER: mcp
      POSTGRES_PASSWORD: mcp
      POSTGRES_DB: mcp
    volumes:
      - mcp_pgdata:/var/lib/postgresql/data

volumes:
  mcp_pgdata:

Example config.yaml

server:
  listen_addr: "0.0.0.0:8080"
  metrics_addr: "0.0.0.0:9090"

storage:
  driver: "postgres"
  url: "postgres://mcp:mcp@db:5432/mcp?sslmode=disable"

chains:
  - name: "bsc"
    chain_id: 56
    rpc: "https://bsc-dataseed.binance.org"
  - name: "opbnb"
    chain_id: <opbnb_chain_id>
    rpc: "https://rpc.opbnb.example"
  - name: "greenfield"
    chain_id: <greenfield_chain_id>
    rpc: "https://rpc.greenfield.example"

indexing:
  start_block: 0
  batch_size: 250

Build from source (Go)

# Requires Go 1.20+
make build         # or: go build ./cmd/mcp
./bin/mcp --config ./config.yaml

Configuration notes:

  • storage.driver: supports sqlite, file, and postgres backends (use postgres for production scale)
  • chains: list each EVM-compatible network with an RPC URL and chain_id
  • indexing.start_block and batch_size tune catch-up speed and resource use

Available Resources

  • GitHub repository: https://github.com/bnb-chain/bnbchain-mcp
  • Example configuration and docker-compose files included in the repo (/examples)
  • Built-in metrics (Prometheus) exposed at the configured metrics_addr
  • API specification: OpenAPI or README API section in the repo (check /docs or /openapi.yaml)
  • Health and readiness endpoints for orchestration (Kubernetes liveness/readiness)

Use Cases

  1. Contextual wallet assistants

    • Problem: A wallet UI needs recent transaction history, token balances, and contract interactions to build an accurate prompt for an on-device LLM.
    • How MCP helps: Index account activity and expose a single API to fetch sorted, summarized context for an address. The wallet queries MCP before invoking the model, reducing RPC calls and latency.
  2. AI-powered on-chain research

    • Problem: Analysts want to feed multi-chain transaction patterns into an LLM for summarization.
    • How MCP helps: Ingest events and transactions from BSC, opBNB, and Greenfield and return normalized context windows (