Provides comprehensive access to Binance Futures API endpoints, including trading operations, account management, market data retrieval, risk management, and trading history analysis. Features 41 trading tools for placing/managing orders, monitoring positions, retrieving market data, and accessing trading history.
Binance MCP Server
A Model Context Protocol (MCP) server that provides comprehensive access to Binance Futures API endpoints. This server implements all major trading, account management, and market data functionality as documented in the Binance Futures API.
📋 Table of Contents
- 🚀 Quick Start
- ✨ Features
- 📦 Installation
- ⚙️ Configuration
- 🛠️ Available Tools
- 💡 Example Usage
- 🔒 Security
- 📚 API Reference
- 🔧 Development
- ❗ Error Codes
- 🤝 Contributing
- 📄 License
- ⚠️ Disclaimer
- 💬 Support
🚀 Quick Start
- Install the package:
- Run the server:
- Configure in your MCP client (see Configuration section for detailed setup)
✨ Features
- 17 essential trading tools across 2 categories (Account Information and Market Data)
- Smart ticker data caching with 5-minute refresh cycle
- Proper authentication handling (rejects unauthenticated requests)
- Active symbol filtering (excludes delisted tokens)
- Error handling and graceful degradation
- Real-time market data access
- Complete order management suite
- Risk management tools
📦 Installation
Option 1: PyPI Installation (Recommended)
Install the package from PyPI:
Option 2: Docker Deployment
For containerized deployment:
Docker Compose (Optional)
Create a docker-compose.yml
:
Then run:
Development Installation
For development, you can install from source:
⚙️ Configuration
API Requirements
Your Binance API key needs the following permissions:
- Futures Trading: For order placement and management
- Futures Reading: For account and market data access
MCP Client Setup
This server can be integrated with various MCP clients. Here are configuration examples:
VS Code
Add to your VS Code settings.json
:
Cursor
Add to your Cursor configuration file (.cursor/mcp.json
):
Windsurf
Add to your Windsurf configuration (.windsurf/mcp.json
):
Claude Desktop
Add to your Claude Desktop configuration file:
On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
Configuration Notes
- No path needed: With PyPI installation, you don't need to specify paths or working directories
- Set API credentials: Replace
your_api_key
andyour_secret_key
with your actual Binance API credentials - Alternative commands: You can also use
uvx binance_futures_mcp
orpython -m binance_mcp
- Security: For production use, consider storing credentials in environment variables
🛠️ Available Tools
The server provides 17 essential tools organized into the following categories:
Account Information
(5 tools)
get_account_info
- Get account informationget_balance
- Get account balanceget_position_info
- Get position informationget_position_mode
- Get position mode (Hedge vs. One-way)get_commission_rate
- Get commission rate
Market Data
(12 tools)
get_exchange_info
- Get exchange trading rulesget_book_ticker
- Get best price/qty on the order bookget_price_ticker
- Get latest price for a symbolget_24hr_ticker
- Get 24hr price change statisticsget_top_gainers_losers
- Get top gainers and losersget_market_overview
- Get overall market statisticsget_order_book
- Get order book depthget_klines
- Get candlestick dataget_mark_price
- Get mark price and funding rateget_aggregate_trades
- Get compressed/aggregate trades listget_funding_rate_history
- Get funding rate historyget_taker_buy_sell_volume
- Get taker buy/sell volume ratio
💡 Example Usage
Place a Market Order
Place a Limit Order
Get Account Information
Get Market Data
Get 24hr Price Statistics
Get Taker Buy/Sell Volume Ratio
🔒 Security
API Key Security
🔐 Your Binance API key and secret remain completely local to your computer. The MCP server runs entirely on your machine; neither the package author nor any third-party remote service can access your credentials.
Key Security Points:
- ✅ Store credentials in environment variables (recommended) or local config files
- ✅ Keys are never transmitted unless you publish them
- ❌ Never commit credentials to version control
- ❌ Never share screenshots/logs containing credentials
- ✅ Use API keys with minimal required permissions
- ✅ IP-whitelist your keys when possible
- ✅ Consider using Binance Testnet for development
How It Works:
- Local Launch: Your editor/terminal launches the MCP server locally:
- Keys Stay Local: Your credentials exist only:
- In your environment variables or local config file
- On your computer's command line/process table
- In MCP process memory during HTTPS calls to Binance
- No Telemetry: The package contains zero telemetry or analytics code
Rate Limiting & Error Handling
- ⚡ Respects Binance's weight-based rate limits
- 🔄 Automatic order placement rate limiting
- 🔐 Automatic HMAC SHA256 signature generation
- 🛡️ Comprehensive error handling with clear messages
- ✅ Parameter validation before API calls
📚 API Reference
This server implements all endpoints documented in the Binance Futures API:
- Base URL:
https://fapi.binance.com
- API Type: Binance USD-S Margined Futures
- Authentication: API Key + HMAC SHA256 Signature
- Rate Limits: Respected automatically
For detailed parameter specifications, see the Binance Futures API Documentation.
🔧 Development
Project Structure
Architecture Overview
- Modular Design: Separated concerns across multiple components
- Smart Caching: 5-minute ticker cache with background refresh
- Authentication: Secure API key handling with environment variables
- Error Handling: Graceful degradation and comprehensive error management
- Active Symbol Filtering: Excludes delisted tokens automatically
Running Tests
Code Formatting
❗ Error Codes
Common Binance API error codes you might encounter:
Code | Description |
---|---|
-1121 | Invalid symbol |
-2019 | Margin is insufficient |
-1116 | Invalid orderType |
-1013 | Filter failure (PRICE_FILTER, LOT_SIZE, etc.) |
-1102 | Mandatory parameter was not sent |
-1003 | Too many requests (rate limit exceeded) |
For a complete list, see the Binance API Error Codes.
🤝 Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
📄 License
MIT License - see LICENSE file for details.
⚠️ Disclaimer
⚠️ IMPORTANT: This software is for educational and development purposes. Trading cryptocurrencies involves substantial risk. Use at your own risk and never trade with money you cannot afford to lose.
💬 Support
For issues and questions:
- Check the Binance API Documentation
- Review the error codes in the API documentation
- Ensure your API credentials have the correct permissions
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Comprehensive Binance Futures trading MCP server with professional trading tools across account management, order execution, market data, and risk management. Features smart ticker caching, secure authentication, and Docker support for seamless integration with MCP clients.
Related MCP Servers
- -securityFlicense-qualityAn MCP server that exposes the XTB trading API, allowing users to interact with their XTB trading accounts through the Model Context Protocol to perform operations like account management, market data retrieval, and trade execution.Last updated -6TypeScript
Armor Crypto MCPofficial
AsecurityAlicenseAqualityAn MCP server providing unified access to blockchain operations, bridging, swapping, and crypto trading strategies for AI agents.Last updated -20141PythonGPL 3.0- -securityAlicense-qualityAn MCP server that integrates with the Freqtrade cryptocurrency trading bot.Last updated -16PythonMIT License
- AsecurityFlicenseAqualityA Model Control Protocol (MCP) server that provides cryptocurrency trading interfaces for Binance exchange, enabling functions like real-time price fetching, account balance queries, order placement/cancellation, and automated arbitrage strategies.Last updated -9Python