Multi-language Documentation
A Model Context Protocol (MCP) server that doth provide Claude Code with Binance exchange API functionality, most wondrous and true.
Behold our comprehensive MCP usage tutorial, that thou mayest commence thy journey with great haste:
npm install -g binance-mcp-serverThis MCP server may be employed with various AI tools that doth support the MCP protocol:
One-Click Setup:
claude mcp add binance --env BINANCE_API_KEY=YOUR_API_KEY --env BINANCE_API_SECRET=YOUR_API_SECRET --env BINANCE_TESTNET=false -- npx -y binance-mcp-serverManual Setup:
Add unto thy Claude Code MCP settings (.claude/settings.json or the like):
{
"mcpServers": {
"binance": {
"command": "npx",
"args": ["-y", "binance-mcp-server"],
"env": {
"BINANCE_API_KEY": "your_api_key",
"BINANCE_API_SECRET": "your_api_secret",
"BINANCE_TESTNET": "false"
}
}
}
}Location of thy config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
NPM Global Install Method:
{
"mcpServers": {
"binance-mcp-server": {
"command": "npx",
"args": ["-y", "binance-mcp-server"],
"env": {
"BINANCE_API_KEY": "your_api_key_here",
"BINANCE_API_SECRET": "your_api_secret_here",
"BINANCE_TESTNET": "false"
}
}
}
}Local Development Method:
{
"mcpServers": {
"binance-mcp-server": {
"command": "node",
"args": [
"/absolute/path/to/binance-mcp-server/dist/index.js"
],
"env": {
"BINANCE_API_KEY": "your_api_key_here",
"BINANCE_API_SECRET": "your_api_secret_here",
"BINANCE_TESTNET": "false",
"MCP_SERVER_NAME": "binance-mcp-server",
"MCP_SERVER_VERSION": "1.1.1",
"LOG_LEVEL": "info"
}
}
}
}After adding the configuration, proceed thusly:
- Save thy config file
- Restart Claude Desktop in its entirety (Quit and reopen)
- The MCP server shall load automatically, as if by magic
Note: Set
BINANCE_TESTNETto"true"shouldst thou desire to employ the Binance testnet for development and testing most prudent.
For Testnet (Most Recommended for Development):
- Venture forth to Binance Testnet
- Create a testnet account (no true verification be required)
- Journey to API Management in thy testnet account
- Forge a new API key with trading permissions most fitting
- Note: Testnet doth employ virtual funds - completely safe for thy testing endeavors
For Mainnet (Production, Most Perilous):
- Create a verified account upon Binance
- Complete KYC verification, as the law doth require
- Journey to API Management in thy account settings
- Forge a new API key with required permissions
⚠️ Warning Most Dire: Mainnet doth employ REAL coin - exercise utmost care!
Create thy .env file thusly:
BINANCE_API_KEY=your_api_key_here
BINANCE_API_SECRET=your_api_secret_here
BINANCE_TESTNET=true # Set to false for mainnet (REAL coin, most perilous!)get_price- Obtaineth the current price for a trading pairget_orderbook- Obtaineth the order book depth dataget_klines- Obtaineth K-line/candlestick data most illuminatingget_24hr_ticker- Obtaineth 24-hour price statistics
get_account_info- Obtaineth spot account information and balancesget_open_orders- Obtaineth current open spot ordersget_order_history- Obtaineth historical spot orders
place_order- Placeth a new spot order (supporteth both mainnet and testnet)cancel_order- Canceleth specific spot order (supporteth both mainnet and testnet)cancel_all_orders- Canceleth all open spot orders (supporteth both mainnet and testnet)
get_futures_account_info- Obtaineth futures account balance, margin, and PnLget_futures_positions- Obtaineth open futures positions with entry price, PnL, leverageget_futures_open_orders- Obtaineth pending futures ordersget_futures_order_history- Obtaineth historical futures ordersget_futures_income_history- Obtaineth income history (PnL, funding fees, commissions)get_futures_adl_quantile- Obtaineth Auto-Deleveraging (ADL) quantile indicatorget_futures_commission_rate- Obtaineth current trading commission ratesplace_futures_order- Placeth futures market/limit order (⚠️ MAINNET ENABLED with risk warnings)cancel_futures_order- Canceleth specific futures order (⚠️ MAINNET ENABLED)cancel_all_futures_orders- Canceleth all futures orders for a symbol (⚠️ MAINNET ENABLED, requires confirmation)
place_futures_stop_loss- Placeth stop-loss order to protect thy position (⚠️ MAINNET ENABLED - Defensive)place_futures_take_profit- Placeth take-profit order to secure gains (⚠️ MAINNET ENABLED - Defensive)place_futures_trailing_stop- Placeth trailing stop that followeth price movement (⚠️ MAINNET ENABLED - Defensive)
close_futures_position- Closeth entire position at market price (⚠️ MAINNET ENABLED, requires confirmation)modify_futures_order- Modifieth existing order price and quantity (⚠️ MAINNET ENABLED)place_futures_bracket_order- Placeth entry + stop-loss + take-profit (⚠️ MAINNET ENABLED, requires confirmation)set_futures_leverage- Adjusteth leverage 1-125x (⚠️ MAINNET ENABLED, high leverage requires confirmation)set_futures_margin_type- Setteth ISOLATED or CROSSED margin (⚠️ MAINNET ENABLED)adjust_futures_isolated_margin- Add or remove margin from isolated positions (⚠️ MAINNET ENABLED, removal requires confirmation)set_futures_position_mode- Switch between Hedge Mode and One-way Mode (⚠️ MAINNET ENABLED, requires confirmation)
get_futures_funding_rate- Obtaineth funding rate history for perpetual contractsget_futures_mark_price- Obtaineth current mark price and funding rateget_futures_open_interest- Obtaineth open interest statistics for trend analysisget_futures_long_short_ratio- Obtaineth long/short ratio for market sentimentget_futures_taker_volume- Obtaineth taker buy/sell volume for pressure analysisget_futures_basis- Obtaineth basis (premium/discount) between futures and spot
place_multiple_futures_orders- Placeth up to 5 orders simultaneously (⚠️ MAINNET ENABLED, requires confirmation)cancel_multiple_futures_orders- Canceleth up to 10 orders by ID (⚠️ MAINNET ENABLED)
Total: 38 tools available for thy trading pleasure
- "Pray tell, what be the current price of Bitcoin?"
- "Show me the order book for ETHUSDT with 20 levels, I beseech thee"
- "Obtaineth 1-hour candlestick data for BTCUSDT"
- "What be the 24-hour trading volume for ETHUSDT?"
- "Pray check my spot account balance"
- "Show me mine open spot orders"
- "What be my order history for BTCUSDT?"
- "Show me mine futures account balance"
- "What be mine open futures positions?"
- "Check mine OPENUSDT position details, most urgently"
- "What be my total unrealized PnL?"
- "Show me pending futures orders, if any there be"
- "Place a limit buy order for 0.001 BTC at $50,000" (Mainnet/Testnet)
- "Cancel order ID 12345 for BTCUSDT, forthwith" (Mainnet/Testnet)
- "Place a futures market order to buy 100 BTCUSDT" (
⚠️ MAINNET ENABLED - risk warnings shown) - "Set leverage to 10x for ETHUSDT futures" (
⚠️ Requires confirmRisk: true for >10x) - "Place a stop-loss at $95,000 for my BTCUSDT long position"
- "Set a trailing stop with 2% callback for ETHUSDT"
- "Close my entire OPENUSDT position" (
⚠️ Requires confirmation) - "Place a bracket order: entry at $100k, stop-loss $98k, take-profit $105k"
- "Add 500 USDT margin to my BTCUSDT isolated position"
- "Show me the funding rate history for BTCUSDT"
- "What be the long/short ratio for ETHUSDT?"
This MCP server employeth a sophisticated risk assessment system to protect thy funds:
Risk Levels:
- LOW: Read-only operations, market data queries
- MEDIUM: Defensive orders (stop-loss, take-profit), account modifications
- HIGH: New positions, large orders (>50% account balance), high leverage (>10x)
- CRITICAL: Extreme leverage (>20x), massive orders (>80% account balance)
Automatic Protections:
- Defensive orders (stop-loss, take-profit) = MEDIUM risk, no confirmation needed
- Opening/increasing positions = HIGH risk, requires
confirmRisk: true - High leverage (>10x) = Requires explicit confirmation
- Large orders (>50% of account) = Requires explicit confirmation
- All responses include
networkModeindicator (mainnet/testnet)
Configure thy safety settings in .env:
# Safety Configuration
ALLOW_MAINNET_TRADING=true # Set to false to restrict all trading to testnet
MAX_ORDER_SIZE_PCT=80 # Maximum order size as % of account balance
REQUIRE_CONFIRMATION_ABOVE=50 # Require confirmRisk: true for orders above this %
ENABLE_RISK_WARNINGS=true # Display risk warnings for all operations- Start with
BINANCE_TESTNET=truefor safe testing with virtual funds - All mainnet trading tools display warnings and require confirmation for high-risk actions
- Defensive orders (stops, take-profits) work seamlessly to protect thy positions
- Set
confirmRisk: trueparameter for high-risk operations - Use IP whitelisting on thy Binance API keys for additional security
- Never share thy API keys or commit them to version control
npm run build # Compileth TypeScript unto JavaScript
npm run dev # Development mode, for thy testing
npm run lint # Runneth linting, to ensure code quality most fine