You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Binance
BINANCE_API_KEY=your-api-key
BINANCE_API_SECRET=your-api-secret
# Binance US
BINANCE_US_API_KEY=your-us-api-key
BINANCE_US_API_SECRET=your-us-api-secret
Programmatic Configuration
import{createBinanceTrading}from"@universal-crypto-mcp/trading-binance";consttrading=createBinanceTrading({apiKey: process.env.BINANCE_API_KEY,apiSecret: process.env.BINANCE_API_SECRET,sandbox: false,// Set true for testnet});
Available Tools
Account Tools
Tool
Description
binance_account_info
Get account information
binance_balances
Get all balances
binance_balance
Get specific asset balance
binance_deposit_address
Get deposit address
binance_withdraw
Withdraw funds
Market Data Tools
Tool
Description
binance_ticker
Get 24h ticker
binance_orderbook
Get order book
binance_trades
Get recent trades
binance_klines
Get candlestick data
binance_exchange_info
Get exchange info
Trading Tools
Tool
Description
binance_place_order
Place a new order
binance_cancel_order
Cancel an order
binance_open_orders
Get open orders
binance_order_status
Get order status
binance_trade_history
Get trade history
Futures Tools (Binance only)
Tool
Description
binance_futures_position
Get futures positions
binance_futures_order
Place futures order
binance_set_leverage
Set leverage
binance_funding_rate
Get funding rate
Usage Examples
Get Account Balance
import{registerBinanceTools}from"@universal-crypto-mcp/trading-binance";// Register tools with MCP serverregisterBinanceTools(server,{apiKey: process.env.BINANCE_API_KEY,apiSecret: process.env.BINANCE_API_SECRET,});// The AI can now use: "Check my Binance BTC balance"
Place a Spot Order
// AI command: "Buy 0.001 BTC at market price"// Tool called: binance_place_order// Parameters:{symbol: "BTCUSDT",side: "BUY",type: "MARKET",quantity: 0.001}
Get Price Data
// AI command: "What's the current BTC price on Binance?"// Tool called: binance_ticker// Parameters:{symbol: "BTCUSDT"}// Response:{symbol: "BTCUSDT",priceChange: "1234.56",priceChangePercent: "2.34",lastPrice: "67890.12",highPrice: "68500.00",lowPrice: "66000.00",volume: "12345.678"}
Get Candlestick Data
// AI command: "Get hourly BTC candles for the last day"// Tool called: binance_klines// Parameters:{symbol: "BTCUSDT",interval: "1h",limit: 24}
{symbol: "BTCUSDT",side: "SELL",quantity: 0.001,price: 70000,// Take profitstopPrice: 60000,// Stop loss triggerstopLimitPrice: 59900// Stop loss limit}
Futures Trading
Open a Long Position
// Set leverage first{symbol: "BTCUSDT",leverage: 10}// Place futures order{symbol: "BTCUSDT",side: "BUY",type: "MARKET",quantity: 0.01}
Check Positions
// AI command: "Show my open futures positions"// Tool called: binance_futures_position// Response:{positions: [{symbol: "BTCUSDT",entryPrice: "67000.00",markPrice: "67500.00",unrealizedPnl: "50.00",leverage: 10,positionSide: "LONG"}]}
Error Handling
import{TradingError,InsufficientBalanceError}from"@universal-crypto-mcp/trading-binance";try{awaitplaceOrder(params);}catch(error){if(errorinstanceofInsufficientBalanceError){console.log("Not enough balance:",error.required);}elseif(error.code===-2010){console.log("Account has insufficient balance");}}
Security Best Practices
API Key Permissions: Only enable required permissions
IP Whitelisting: Restrict API access to specific IPs
Withdrawal Limits: Set withdrawal address whitelist