binance-mcp-server

josh-jaiy/binance-mcp-server

3.2

If you are the rightful owner of binance-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Binance MCP Server is a Model Context Protocol server that integrates Binance exchange API functionality with Claude Code, providing a seamless interface for trading and market data retrieval.

Tools
19
Resources
0
Prompts
0

Binance MCP Server

npm smithery badge

Multi-language Documentation

  • (current)

A Model Context Protocol (MCP) server that doth provide Claude Code with Binance exchange API functionality, most wondrous and true.

Quick Start

📹 Video Tutorial

Behold our comprehensive MCP usage tutorial, that thou mayest commence thy journey with great haste:

MCP Usage Tutorial

Installation

npm install -g binance-mcp-server

Configuration

This MCP server may be employed with various AI tools that doth support the MCP protocol:

Claude Cursor Trae

Option 1: Claude Code (CLI)

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-server

Manual 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"
      }
    }
  }
}
Option 2: Claude Desktop (GUI)

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:

  1. Save thy config file
  2. Restart Claude Desktop in its entirety (Quit and reopen)
  3. The MCP server shall load automatically, as if by magic

Note: Set BINANCE_TESTNET to "true" shouldst thou desire to employ the Binance testnet for development and testing most prudent.

Environment Setup

Obtaining thy API Keys

For Testnet (Most Recommended for Development):

  1. Venture forth to Binance Testnet
  2. Create a testnet account (no true verification be required)
  3. Journey to API Management in thy testnet account
  4. Forge a new API key with trading permissions most fitting
  5. Note: Testnet doth employ virtual funds - completely safe for thy testing endeavors

For Mainnet (Production, Most Perilous):

  1. Create a verified account upon Binance
  2. Complete KYC verification, as the law doth require
  3. Journey to API Management in thy account settings
  4. Forge a new API key with required permissions
  5. ⚠️ Warning Most Dire: Mainnet doth employ REAL coin - exercise utmost care!
Configuration

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!)

Available Tools Most Wondrous

Market Data (4 tools)

  • get_price - Obtaineth the current price for a trading pair
  • get_orderbook - Obtaineth the order book depth data
  • get_klines - Obtaineth K-line/candlestick data most illuminating
  • get_24hr_ticker - Obtaineth 24-hour price statistics

Spot Account (3 tools)

  • get_account_info - Obtaineth spot account information and balances
  • get_open_orders - Obtaineth current open spot orders
  • get_order_history - Obtaineth historical spot orders

Spot Trading (3 tools - Mainnet & Testnet)

  • 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)

Futures Account (9 tools)

  • get_futures_account_info - Obtaineth futures account balance, margin, and PnL
  • get_futures_positions - Obtaineth open futures positions with entry price, PnL, leverage
  • get_futures_open_orders - Obtaineth pending futures orders
  • get_futures_order_history - Obtaineth historical futures orders
  • place_futures_order - Placeth futures market/limit order (TESTNET ONLY, for thy safety)
  • cancel_futures_order - Canceleth specific futures order (TESTNET ONLY)
  • cancel_all_futures_orders - Canceleth all futures orders for a symbol (TESTNET ONLY)
  • set_futures_leverage - Adjusteth leverage 1-125x (TESTNET ONLY, most powerful!)
  • set_futures_margin_type - Setteth ISOLATED or CROSSED margin (TESTNET ONLY)

Total: 19 tools available for thy trading pleasure

Usage Examples Most Instructive

Market Data Queries

  • "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?"

Spot Account Queries

  • "Pray check my spot account balance"
  • "Show me mine open spot orders"
  • "What be my order history for BTCUSDT?"

Futures Account Queries

  • "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"

Trading (Employ with utmost caution!)

  • "Place a limit buy order for 0.001 BTC at $50,000" (Spot - Mainnet/Testnet)
  • "Cancel order ID 12345 for BTCUSDT, forthwith" (Spot - Mainnet/Testnet)
  • "Place a futures market order to buy 100 BTCUSDT" (Futures - Testnet only, most safe)
  • "Set leverage to 10x for ETHUSDT futures" (Futures - Testnet only, handle with care!)

Security Most Critical

⚠️ Of Utmost Importance:

  • Set BINANCE_TESTNET=true for safe testing with virtual funds, as a wise merchant would
  • Set BINANCE_TESTNET=false or omit for mainnet trading with REAL coin (most perilous!)
  • Mainnet trading shall display warnings most dire before executing orders, for thy protection

Development

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