Skip to main content
Glama
Binance MCP Server

Binance MCP Server

by hiteshgarg02

๐Ÿš€ Binance MCP Server

A comprehensive Model Context Protocol (MCP) server for Binance, providing read-only access to your trading accounts, portfolio data, market information, and more through AI assistants like Claude.

โœจ Features

This MCP server provides 20+ read-only tools across multiple categories:

๐Ÿ“ข Public Market Data

  • fetch_latest_announcements - Get latest Binance announcements

  • get_ticker_price - Current price for any symbol or all symbols

  • get_24hr_ticker - 24-hour statistics (price change, volume, high/low)

๐Ÿ’ผ Spot Account

  • get_account_info - Account balances, permissions, and commission rates

  • get_spot_open_orders - All open spot orders

  • get_spot_trade_history - Recent trade history for any symbol

๐ŸŽฏ USDT-M Futures

  • get_futures_account_balance - Futures wallet balance and active positions

  • get_futures_open_orders - All open futures orders

  • get_futures_income_history - Realized PnL, funding fees, commissions

๐Ÿ”„ Margin Trading

  • get_margin_account - Cross margin account details and balances

  • get_isolated_margin_account - Isolated margin positions and margin levels

๐Ÿ“Š Portfolio Overview

  • get_asset_distribution - Complete portfolio snapshot across all accounts

๐Ÿ’ฐ Deposits & Withdrawals

  • get_deposit_address - Get deposit addresses for any coin/network

  • get_deposit_history - View deposit transaction history

  • get_withdraw_history - View withdrawal transaction history

Related MCP server: Binance Cryptocurrency MCP

โšก Quick Start

# 1. Clone and install
git clone <your-repo-url>
cd binance-mcp
uv sync

# 2. Configure API keys
cp .env.example .env
# Edit .env with your Binance API keys

# 3. Test it locally with inspector UI
uv run fastmcp dev main.py

# 4. Add to Claude Desktop config (see Integration section below)

๐Ÿ”ง Installation

Prerequisites

  • Python 3.11 or higher

  • A Binance account with API access

  • uv (recommended) or pip

Step 1: Clone and Install Dependencies

# Clone the repository
git clone <your-repo-url>
cd binance-mcp

# Install dependencies with uv (recommended)
uv sync

# Or with pip
pip install -e .

Step 2: Create Binance API Keys

  1. Log in to Binance

  2. Go to Profile โ†’ API Management

  3. Create a new API key

  4. Important: Only enable "Enable Reading" permission (read-only)

  5. Save your API Key and Secret Key securely

Step 3: Configure Environment Variables

Create a .env file in the project root:

cp .env.example .env

Edit .env and add your API credentials:

BINANCE_API_KEY=your_api_key_here
BINANCE_API_SECRET=your_api_secret_here
BINANCE_ENVIRONMENT=production

Note: Never commit your .env file to version control. It's already in .gitignore.

๐ŸŽฏ Usage

Running Locally

# Development mode with auto-reload and inspector UI
uv run fastmcp dev main.py

# Production mode
uv run fastmcp run main.py

Development mode provides:

  • ๐Ÿ”„ Auto-reload on file changes

  • ๐ŸŒ Web inspector UI at http://localhost:5173

  • ๐Ÿ“Š Real-time tool testing and debugging

Method 2: Using Python Directly

# Activate virtual environment (if using uv)
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Run the MCP server
python main.py

Integrating with Claude Desktop

Add this to your Claude Desktop configuration file:

On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "binance": {
      "command": "uv",
      "args": [
        "--directory",
        "C:/Users/YourUsername/Documents/code/MCP/binance-mcp",
        "run",
        "fastmcp",
        "run",
        "main.py"
      ]
    }
  }
}

Note: Make sure the .env file is in the project directory. The uv run fastmcp run command will automatically handle dependencies and environment setup.

Method 2: Using Python Directly

{
  "mcpServers": {
    "binance": {
      "command": "python",
      "args": [
        "C:/Users/YourUsername/Documents/code/MCP/binance-mcp/main.py"
      ],
      "env": {
        "BINANCE_API_KEY": "your_api_key_here",
        "BINANCE_API_SECRET": "your_api_secret_here",
        "BINANCE_ENVIRONMENT": "production"
      }
    }
  }
}

Method 3: Using UV without FastMCP

{
  "mcpServers": {
    "binance": {
      "command": "uv",
      "args": [
        "--directory",
        "C:/Users/YourUsername/Documents/code/MCP/binance-mcp",
        "run",
        "python",
        "main.py"
      ]
    }
  }
}

Restart Claude Desktop

After updating the configuration, completely quit and restart Claude Desktop for changes to take effect.

๐Ÿงช Testing the Server

Before integrating with Claude Desktop, you can test the server locally:

# Start development server with inspector UI
uv run fastmcp dev main.py

This will:

  1. Start the MCP server

  2. Open a web inspector at http://localhost:5173

  3. Allow you to test all tools interactively

  4. Auto-reload when you make code changes

Inspector Features:

  • ๐Ÿ“‹ List all available tools

  • ๐Ÿ”ง Test tools with custom parameters

  • ๐Ÿ“Š See real-time request/response data

  • ๐Ÿ› Debug issues before deploying to Claude

๐Ÿ“– Example Queries

Once integrated with Claude, you can ask:

  • "What's my current portfolio across all accounts?"

  • "Show me my open orders on futures"

  • "What's the current price of BTCUSDT?"

  • "Get my spot trading history for ETHUSDT"

  • "Show me my recent futures PnL"

  • "What are the latest Binance announcements?"

  • "Check my margin account status"

  • "Show my deposit history for the last 20 transactions"

๐Ÿ”’ Security Best Practices

  1. Read-Only Keys: Only enable "Enable Reading" permission on your API keys

  2. Never Share: Keep your API keys private and never commit them to version control

  3. IP Whitelist: Consider restricting API key access to specific IP addresses in Binance settings

  4. Regular Rotation: Periodically rotate your API keys for enhanced security

  5. Monitor Usage: Regularly check your API key usage in Binance

๐ŸŒ Testnet Support

To use Binance Testnet for testing:

  1. Create testnet API keys at Binance Testnet

  2. Set BINANCE_ENVIRONMENT=testnet in your .env file

๐Ÿ› ๏ธ Development

Project Structure

binance-mcp/
โ”œโ”€โ”€ main.py              # Main MCP server with all tools
โ”œโ”€โ”€ pyproject.toml       # Project dependencies
โ”œโ”€โ”€ .env                 # Your API credentials (not committed)
โ”œโ”€โ”€ .env.example         # Example environment file
โ”œโ”€โ”€ .gitignore          # Git ignore rules
โ”œโ”€โ”€ LICENSE              # MIT License
โ””โ”€โ”€ README.md           # This file

Development Workflow

# 1. Install dependencies
uv sync

# 2. Create .env file with your API keys
cp .env.example .env
# Edit .env with your actual keys

# 3. Start development server
uv run fastmcp dev main.py

# 4. Open the inspector UI (opens automatically)
# http://localhost:5173

# 5. Make changes to main.py - server auto-reloads!

Useful Commands

# Development mode (with inspector & auto-reload)
uv run fastmcp dev main.py

# Production mode (for Claude Desktop)
uv run fastmcp run main.py

# Install new dependencies
uv add package-name

# Update dependencies
uv sync

# Run linting (if configured)
uv run ruff check main.py

Adding New Tools

To add a new tool, use the @mcp.tool() decorator:

@mcp.tool()
async def your_new_tool(param: str) -> str:
    """
    Description of your tool.
    
    Args:
        param: Description of parameter
    
    Returns:
        Markdown formatted result
    """
    # Your implementation
    return "Result in Markdown format"

After adding a tool:

  1. The dev server will auto-reload

  2. Test it in the inspector UI

  3. Restart Claude Desktop to use it there

๐Ÿ“ API Rate Limits

Binance has rate limits on API requests:

  • Spot: 1200 requests per minute

  • Futures: 2400 requests per minute

  • Other endpoints: Varies by endpoint

This server respects these limits. Avoid making excessive requests in a short time.

This server is READ-ONLY and cannot execute trades, transfers, or withdrawals.

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository

  2. Create your feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add some amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License Summary:

  • โœ… Commercial use

  • โœ… Modification

  • โœ… Distribution

  • โœ… Private use

  • โš ๏ธ No liability

  • โš ๏ธ No warranty

๐Ÿ†˜ Troubleshooting

"API keys not configured" error

  • Ensure your .env file exists and contains valid API credentials

  • Check that environment variables are loaded correctly

"Signature verification failed" error

  • Verify your API secret is correct

  • Ensure your system clock is synchronized (Binance API requires accurate time)

"Permission denied" errors

  • Confirm "Enable Reading" permission is enabled on your API key

  • Some endpoints may require additional permissions

Connection errors

  • Check your internet connection

  • Verify you're not behind a restrictive firewall

  • Try using testnet to isolate issues

๐Ÿ“ž Support

For issues and questions:

  1. Check the Binance API Documentation

  2. Review closed issues in this repository

  3. Open a new issue with details about your problem


Happy Trading! ๐Ÿ“ˆ

Available Tools

15 tools
fetch_latest_announcementsA

Fetch the latest Binance announcements in Markdown format.

Args: count: Number of announcements to fetch (max 20) page: Page number to fetch (default 1)

Returns: Markdown formatted string with announcement titles, URLs, and timestamps

Inputs: page, count. Returns: result

get_24hr_tickerB

Get 24-hour price change statistics for a symbol.

Args: symbol: Trading pair symbol (e.g., 'BTCUSDT')

Returns: Markdown formatted 24hr statistics

Inputs: symbol (required). Returns: result

get_account_infoA

Get current spot account information including balances and permissions.

Returns: Markdown formatted account information

Inputs: no named parameters. Returns: result

get_asset_distributionA

Get a portfolio distribution snapshot showing asset allocation across spot, futures, and margin accounts.

Returns: Markdown formatted portfolio distribution

Inputs: no named parameters. Returns: result

get_deposit_addressB

Get deposit address for a specific coin and network.

Args: coin: Coin name (e.g., 'BTC', 'ETH', 'USDT') network: Network name (e.g., 'BTC', 'ETH', 'TRX'). If None, returns all networks

Returns: Markdown formatted deposit address information

Inputs: coin (required), network. Returns: result

get_deposit_historyA

Get deposit history for all coins or a specific coin.

Args: coin: Coin name (e.g., 'BTC', 'ETH'). If None, returns all coins status: 0=pending, 1=success, 6=credited but cannot withdraw. If None, returns all statuses limit: Number of records to fetch (default 10, max 1000)

Returns: Markdown formatted deposit history

Inputs: coin, limit, status. Returns: result

get_futures_account_balanceA

Get USDT-M Futures account balance and positions.

Returns: Markdown formatted futures account information

Inputs: no named parameters. Returns: result

get_futures_income_historyA

Get futures income history (realized PnL, funding fees, commissions, etc.).

Args: symbol: Trading pair symbol (e.g., 'BTCUSDT'). If None, returns all symbols income_type: Type of income (TRANSFER, WELCOME_BONUS, REALIZED_PNL, FUNDING_FEE, COMMISSION, etc.) limit: Number of records to fetch (default 20, max 1000)

Returns: Markdown formatted income history

Inputs: limit, symbol, income_type. Returns: result

get_futures_open_ordersA

Get all open futures orders for a symbol or all symbols.

Args: symbol: Trading pair symbol (e.g., 'BTCUSDT'). If None, returns all open orders

Returns: Markdown formatted list of open futures orders

Inputs: symbol. Returns: result

get_isolated_margin_accountA

Get isolated margin account details for all symbols or a specific symbol.

Args: symbol: Trading pair symbol (e.g., 'BTCUSDT'). If None, returns all isolated margin accounts

Returns: Markdown formatted isolated margin account information

Inputs: symbol. Returns: result

get_margin_accountA

Get cross margin account details including balances and margin level.

Returns: Markdown formatted margin account information

Inputs: no named parameters. Returns: result

get_spot_open_ordersA

Get all open spot orders for a symbol or all symbols.

Args: symbol: Trading pair symbol (e.g., 'BTCUSDT'). If None, returns all open orders

Returns: Markdown formatted list of open orders

Inputs: symbol. Returns: result

get_spot_trade_historyB

Get recent spot trade history for a symbol.

Args: symbol: Trading pair symbol (e.g., 'BTCUSDT') limit: Number of trades to fetch (default 10, max 1000)

Returns: Markdown formatted trade history

Inputs: symbol (required), limit. Returns: result

get_ticker_priceA

Get current price ticker for a symbol or all symbols.

Args: symbol: Trading pair symbol (e.g., 'BTCUSDT'). If None, returns all symbols

Returns: Markdown formatted price information

Inputs: symbol. Returns: result

get_withdraw_historyA

Get withdrawal history for all coins or a specific coin.

Args: coin: Coin name (e.g., 'BTC', 'ETH'). If None, returns all coins status: 0=email sent, 1=cancelled, 2=awaiting approval, 3=rejected, 4=processing, 5=failure, 6=completed limit: Number of records to fetch (default 10, max 1000)

Returns: Markdown formatted withdrawal history

Inputs: coin, limit, status. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    B3.4/5.0

    Scored across 15 tools

    Disambiguation4/5

    Most tools are cleanly separated by resource + market type (spot vs futures vs margin) and by data kind (orders, history, balance, ticker). The only soft overlaps are get_account_info vs get_asset_distribution vs get_margin_account, but the descriptions make the distinction (raw spot balances vs cross-account allocation snapshot vs margin-specific) reasonably clear.

    Naming Consistency4/5

    Nearly every tool follows a get_<domain>_<resource> snake_case pattern (get_spot_open_orders, get_futures_income_history, get_deposit_address). The single outlier is fetch_latest_announcements, which breaks the get_ verb convention but remains readable and unambiguous.

    Tool Count4/5

    15 tools is within a reasonable range and each maps to a distinct data view (spot, futures, margin, funding, market data, announcements). A few pairs are near-mirrors (spot vs futures open orders, deposit vs withdraw history) but they cover genuinely different endpoints.

    Completeness3/5

    The surface is thorough on the read/monitoring side but has no write operations at all: no place/cancel order, no transfer between accounts, no withdraw execution. It also lacks common market data like order book depth or klines, so an agent trying to act (not just observe) will hit dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to interact with OKX trading accounts through read-only access to retrieve portfolio information, trading positions, order history, and account analytics. Provides secure, local processing of trading data without storing sensitive information or enabling trade execution.
      5
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to access real-time Binance cryptocurrency market data including prices, order books, candlestick charts, trading history, and 24-hour statistics through natural language queries.
      Apache 2.0
    • A
      license
      D
      quality
      D
      maintenance
      Enables AI agents to access real-time Binance cryptocurrency market data including prices, order books, candlestick charts, trading history, and 24-hour statistics through natural language queries.
      12
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables Claude to query Binance Spot market data, account balances, and execute trades via natural language, with withdrawals disabled by default for security.
      11
      MIT