BI

Binance MCP Server: Trading, Data & Account Management

Automate trading, access market data, and manage accounts with the Binance MCP server connecting AI assistants to Binance APIs.

Quick Install
npx -y @ethancod1ng/binance-mcp-server

Overview

The Binance MCP Server implements the Model Context Protocol (MCP) to expose Binance exchange functionality to AI assistants and other MCP-capable clients. It lets an assistant (for example, Claude, Cursor, or Trae) query market data, inspect account state, and execute trades on Binance mainnet or testnet, using a standardized MCP server process. This decouples your AI tooling from direct API keys and raw Binance SDK usage while preserving the ability to automate trading workflows.

This server is designed for developers who want to integrate exchange operations into conversational agents or other MCP-aware tools. It supports read-only market endpoints, account/balance queries, and trading operations (place/cancel orders), and includes safeguards for testnet vs. mainnet usage.

Features

  • Market data: current prices, order book depth, klines (candlesticks), 24h statistics
  • Account management: balances, open orders, and order history
  • Trading: place, cancel, and batch-cancel orders (works with mainnet and testnet)
  • Simple MCP server process: run via npx or install globally
  • Environment-driven configuration for API keys and testnet selection
  • Integration-ready for MCP-compatible AI assistants (Claude, Cursor, Trae, etc.)

Installation / Configuration

Install globally with npm or run via npx without installing:

# Global install
npm install -g binance-mcp-server

# Or run directly (recommended for quick usage)
npx binance-mcp-server

Set environment variables for Binance API access. Create a .env file or set variables in your MCP server configuration:

.env:

BINANCE_API_KEY=your_api_key_here
BINANCE_API_SECRET=your_api_secret_here
BINANCE_TESTNET=true  # true for testnet (recommended for development)

Example MCP server configuration (add to your MCP client config file):

{
  "mcpServers": {
    "binance": {
      "command": "npx",
      "args": ["binance-mcp-server"],
      "env": {
        "BINANCE_API_KEY": "your_api_key",
        "BINANCE_API_SECRET": "your_api_secret",
        "BINANCE_TESTNET": "false"
      }
    }
  }
}

One-line setup for Claude Code (example):

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

Development commands (repo):

npm run build   # compile TypeScript
npm run dev     # run in dev mode
npm run lint    # lint the codebase

Available Tools / Resources

The server exposes the following high-level tool actions to MCP clients. These are available as MCP tools (method names shown):

Tool / MethodPurpose
get_priceRetrieve current price/ticker for a trading pair (e.g., BTCUSDT)
get_orderbookFetch order book depth (bids/asks)
get_klinesGet candlestick (K-line) data for a symbol and interval
get_24hr_ticker24-hour statistics (volume, price change, etc.)
get_account_infoReturn account balances and basic metadata
get_open_ordersList current open orders
get_order_historyRetrieve historical orders and fills
place_orderPlace a new order (market, limit, etc.)
cancel_orderCancel a specific order by id
cancel_all_ordersCancel all open orders for a symbol

Responses follow concise JSON structures suitable for programmatic consumption in assistant workflows. Use the testnet for experimenting safely.

Use Cases

  • Inspect market state:

    • “Get the current price of BTCUSDT”
    • Assistant calls get_price and returns latest trade price and timestamp.
  • Research and analytics:

    • “Fetch 1-hour klines for ETHUSDT for the last 24 hours”
    • Use get_klines to retrieve candlesticks for plotting or indicator computation.
  • Monitoring account health:

    • “Show my balances and open positions”
    • get_account_info + get_open_orders to summarize holdings and risk.
  • Order execution (testnet recommended before mainnet):

    • “Place a limit buy for 0.001 BTC at 50,000 USDT”
    • place_order with type=LIMIT, price=50000, quantity=0.001
    • The server will run the order against testnet or mainnet depending on env.
  • Emergency operations:

    • “Cancel all open orders for BTCUSDT”
    • cancel_all_orders to quickly clear active orders.

Example place_order payload (illustrative):

{
  "symbol": "BTCUSDT",
  "side": "BUY",
  "type": "LIMIT",
  "price": "50000",
  "quantity": "0.001",
  "timeInForce": "GTC"
}

Best Practices and Security

  • Always use BINANCE_TESTNET=true while developing and testing. Testnet uses simulated funds.
  • Do not commit API keys into source control. Use environment variables or your MCP client’s secret store.
  • For production/mainnet trading, review and test order parameters carefully; the server will present warnings but the risk is real.
  • Limit permissions on created API keys to only the scopes you need (e.g., trading vs withdrawal).
  • GitHub repository: https://github.com/ethancod1ng/binance-mcp-server
  • Binance Testnet: https://testnet.binance.vision/
  • MCP-compatible assistants: Claude, Cursor, Trae

This server is a practical bridge between conversational AI and Binance APIs, enabling data-driven trading workflows and account automation while keeping API key management and protocol handling isolated inside an MCP process.

Tags:finance