MCP Now
Bsc-mcp

Bsc-mcp

by TermiX-official
GitHub

The first MCP server that serves as the bridge between AI and BNB Chain, enabling AI agents to execute complex on-chain operations through seamless integration with the BNB Chain, including transfer, swap, launch, security check on any token and even more.

token
transfer
bnb
transaction
json

https://github.com/user-attachments/assets/b3ed768a-6fd9-4b09-bcdd-dd122965f46e

BNB Chain MCP Server

Overview

BNB Chain MCP Server is a backend service designed to execute transactions on the Binance Smart Chain (BSC). It facilitates seamless interaction with the blockchain, including sending native BNB and BEP-20 token transfers. The server utilizes the Model Context Protocol (MCP) framework to ensure secure, structured, and efficient transactions.

Key Functionalities:

  • Retrieve and manage wallet addresses
  • Fetch and list wallet balances
  • Execute native BNB transfers
  • Transfer BEP-20 tokens using contract addresses or symbols
  • Call and interact with smart contract functions
  • Securely manage BEP-20 tokens
  • create bsc memecoin
  • create bep20 token

Features

  • Secure Transactions: Supports both native BNB and BEP-20 token transfers.
  • Private Key Management: Uses environment variables to protect sensitive data.
  • Smart Contract Interaction: Supports function calls to BSC smart contracts.
  • Blockchain Integration: Built on Viem for reliable BSC blockchain interaction.
  • Customizable RPC Support: Allows configuration of RPC URLs for optimized performance.
  • Standardized MCP Integration: Enables structured data interaction for AI-driven automation.

Requirements

Before setting up the BNB Chain MCP Server, ensure you have the following installed:

  • Node.js (v16 or later)
  • npm or yarn
  • A valid Binance Smart Chain (BSC) wallet private key

Installation

Clone the repository and install dependencies:

1git clone https://github.com/your-repo/bsc-mcp-server.git 2cd bsc-mcp-server 3npm install # or yarn install

Configuration

To configure the server, create a .env file in the root directory and specify the following variables:

1BSC_WALLET_PRIVATE_KEY=your_private_key_here 2BSC_RPC_URL=https://bsc-dataseed.binance.org 3MORALIS_API_KEY=your_moralis_api_key_here # Optional: Use your Moralis API key if you want to fetch token balances from Moralis

Integration with Claude Desktop

Before integrating this MCP server with Claude Desktop, ensure you have the following installed:

  • Claude Desktop

Then Build the server using the following command:

1npm run build

To add this MCP server to Claude Desktop:

Create or edit the Claude Desktop configuration file at:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Add the following configuration:

1{ 2 "mcpServers": { 3 "bsc-mcp": { 4 "command": "node", 5 "args": [ 6 "/Users/Username/Desktop/bsc-mpc/build/index.js" 7 ], 8 "env": { 9 "BSC_WALLET_PRIVATE_KEY": "BSC_WALLET_PRIVATE_KEY", 10 "BSC_RPC_URL": "BSC_RPC_URL", 11 "MORALIS_API_KEY": "MORALIS_API_KEY" 12 }, 13 "disabled": false, 14 "autoApprove": [] 15 } 16 } 17}

Make sure to pass the correct location of the index.js file in the command and args fields.

Restart Claude Desktop for the changes to take effect.

Usage ( For Connecting MCP HOST other than Claude )

Start the Server

To start the MCP server, run:

1npm start # or node index.js

Transfer BEP-20 Tokens

Use the transferBEP20Token tool to send tokens by specifying the contract address or symbol:

1{ 2 "recipientAddress": "0xRecipientAddress", 3 "amount": "10", 4 "token": "USDT" 5}

Functions

  1. Transfer Native Token (BNB) - transferNativeToken

    1{ 2 "recipientAddress": "0xRecipientAddress", 3 "amount": "0.1" 4}
  2. Transfer BEP-20 Token by Symbol or Address - transferBEP20Token

    1{ 2 "recipientAddress": "0xRecipientAddress", 3 "amount": "10", 4 "token": "USDT" 5}
  3. Swap Tokens via PancakeSwap - pancakeSwap

    1{ 2 "inputToken": "TOKEN1", 3 "outputToken": "TOKEN2", 4 "amount": "100" 5}
  4. Fetch Native and Token Balances - getBalance

    1{ 2 "address": "0xWalletAddress" 3}
  5. Call a Contract Function - callContractFunction

    1{ 2 "abi": "contractABI", 3 "contractAddress": "0xContractAddress", 4 "functionName": "functionName", 5 "functionArgs": "arguments", 6 "value": "0" 7}
  6. Create a Meme Token on Four.Meme - createFourMeme

    1{ 2 "name": "TokenName", 3 "shortName": "TKN", 4 "imgUrl": "https://tokenimage.com", 5 "preSale": "1000", 6 "desc": "Token Description", 7 "twitterUrl": "https://twitter.com/token", 8 "telegramUrl": "https://t.me/token", 9 "webUrl": "https://tokenwebsite.com" 10}
  7. Create a BEP-20 Token - createBEP20Token

    1{ 2 "name": "TokenName", 3 "symbol": "TKN", 4 "totalSupply": "1000000" 5}

Model Context Protocol (MCP)

The Model Context Protocol (MCP) is an open standard designed to enhance the way applications interact with AI models and blockchain-based computational systems. MCP establishes structured context that improves the efficiency of automated transactions and decentralized applications.

Benefits of MCP:

  • Standardization: Defines a unified approach for application interactions.
  • Efficiency: Reduces computational overhead and improves transaction speed.
  • Interoperability: Supports integration across multiple platforms and blockchain ecosystems.

Error Handling

When a transaction fails, the server returns an error message with details. Check the console logs for more debugging information. Common error scenarios include:

  • Insufficient funds in the wallet
  • Invalid recipient address
  • Network congestion or RPC issues

Security Considerations

  • Private Key Protection: Never expose or hardcode your private key. Use environment variables.
  • RPC Provider Selection: Choose a trusted and reliable BSC RPC provider to prevent network issues.
  • Transaction Limits: Implement checks to avoid unintended large transfers.

License

This project is open-source under the MIT License.

For contributions, bug reports, or feature requests, submit an issue on GitHub.