Logo BNBChain

BNBChain

Tổ chức
bnb-chain

A MCP server for BNB Chain that supports BSC, opBNB, Greenfield, and other popular EVM-compatible networks.

Nhà phát hànhbnb-chain
Kho mãbnbchain-mcp
Ngôn ngữTypeScript
Bản fork
28
Sao
60
Công cụ có sẵn
44
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    BNBChain cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 44 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    60 sao và 28 bản fork từ kho mã được liên kết.

BNBChain MCP (Model Context Protocol)

A powerful toolkit for interacting with BNB Chain and other EVM-compatible networks through natural language processing and AI assistance.

Description

BNBChain MCP is a Model Context Protocol implementation that enables seamless interaction with blockchain networks through AI-powered interfaces. It provides a comprehensive set of tools and resources for blockchain development, smart contract interaction, and network management.

Core Modules

The project is organized into several core modules:

  • Blocks: Query and manage blockchain blocks
  • Contracts: Interact with smart contracts
  • Network: Network information and management
  • NFT: NFT (ERC721/ERC1155) operations
  • Tokens: Token (ERC20) operations
  • Transactions: Transaction management
  • Wallet: Wallet operations and management
  • Common: Shared utilities and types
  • Greenfield: Support file management operations on Greenfield network including, uploading, downloading, and managing files and buckets
  • Additional features coming soon (Greenfield, Swap, Bridge, etc.)
  • Agents (ERC-8004): Register and resolve on-chain AI agent identities (ERC-8004 Trustless Agents) on BSC and BSC Testnet

Important Notes

We do not recommend deploying this MCP Server on the public internet. (1) The SSE endpoint has no authentication—anyone who can reach it can use the server. (2) There is no centralized service that custodies private keys or funds; keys and signing are the responsibility of the client. If you still need to deploy it publicly, add an authentication layer in front (e.g. API keys, JWT, or a reverse proxy with auth), or deploy a keyless version that only exposes read-only or non-sensitive tools.

Credentials: Prefer setting PRIVATE_KEY in the MCP server environment. Do not pass the private key in tool parameters when avoidable, as it may be stored in conversation history, client logs, or request logs and lead to exposure.

Transfer and payment confirmation

Transfer and payment tools (e.g. transfer_native_token, transfer_erc20, approve_token_spending, transfer_nft, transfer_erc1155, gnfd_deposit_to_payment, gnfd_withdraw_from_payment, gnfd_create_payment_account) use a preview-then-confirm flow by default so that no funds move until the user explicitly confirms.

  • Default behavior: Calling a transfer or payment tool returns a preview (recipient, amount, network, etc.) and a short-lived confirmToken. No transaction is sent. To execute, call the confirm_transfer tool with that confirmToken and your privateKey. The token expires after 5 minutes.
  • Skipping confirmation (per call): Pass skipConfirmation: true in the tool arguments when the caller has already confirmed or when running in an automated script. The tool will then execute immediately and return the transaction result.
  • Skipping confirmation (server-wide): Set the environment variable BNBCHAIN_MCP_SKIP_TRANSFER_CONFIRMATION=true so that all transfer/payment tools execute immediately without returning a preview. Use this for headless or scripted environments where you do not need a confirmation step.

Example flow with confirmation:

  1. Call transfer_native_token with toAddress, amount, network (and optionally privateKey). Do not set skipConfirmation.
  2. The server returns { preview: { toAddress, amount, network }, confirmToken: "...", message: "..." }.
  3. Review the preview, then call confirm_transfer with confirmToken and privateKey to execute the transfer.

Integration with Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the top right)
  2. Click on "MCP" in the left sidebar
  3. Click "Add new global MCP server"
  4. Enter the following details:

Default mode

json
{
  "mcpServers": {
    "bnbchain-mcp": {
      "command": "npx",
      "args": ["-y", "@bnb-chain/mcp@latest"],
      "env": {
        "PRIVATE_KEY": "your_private_key_here. (optional)",
        "BNBCHAIN_MCP_SKIP_TRANSFER_CONFIRMATION": "false"
      }
    }
  }
}
  • PRIVATE_KEY: Optional. Prefer setting here instead of passing in tool parameters.
  • BNBCHAIN_MCP_SKIP_TRANSFER_CONFIRMATION: Optional. Set to "true" to make all transfer/payment tools execute immediately (no preview step). Default "false" uses the preview-then-confirm flow.

SSE mode

json
{
  "mcpServers": {
    "bnbchain-mcp": {
      "command": "npx",
      "args": ["-y", "@bnb-chain/mcp@latest", "--sse"],
      "env": {
        "PRIVATE_KEY": "your_private_key_here. (optional)",
        "BNBCHAIN_MCP_SKIP_TRANSFER_CONFIRMATION": "false"
      }
    }
  }
}

Integration with Claude Desktop

To connect to the MCP server from Claude Desktop:

  1. Open Claude Desktop and go to Settings
  2. Click on "Developer" in the left sidebar
  3. Click the "Edit Config" Button
  4. Add the following configuration to the claude_desktop_config.json file:
json
{
  "mcpServers": {
    "bnbchain-mcp": {
      "command": "npx",
      "args": ["-y", "@bnb-chain/mcp@latest"],
      "env": {
        "PRIVATE_KEY": "your_private_key_here",
        "BNBCHAIN_MCP_SKIP_TRANSFER_CONFIRMATION": "false"
      }
    }
  }
}

Optional env: BNBCHAIN_MCP_SKIP_TRANSFER_CONFIRMATION=true to execute transfers immediately without preview/confirm.

  1. Save the file and restart Claude Desktop

Once connected, you can use all the MCP prompts and tools directly in your Claude Desktop conversations. For example:

  • "Analyze this address: 0x123..."
  • "Explain the EVM concept of gas"
  • "Check the latest block on BSC"

Integration with Other Clients

If you want to integrate BNBChain MCP into your own client, please check out the examples directory for more detailed information and reference implementations.

The examples demonstrate:

  • How to set up the MCP client
  • Authentication and configuration
  • Making API calls to interact with blockchain networks
  • Handling responses and errors
  • Best practices for integration

Local Development

Prerequisites

Quick Start

  1. Clone the repository:
bash
git clone https://github.com/bnb-chain/bnbchain-mcp.git
cd bnbchain-mcp
  1. Set up environment variables:
bash
cp .env.example .env

Edit .env file with your configuration:

  • PRIVATE_KEY: Your wallet private key (required for transaction operations)
  • LOG_LEVEL: Set logging level (DEBUG, INFO, WARN, ERROR)
  • PORT: Server port number (default: 3001)
  1. Install dependencies and start development server:
bash
# Install project dependencies
bun install

# Start the development server
bun dev:sse

Testing with MCP Clients

Configure the local server in your MCP clients using this template:

json
{
  "mcpServers": {
    "bnbchain-mcp": {
      "url": "http://localhost:3001/sse",
      "env": {
        "PRIVATE_KEY": "your_private_key_here"
      }
    }
  }
}

Testing with Web UI

We use @modelcontextprotocol/inspector for testing. Launch the test UI:

bash
bun run test

Available Scripts

  • bun dev:sse: Start development server with hot reload
  • bun build: Build the project
  • bun test: Run test suite

Available Prompts and Tools

Prompts

NameDescription
analyze_blockAnalyze a block and provide detailed information about its contents
analyze_transactionAnalyze a specific transaction
analyze_addressAnalyze an EVM address
interact_with_contractGet guidance on interacting with a smart contract
explain_evm_conceptGet an explanation of an EVM concept
compare_networksCompare different EVM-compatible networks
analyze_tokenAnalyze an ERC20 or NFT token
how_to_register_mcp_as_erc8004_agentGet guidance on registering an MCP server as an ERC-8004 agent

Tools

NameDescription
get_block_by_hashGet a block by hash
get_block_by_numberGet a block by number
get_latest_blockGet the latest block
get_transactionGet detailed information about a specific transaction by its hash
get_transaction_receiptGet a transaction receipt by its hash
estimate_gasEstimate the gas cost for a transaction
transfer_native_tokenTransfer native tokens (BNB, ETH, MATIC, etc.) to an address
approve_token_spendingApprove another address to spend your ERC20 tokens
transfer_nftTransfer an NFT (ERC721 token) from one address to another
transfer_erc1155Transfer ERC1155 tokens to another address
transfer_erc20Transfer ERC20 tokens to an address
get_address_from_private_keyGet the EVM address derived from a private key
get_chain_infoGet chain information for a specific network
get_supported_networksGet list of supported networks
resolve_ensResolve an ENS name to an EVM address
is_contractCheck if an address is a smart contract or an externally owned account (EOA)
read_contractRead data from a smart contract by calling a view/pure function
write_contractWrite data to a smart contract by calling a state-changing function
get_erc20_token_infoGet ERC20 token information
get_native_balanceGet native token balance for an address
get_erc20_balanceGet ERC20 token balance for an address
get_nft_infoGet detailed information about a specific NFT
check_nft_ownershipCheck if an address owns a specific NFT
get_erc1155_token_metadataGet the metadata for an ERC1155 token
get_nft_balanceGet the total number of NFTs owned by an address from a specific collection
get_erc1155_balanceGet the balance of a specific ERC1155 token ID owned by an address

ERC-8004 Agent tools

Register and resolve AI agents on the ERC-8004 Identity Registry (Trustless Agents). Supported networks: BSC (56), BSC Testnet (97), Ethereum, Base, Polygon, and their testnets where the official registry is deployed. The agentURI should point to a JSON metadata file following the Agent Metadata Profile (name, description, image, and services such as MCP endpoint).

NameDescription
register_erc8004_agentRegister an agent on the ERC-8004 Identity Registry; returns agent ID
set_erc8004_agent_uriUpdate the metadata URI for an existing ERC-8004 agent (owner only)
get_erc8004_agentGet agent info (owner and tokenURI) from the Identity Registry
get_erc8004_agent_walletGet the verified payment wallet for an agent (for x402 / payments)

Greenfield tools

NameDescription
gnfd_get_bucket_infoGet detailed information about a specific bucket
gnfd_list_bucketsList all buckets owned by an address
gnfd_create_bucketCreate a new bucket
gnfd_delete_bucketDelete a bucket
gnfd_get_object_infoGet detailed information about a specific object
gnfd_list_objectsList all objects in a bucket
gnfd_upload_objectUpload an object to a bucket
gnfd_download_objectDownload an object from a bucket
gnfd_delete_objectDelete an object from a bucket
gnfd_create_folderCreate a folder in a bucket
gnfd_get_account_balanceGet the balance for an account
gnfd_deposit_to_paymentDeposit funds into a payment account
gnfd_withdraw_from_paymentWithdraw funds from a payment account
gnfd_disable_refundDisable refund for a payment account (IRREVERSIBLE)
gnfd_get_payment_accountsList all payment accounts owned by an address
gnfd_get_payment_account_infoGet detailed information about a payment account
gnfd_create_paymentCreate a new payment account
gnfd_get_payment_balanceGet payment account balance

Supported Networks

Supports BSC, opBNB, Greenfield, Ethereum, and other major EVM-compatible networks. For more details, see src/evm/chains.ts.

ERC-8004 agent registration is available on chains where the official registry is deployed: BSC (56), BSC Testnet (97), Ethereum (1), Sepolia (11155111), Base (8453), Base Sepolia (84532), Polygon (137), Polygon Amoy (80002), Arbitrum (42161), Arbitrum Sepolia (421614). Private key is used only to sign the registration or update transaction and is not stored or logged.

Contributing

We welcome contributions to BNBChain MCP! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to your branch
  5. Create a Pull Request

Please ensure your code follows our coding standards and includes appropriate tests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

References and Acknowledgments

This project is built upon and inspired by the following open-source projects:

We extend our gratitude to the original authors for their contributions to the blockchain ecosystem.

Cài đặt

TypingMind
Yêu cầu:

Node.js 18+

{
  "mcpServers": {
    "bnbchain-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@bnb-chain/mcp@latest"
      ],
      "env": {
        "PRIVATE_KEY": "your_private_key_here"
      }
    }
  }
}

Công cụ có sẵn

  • register_erc8004_agent

    Register an agent on the ERC-8004 Identity Registry. Mints an on-chain agent identity (NFT) and returns the agent ID. Use BSC or BSC Testnet; the agentURI should point to a JSON metadata file (AgentURI format) with name, description, image, and services (e.g. MCP endpoint).

  • set_erc8004_agent_uri

    Update the metadata URI for an existing ERC-8004 agent. Caller must be the owner of the agent NFT.

  • get_erc8004_agent

    Get agent info from the ERC-8004 Identity Registry: owner address and tokenURI (metadata URI).

  • get_erc8004_agent_wallet

    Get the verified payment wallet address for an ERC-8004 agent (for x402 / agent payments). Set on-chain via setAgentWallet; defaults to owner on registration.

  • get_block_by_hash

    Get a block by hash

  • get_block_by_number

    Get a block by number

  • get_latest_block

    Get the latest block

  • is_contract

    Check if an address is a smart contract or an externally owned account (EOA)

  • read_contract

    Read data from a smart contract by calling a view/pure function

  • write_contract

    Write data to a smart contract by calling a state-changing function

  • get_chain_info

    Get chain information for a specific network

  • get_supported_networks

    Get list of supported networks

  • get_erc20_token_info

    Get ERC20 token information

  • get_native_balance

    Get native token balance for an address

  • get_erc20_balance

    Get ERC20 token balance for an address

  • create_erc20_token

    Create a new ERC20 token

  • get_transaction

    Get detailed information about a specific transaction by its hash. Includes sender, recipient, value, data, and more.

  • estimate_gas

    Estimate the gas cost for a transaction

  • get_address_from_private_key

    Get the EVM address derived from a private key

  • transfer_native_token

    Transfer native tokens (BNB, ETH, MATIC, etc.) to an address

  • approve_token_spending

    Approve another address (like a DeFi protocol or exchange) to spend your ERC20 tokens. This is often required before interacting with DeFi protocols.

  • transfer_erc20

    Transfer ERC20 tokens to an address

  • get_nft_info

    Get detailed information about a specific NFT (ERC721 token), including collection name, symbol, token URI, and current owner if available.

  • get_erc1155_token_metadata

    Get the metadata for an ERC1155 token (multi-token standard used for both fungible and non-fungible tokens). The metadata typically points to JSON metadata about the token.

  • transfer_nft

    Transfer an NFT to an address

  • transfer_erc1155

    Transfer ERC1155 tokens to another address. ERC1155 is a multi-token standard that can represent both fungible and non-fungible tokens in a single contract.

  • gnfd_get_account_balance

    Get the balance for an account

  • gnfd_get_all_sps

    Get a list of all storage providers in the Greenfield network

  • gnfd_create_bucket

    Create a new bucket in Greenfield storage

  • gnfd_create_file

    Upload a file to a Greenfield bucket

  • gnfd_create_folder

    Create a folder in a Greenfield bucket

  • gnfd_list_buckets

    List all buckets owned by the account

  • gnfd_list_objects

    List all objects in a bucket

  • gnfd_delete_object

    Delete an object from a bucket

  • gnfd_delete_bucket

    Delete a bucket

  • gnfd_get_bucket_info

    Get detailed information about a bucket

  • gnfd_get_bucket_full_info

    Get bucket basic information and quota usage

  • gnfd_get_object_info

    Get detailed information about an object in a bucket

  • gnfd_download_object

    Download an object from a bucket

  • gnfd_get_payment_accounts

    Get the payment accounts for a given address

  • gnfd_create_payment_account

    Create a new payment account

  • gnfd_deposit_to_payment

    Deposit funds into a payment account

  • gnfd_withdraw_from_payment

    Withdraw funds from a payment account

  • gnfd_get_payment_account_info

    Get the info for a payment account

Dùng MCP BNBChain với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối BNBChain, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm BNBChain làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của BNBChain.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "bnbchain": {
      "command": "npx",
      "args": [
        "-y",
        "@bnb-chain/mcp"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của BNBChain, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của BNBChain.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng BNBChain giúp tôi làm việc này không?
BNBChain
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng BNBChain.

Câu hỏi thường gặp

Máy chủ MCP BNBChain dùng để làm gì?

BNBChain là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP BNBChain với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng BNBChain với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP BNBChain với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối BNBChain, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP BNBChain với TypingMind?

BNBChain hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP BNBChain cung cấp những công cụ nào trong TypingMind?

BNBChain cung cấp 44 công cụ MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP BNBChain không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu BNBChain yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

how_to_register_mcp_as_erc8004_agent

Get step-by-step guidance on registering an MCP server as an ERC-8004 agent (on-chain identity, AgentURI metadata, and MCP endpoint in services).

analyze_block

Analyze a block and provide detailed information about its contents

interact_with_contract

Get guidance on interacting with a smart contract

explain_evm_concept

Get an explanation of an EVM concept

compare_networks

Compare different EVM-compatible networks

analyze_token

Analyze an ERC20 or NFT token

analyze_transaction

Analyze a specific transaction

analyze_address

Analyze an EVM address

analyze_overdue_buckets

Analyze buckets with overdue payments or low balance

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇