MCPcopy Index your code
hub / github.com/ethancod1ng/binance-mcp-server

github.com/ethancod1ng/binance-mcp-server @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
44 symbols 76 edges 12 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Binance MCP Server

npm

Multi-language Documentation - English (current) - 中文 - 日本語

A Model Context Protocol (MCP) server that provides Claude Code with Binance exchange API functionality.

Quick Start

📹 Video Tutorial

Watch our comprehensive MCP usage tutorial to get started quickly: MCP Usage Tutorial

Installation

npm install -g binance-mcp-server

Configuration

This MCP server can be used with various AI tools that support MCP:

Claude Cursor Trae

MCP Configuration

Add the following configuration to your MCP settings 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"
      }
    }
  }
}

Note: Set BINANCE_TESTNET to "true" if you want to use the Binance testnet for development and testing.

One-Click Setup with Claude Code

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

Environment Setup

Getting API Keys

For Testnet (Recommended for Development): 1. Visit Binance Testnet 2. Create a testnet account (no real verification required) 3. Go to API Management in your testnet account 4. Create a new API key with trading permissions 5. Note: Testnet uses virtual funds - completely safe for testing

For Mainnet (Production): 1. Create a verified account on Binance 2. Complete KYC verification 3. Go to API Management in your account settings 4. Create a new API key with required permissions 5. ⚠️ Warning: Mainnet uses real money - be very careful!

Configuration

Create .env file:

BINANCE_API_KEY=your_api_key_here
BINANCE_API_SECRET=your_api_secret_here
BINANCE_TESTNET=true  # Set to false for mainnet (REAL money)

Available Tools

Market Data

  • get_price - Get current price for trading pair
  • get_orderbook - Get order book depth data
  • get_klines - Get K-line/candlestick data
  • get_24hr_ticker - Get 24-hour price statistics

Account

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

Trading (Mainnet & Testnet)

  • place_order - Place a new order (supports both mainnet and testnet)
  • cancel_order - Cancel specific order (supports both mainnet and testnet)
  • cancel_all_orders - Cancel all open orders (supports both mainnet and testnet)

Usage Examples

Ask Claude to: - "Get the current price of Bitcoin" - "Show me the order book for ETHUSDT" - "Check my account balance" - "Place a limit buy order for 0.001 BTC at $50,000"

Security

⚠️ Important: - Set BINANCE_TESTNET=true for safe testing with virtual funds - Set BINANCE_TESTNET=false or omit for mainnet trading with REAL money - Mainnet trading will display warnings before executing orders

Development

npm run build    # Compile TypeScript
npm run dev      # Development mode
npm run lint     # Run linting

Extension points exported contracts — how you extend this code

BinancePrice (Interface)
(no doc)
src/types/binance.ts
BinanceOrderBook (Interface)
(no doc)
src/types/binance.ts
BinanceKline (Interface)
(no doc)
src/types/binance.ts
Binance24hrTicker (Interface)
(no doc)
src/types/binance.ts
BinanceAccountInfo (Interface)
(no doc)
src/types/binance.ts

Core symbols most depended-on inside this repo

handleBinanceError
called by 10
src/utils/error-handling.ts
validateInput
called by 10
src/utils/validation.ts
validateSymbol
called by 9
src/utils/validation.ts
validateAndWarnMainnet
called by 3
src/tools/trading.ts
logError
called by 3
src/utils/error-handling.ts
sanitizeError
called by 2
src/utils/error-handling.ts
main
called by 1
src/index.ts
setupTools
called by 1
src/server.ts

Shape

Function 17
Interface 11
Class 8
Method 8

Languages

TypeScript100%

Modules by API surface

src/utils/error-handling.ts12 symbols
src/types/binance.ts11 symbols
src/server.ts7 symbols
src/config/binance.ts6 symbols
src/utils/validation.ts5 symbols
src/tools/trading.ts1 symbols
src/tools/index.ts1 symbols
src/index.ts1 symbols

For agents

$ claude mcp add binance-mcp-server \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page