Binance MCP server

Integrates with Binance cryptocurrency exchange to provide real-time market data including prices, order books, and historical information without requiring API keys
Back to servers
Setup instructions
Provider
Tien An
Release date
Mar 28, 2025
Language
Python
Stats
11 stars

Binance MCP Server allows Large Language Model (LLM) agents to access real-time and historical cryptocurrency market data from Binance through a standardized Model Context Protocol (MCP) interface. This server provides LLMs with the ability to fetch current prices, order book information, historical data, and exchange details without requiring API keys.

Features

  • Live Price Data: Get current prices for any trading pair on Binance
  • Order Book Access: Retrieve order book snapshots showing buy/sell interest at different price levels
  • Historical Price Data: Fetch OHLCV (Open, High, Low, Close, Volume) candlestick data for any timeframe
  • Exchange Information: Access trading rules, symbol information, and fee structures
  • Read-only Operation: All data is fetched via Binance's public REST API (no API keys required)
  • MCP Standard Compliant: Works with any MCP-compatible LLM client

Requirements

  • Python 3.8+
  • mcp package with CLI tools (mcp[cli])
  • requests library

Installation

First, clone the repository:

git clone https://github.com/yourusername/binance_mcp_server.git
cd binance_mcp_server

Then install the dependencies:

pip install -r requirements.txt

Usage

Running the Server Directly

To run the server in standalone mode:

python run_server.py

This will start the MCP server, which will listen for connections via STDIO.

Development Mode with MCP Inspector

For development and testing, use the MCP Inspector:

mcp dev run_server.py

This opens the MCP Inspector interface where you can test the server's tools interactively.

Installing in Claude Desktop

To use this server with Claude Desktop:

  1. Install the MCP CLI tools if you haven't already:
pip install "mcp[cli]"
  1. Install the server in Claude Desktop:
mcp install run_server.py

You can now access Binance data directly within your Claude Desktop conversations.

Example Client

An example client script is provided to demonstrate programmatic usage:

python example_client.py

This script connects to the server and retrieves various types of market data.

Available Tools

Market Data

  • get_price(symbol): Get the current price for a trading pair

    Example: get_price(symbol="BTCUSDT")

  • get_order_book(symbol, depth=10): Get the current order book

    Example: get_order_book(symbol="ETHUSDT", depth=5)

  • get_historical_prices(symbol, interval="1d", limit=100): Get historical OHLCV data

    Example: get_historical_prices(symbol="BTCUSDT", interval="1h", limit=24)

    Valid intervals: "1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h", "1d", "3d", "1w", "1M"

Market Info

  • get_exchange_info(): Get comprehensive exchange information including trading rules and symbol list

  • get_trading_fees(): Get the default trading fee rates (note: returns default public fees)

Troubleshooting

  • Connection Issues: Ensure the server is running before attempting to connect with a client
  • Rate Limiting: Binance may rate-limit excessive API calls; consider implementing caching for high-traffic deployments
  • Data Format: Different symbols or intervals may return data in slightly different formats

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "binance" '{"command":"python","args":["run_server.py"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "binance": {
            "command": "python",
            "args": [
                "run_server.py"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "binance": {
            "command": "python",
            "args": [
                "run_server.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later