- Home
- MCP servers
- Binance
Binance
- python
16
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"tienan92it-binance-mcp": {
"command": "python",
"args": [
"run_server.py"
],
"env": {
"YOUR_TOKEN": "<YOUR_TOKEN>"
}
}
}
}You can query Binance market data from an MCP server designed for use with LLM agents. It exposes live prices, order books, historical OHLCV data, real-time WebSocket streams, and comprehensive market information through a clean, read-only interface. This enables your AI tools to fetch up-to-date market data and exchange metadata without handling authentication or raw API calls directly.
How to use
Run the server locally and connect your MCP client to access a wide range of market data endpoints. You can use the simple REST-based queries for current prices, order books, OHLCV data, and exchange information, and you can subscribe to real-time streams to receive live updates. All data is fetched from public sources and exposed via the MCP-compliant interface, so you don’t need API keys.
How to install
# Prerequisites
- Python 3.8+
- pip
- OPTIONAL: MCP CLI tools (for development workflows)
# 1) Clone the project
git clone https://github.com/yourusername/binance_mcp_server.git
cd binance_mcp_server
# 2) Install dependencies
pip install -r requirements.txt
Optional development workflow using MCP Inspector is supported to test tools interactively. You can run the server in development mode with the MCP CLI and the inspector interface.
Configuration and running the server
The server provides a straightforward way to run in standard or development mode. Use the following commands to start the MCP server locally. The default standalone mode listens via STDIO.
python run_server.py
For development and testing, you can open the MCP Inspector to test tools interactively.
mcp dev run_server.py
Example client usage
You can connect programmatically to retrieve market data. For example, fetch the current price for a trading pair, or obtain 24-hour statistics and rolling window data. These calls illustrate the kinds of data you can request through the MCP interface.
Security and deployment notes
This server is read-only and uses public Binance endpoints. If you deploy it publicly, consider standard hardening practices for any service that exposes data through an MCP interface. Monitor usage to avoid excessive requests that could trigger rate limits.
Troubleshooting
Common issues include ensuring the server is running before attempting to connect, handling WebSocket reconnections if connections drop, and managing data formats for symbols and intervals which may vary slightly across endpoints.
Available tools
ping_binance
Test connectivity to the Binance API server
get_server_time
Get the current server time from Binance
get_price
Get the current price for a trading symbol like BTCUSDT
get_order_book
Retrieve the current order book for a symbol with a specified depth
get_historical_prices
Fetch OHLCV candlestick data for a symbol and interval
get_ui_klines
Get UI-optimized candlestick data for charting
get_recent_trades
Obtain the most recent trades for a symbol
get_historical_trades
Fetch older trades for a symbol using from_id or pagination
get_aggregate_trades
Retrieve compressed/aggregate trades for a symbol
get_24hr_ticker
Get 24-hour price change statistics for a symbol
get_all_24hr_tickers
Get 24-hour statistics for all symbols
get_trading_day_ticker
Get trading day price change statistics for a symbol
get_all_trading_day_tickers
Get trading day statistics for all symbols
get_rolling_window_ticker
Get rolling window price statistics for a symbol
get_all_rolling_window_tickers
Get rolling window statistics for all symbols
get_average_price
Get the current 5-minute weighted average price for a symbol
get_book_ticker
Get best bid/ask prices and quantities for a symbol
get_all_book_tickers
Get best bid/ask prices for all symbols
get_exchange_info
Get comprehensive exchange information including rules and symbol list
get_trading_fees
Get default trading fee rates (public demonstration)
subscribe_to_trade_stream
Subscribe to real-time trade events for a symbol
subscribe_to_kline_stream
Subscribe to candlestick/kline updates for a symbol and interval
subscribe_to_ticker_stream
Subscribe to 24-hour ticker updates for a symbol
subscribe_to_book_ticker_stream
Subscribe to best bid/ask updates for a symbol
subscribe_to_depth_stream
Subscribe to order book updates for a symbol and depth levels
list_active_subscriptions
List all active WebSocket subscriptions
get_latest_stream_data
Fetch the latest data from a specific stream
unsubscribe_from_stream
Unsubscribe from a WebSocket stream
cleanup_all_streams
Close all WebSocket connections and clean up resources