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.
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
To run the server in standalone mode:
python run_server.py
This will start the MCP server, which will listen for connections via STDIO.
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.
To use this server with Claude Desktop:
pip install "mcp[cli]"
mcp install run_server.py
You can now access Binance data directly within your Claude Desktop conversations.
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.
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"
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)
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.
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.
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"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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