bnbchain-mcp

bnbchain-mcp

bnbchain-mcp

Category
访问服务器

Tools

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

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_nft

Transfer an NFT (ERC721 token) from one address to another. Requires the private key of the current owner for signing the transaction.

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.

transfer_erc20

Transfer ERC20 tokens to an address

get_address_from_private_key

Get the EVM address derived from a private key

get_nft_info

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

check_nft_ownership

Check if an address owns a specific NFT

get_erc1155_token_uri

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

get_nft_balance

Get the total number of NFTs owned by an address from a specific collection. This returns the count of NFTs, not individual token IDs.

get_erc1155_balance

Get the balance of a specific ERC1155 token ID owned by an address. ERC1155 allows multiple tokens of the same ID, so the balance can be greater than 1.

get_supported_networks

Get list of supported networks

resolve_ens

Resolve an ENS name to an EVM address (not supported on BSC)

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

get_transaction

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

get_transaction_receipt

Get a transaction receipt by its hash

estimate_gas

Estimate the gas cost for a transaction

transfer_native_token

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

README

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.

<a href="https://glama.ai/mcp/servers/@bnb-chain/bnbchain-mcp"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@bnb-chain/bnbchain-mcp/badge" alt="bnbchain-mcp MCP server" /> </a>

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
  • Additional features coming soon (Greenfield, Swap, Bridge, etc.)

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

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

SSE mode

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

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:
{
  "mcpServers": {
    "bnbchain-mcp": {
      "command": "npx",
      "args": ["-y", "@bnb-chain/mcp@latest"],
      "env": {
        "PRIVATE_KEY": "your_private_key_here"
      }
    }
  }
}
  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:
git clone https://github.com/bnb-chain/bnbchain-mcp.git
cd bnbchain-mcp
  1. Set up environment variables:
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:
# 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:

{
  "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:

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

Name Description
analyze_block Analyze a block and provide detailed information about its contents
analyze_transaction Analyze a specific transaction
analyze_address Analyze an EVM address
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

Tools

Name Description
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
get_transaction Get detailed information about a specific transaction by its hash
get_transaction_receipt Get a transaction receipt by its hash
estimate_gas Estimate the gas cost for a transaction
transfer_native_token Transfer native tokens (BNB, ETH, MATIC, etc.) to an address
approve_token_spending Approve another address to spend your ERC20 tokens
transfer_nft Transfer an NFT (ERC721 token) from one address to another
transfer_erc1155 Transfer ERC1155 tokens to another address
transfer_erc20 Transfer ERC20 tokens to an address
get_address_from_private_key Get the EVM address derived from a private key
get_chain_info Get chain information for a specific network
get_supported_networks Get list of supported networks
resolve_ens Resolve an ENS name to an EVM address
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_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
get_nft_info Get detailed information about a specific NFT
check_nft_ownership Check if an address owns a specific NFT
get_erc1155_token_uri Get the metadata URI for an ERC1155 token
get_nft_balance Get the total number of NFTs owned by an address from a specific collection
get_erc1155_balance Get the balance of a specific ERC1155 token ID owned by an address

Supported Networks

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

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选