MC

MCP Server for AI Agents on BNB Chain

Enable AI agents to execute transfers, swaps, launches and security checks on BNB Chain with the MCP server bridging complex on-chain operations seamlessly.

Quick Install
npx -y @TermiX-official/bsc-mcp

Overview

The MCP (Model Context Protocol) Server for AI Agents on BNB Chain is a middleware that translates high-level requests from AI agents into safe, auditable on-chain operations. It exposes a controlled API for common DeFi workflows — token transfers, swaps, token launches, and automated security checks — allowing models to request actions without holding or exposing raw private keys. The server handles signing, simulation, gas estimation, and policy enforcement before broadcasting transactions.

This server is useful when you want to integrate LLMs or other agents with BNB Chain while retaining operational security and programmable controls. By centralizing transaction handling, you can apply whitelists, rate limits, dry-run simulations, and security heuristics (e.g., honeypot checks or rug indicators) to reduce risk when agents initiate potentially dangerous operations.

Features

  • Bridge AI agent requests to on-chain transactions using MCP-compatible API patterns
  • Support for BNB transfers, token swaps (Router-based), and token contract launches
  • Built-in preflight checks: simulation, gas estimation, and revert detection
  • Security analysis tools: honeypot checks, liquidity/ownership verification, and basic rug heuristics
  • Configurable policies: API keys, origin whitelists, rate limits, and allowed methods
  • Audit logging and optional webhook callbacks for transaction lifecycle events
  • Docker-friendly and configurable via environment variables

Installation / Configuration

Clone and run (Node.js example):

# Clone the repo
git clone https://github.com/TermiX-official/bsc-mcp.git
cd bsc-mcp

# Install dependencies and start
npm install
npm run build
npm start

Docker:

# Build the image
docker build -t bsc-mcp:latest .

# Run with env var configuration
docker run -d --name bsc-mcp \
  -p 3000:3000 \
  -e RPC_URL=https://bsc-dataseed.binance.org/ \
  -e PRIVATE_KEY="0x..." \
  -e API_KEY="your_api_key_here" \
  bsc-mcp:latest

Recommended environment variables

VariableDescriptionExample
RPC_URLBNB Chain RPC endpointhttps://bsc-dataseed.binance.org/
PRIVATE_KEYServer signer private key (keep secure)0xabc…
PORTHTTP server port3000
API_KEYSimple API key for agent authenticationsecret_key
WHITELISTED_ORIGINSComma-separated allowed originshttps://ui.example.com
LOG_LEVELLogging verbosity (info/debug)info

Security note: use an HSM or signing-service for production private key management. Avoid committing keys to code or repos.

Available Tools / Resources

The server exposes REST endpoints and a MCP-style request wrapper. Common tools include:

  • /mcp/request — single-entry endpoint for MCP-formatted agent instructions
  • /tools/transfer — initiate BNB or BEP-20 transfers
  • /tools/swap — route a token swap via PancakeSwap-style router
  • /tools/launch — deploy or initialize token contracts with configurable params
  • /tools/security-check — run static and dynamic checks (honeypot, liquidity, ownership)
  • /health — simple liveness and config checks

Example curl (swap):

curl -X POST "http://localhost:3000/tools/swap" \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "fromToken": "0x...BNB",
    "toToken": "0x...TOKEN",
    "amountIn": "1000000000000000000",
    "slippage": 0.5,
    "recipient": "0xYourAddress"
  }'

Response typically includes: preflight result, estimated gas, signedTx (when requested), and txHash after broadcast.

Use Cases

  1. Automated Portfolio Manager

    • An LLM agent analyzes market signals and requests a swap via /tools/swap. The MCP server simulates the swap, checks slippage and liquidity, signs and broadcasts only after policy checks pass.
  2. Token Launch Assistant

    • A launch tool sequence via /tools/launch automates deploy + liquidity provisioning. The server enforces owner-control checks and simulates provisioning before broadcasting.
  3. Security Monitoring & Response

    • A monitoring agent receives alerts about suspicious tokens and calls /tools/security-check. The server runs honeypot tests, liquidity lock checks, and flags results. If configured, it can trigger transfers to move funds or revoke approvals.
  4. Controlled Agent Trading

    • Allow an AI agent to perform trades with strict constraints (daily limit, allowed pairs). The MCP server enforces these constraints, logs each action, and provides audit trails for compliance.

Operational and Security Considerations

  • Always run preflight simulations (eth_call) to detect reverts and gas issues.
  • Enforce strong authentication (API keys, mTLS, or JWT) and IP/origin whitelists.
  • Store private keys in secure key management services (KMS/HSM) where possible.
  • Use rigorous logging and off-chain audit trails; do not expose signed transactions to untrusted clients.
  • Rate-limit endpoints to prevent abuse by compromised agents.

Resources

  • GitHub: https://github.com/TermiX-official/bsc-mcp
  • Use the repo as the canonical source for code, issues, and further documentation.