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.
npx -y @TermiX-official/bsc-mcpOverview
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
# Install dependencies and start
Docker:
# Build the image
# Run with env var configuration
Recommended environment variables
| Variable | Description | Example |
|---|---|---|
| RPC_URL | BNB Chain RPC endpoint | https://bsc-dataseed.binance.org/ |
| PRIVATE_KEY | Server signer private key (keep secure) | 0xabc… |
| PORT | HTTP server port | 3000 |
| API_KEY | Simple API key for agent authentication | secret_key |
| WHITELISTED_ORIGINS | Comma-separated allowed origins | https://ui.example.com |
| LOG_LEVEL | Logging 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):
Response typically includes: preflight result, estimated gas, signedTx (when requested), and txHash after broadcast.
Use Cases
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.
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.
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.
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.