Logo de BNBChain

BNBChain

Organização
bnb-chain

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

Publicado porbnb-chain
Repositóriobnbchain-mcp
IdiomaTypeScript
Forks
28
Estrelas
60
Ferramentas disponíveis
44
Tipo de transportestdio
Categorias
LicençaMIT
Links
  • Conecte ferramentas a fluxos de trabalho de IA

    BNBChain disponibiliza recursos MCP que podem ser usados por clientes e agentes de IA compatíveis.

  • 44 ferramentas disponíveis

    Confira abaixo as ações que podem ser chamadas, incluindo nomes e descrições quando fornecidos pelo servidor.

  • Configuração pronta para copiar

    Use os exemplos de instalação para configurar este servidor no seu cliente MCP preferido.

  • Indicadores da comunidade de código aberto

    60 estrelas e 28 forks no repositório vinculado.

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.

Instalação

TypingMind
Pré-requisitos:

Node.js 18+

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

Ferramentas disponíveis

  • 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

Use o MCP de BNBChain com vários modelos de IA

O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho. Assim, após conectar BNBChain, é possível usá-lo com diferentes modelos de IA no TypingMind, em vez de configurá-lo separadamente para cada modelo. Este MCP é executado localmente no seu dispositivo por meio do conector MCP do TypingMind.

Guia de configuração para usar o conector local

Use esta opção quando o servidor MCP precisar acessar arquivos locais, aplicativos ou recursos privados no seu computador.

1

Abra as configurações de MCP

No TypingMind, vá até Configurações, Configurações avançadas e depois Model Context Protocol e selecione Configurar conector.

  1. Abra o TypingMind no navegador.
  2. Clique no ícone de Ajustes.
  3. Acesse Configurações avançadas.
  4. Abra a seção Model Context Protocol.
  5. Clique em Configurar conector e selecione Este dispositivo.
Tela de configuração do conector MCP do TypingMind com a opção Este dispositivo selecionada
2

Execute o comando do conector

Selecione Este dispositivo, copie o comando do TypingMind e execute-o no Terminal. Mantenha o processo em execução enquanto usa o MCP.

  1. Copie o comando de configuração exibido pelo TypingMind.
  2. Abra o Terminal no macOS ou o Windows Terminal no Windows.
  3. Cole e execute o comando.
  4. Autorize a instalação do pacote se o Terminal pedir confirmação para continuar.
  5. Mantenha o processo em execução na janela do Terminal enquanto usa as ferramentas MCP.
3

Adicione BNBChain como servidor

Quando o status do conector for Pronto, clique em Editar e cole a configuração do servidor MCP.

  1. Aguarde até que o status do conector mostre Pronto.
  2. Clique em Editar.
  3. Cole a configuração do servidor MCP de BNBChain.
  4. Salve a lista de servidores.
  5. Atualize para confirmar se o conector ainda está pronto para uso.
Configurações de MCP do TypingMind mostrando um servidor ativo e o botão Editar
{
  "mcpServers": {
    "bnbchain": {
      "command": "npx",
      "args": [
        "-y",
        "@bnb-chain/mcp"
      ]
    }
  }
}
4

Use a conexão com diferentes modelos

Salve a lista de servidores, abra Plugins, ative as ferramentas MCP de BNBChain, selecione qualquer modelo de IA compatível no TypingMind e use as ferramentas no chat ou atribua-as a um agente de IA.

  1. Abra a página Plugins no TypingMind.
  2. Ative as ferramentas MCP de BNBChain.
  3. Inicie um chat e escolha o modelo de IA que deseja usar.
  4. Use as ferramentas MCP no chat ou atribua-as a um agente de IA.
  5. Mude para outro modelo de IA sempre que necessário, sem reconectar o MCP.
Chat do TypingMind usando ferramentas MCP ativadas com um modelo de IA selecionado
Pode usar BNBChain para me ajudar nesta tarefa?
BNBChain
Claro. Já li.
Veja o que encontrei usando BNBChain.

Perguntas frequentes

Para que serve o servidor MCP BNBChain?

BNBChain é um servidor MCP que permite que aplicativos de IA compatíveis se conectem a ferramentas externas e informações de contexto. No TypingMind, basta adicionar esse servidor MCP uma vez para disponibilizar suas ferramentas no seu espaço de trabalho com IA.

Posso usar o MCP BNBChain com vários modelos de IA no TypingMind?

Sim. O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho, permitindo usar BNBChain com diferentes modelos de IA, como Claude, ChatGPT, Gemini ou outros modelos configurados no TypingMind, sem configurar o servidor MCP separadamente para cada modelo.

Por que usar o MCP BNBChain com o TypingMind?

O TypingMind é uma das melhores interfaces de chat com LLMs porque reúne vários modelos de IA, prompts, plugins, agentes de IA, chaves de API e ferramentas MCP em um só espaço de trabalho. Com BNBChain conectado, é possível usar suas ferramentas MCP nos seus modelos preferidos e manter seu fluxo de trabalho de chat organizado no TypingMind.

Como conecto o MCP BNBChain ao TypingMind?

BNBChain funciona por meio do conector MCP local do TypingMind. Essa é a melhor opção quando o servidor MCP precisa acessar arquivos locais, apps de desktop, ferramentas de linha de comando ou recursos privados no seu computador.

Quais ferramentas o MCP BNBChain oferece no TypingMind?

BNBChain disponibiliza 44 ferramentas MCP que podem ser ativadas na página Plugins do TypingMind e usadas no chat ou atribuídas a agentes de IA.

Preciso compartilhar minhas chaves de API com o TypingMind para usar o MCP BNBChain?

Não. O TypingMind prioriza o uso local e permite manter seus provedores de modelos, chaves de API, prompts e configuração MCP sob seu controle. Se BNBChain exigir autenticação, adicione os cabeçalhos, as configurações OAuth ou a configuração local exigidos por esse servidor MCP ao criar a conexão.

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

Servidores MCP relacionados

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇