Provides seamless access to Binance exchange API functionality, including real-time market data (prices, order books, candlestick data), account management (balances, orders), and trading operations (placing and canceling orders).
Binance MCP Server
多语言文档 / Multi-language Documentation
A comprehensive Model Context Protocol (MCP) server that provides Claude Code with seamless access to Binance exchange API functionality.
Features
- Market Data Tools: Get real-time prices, order book depth, K-line data, and 24-hour statistics
- Account Management: View account information, balances, open orders, and order history
- Trading Operations: Place orders, cancel orders (testnet only)
- Full TypeScript Support: Complete type definitions and validation
- Security First: Environment-based configuration with input validation
- Error Handling: Comprehensive error handling with sanitized logging
Quick Start
Installation
Configuration
- Copy the environment template:
- Configure your Binance API credentials in
.env
:
Running the Server
Development mode:
Production build:
Available Tools
Market Data Tools
get_price
Get current price for a trading pair.
get_orderbook
Get order book depth data.
get_klines
Get K-line/candlestick data.
get_24hr_ticker
Get 24-hour price change statistics.
Account Tools
get_account_info
Get account information and balances.
get_open_orders
Get current open orders.
get_order_history
Get historical orders.
Trading Tools (Testnet Only)
place_order
Place a new order.
cancel_order
Cancel a specific order.
cancel_all_orders
Cancel all open orders for a symbol.
Claude Code Integration
Configuration
Add the following to your Claude Code MCP configuration:
Usage Examples
Ask Claude to:
- "Get the current price of Bitcoin"
- "Show me the order book for ETHUSDT"
- "Get 1-hour candlestick data for BTCUSDT"
- "Check my account balance"
- "Place a limit buy order for 0.001 BTC at $50,000"
Security
Important Security Notes
- API Keys: Never commit API keys to version control
- Testnet Only: Trading functions only work with
BINANCE_TESTNET=true
- Input Validation: All inputs are validated using Zod schemas
- Error Sanitization: Sensitive information is removed from error logs
Environment Variables
Variable | Required | Description |
---|---|---|
BINANCE_API_KEY | Yes | Your Binance API key |
BINANCE_API_SECRET | Yes | Your Binance API secret |
BINANCE_TESTNET | No | Enable testnet mode (default: false) |
MCP_SERVER_NAME | No | Server name (default: binance-mcp-server) |
MCP_SERVER_VERSION | No | Server version (default: 1.0.0) |
LOG_LEVEL | No | Logging level (default: info) |
Development
Project Structure
Scripts
npm run build
- Compile TypeScript to JavaScriptnpm run dev
- Run in development mode with hot reloadnpm run start
- Run the compiled servernpm run lint
- Run ESLintnpm run typecheck
- Run TypeScript type checking
Adding New Tools
- Define input schema in
src/types/mcp.ts
- Create tool implementation in appropriate file under
src/tools/
- Export from
src/tools/index.ts
- Update documentation
Troubleshooting
Common Issues
- API Connection Failed
- Verify API credentials are correct
- Check network connectivity
- Ensure testnet flag matches your API key type
- Permission Denied
- Verify API key has required permissions
- Check if IP is whitelisted on Binance
- Invalid Symbol
- Use correct symbol format (e.g., BTCUSDT, not BTC/USDT)
- Verify symbol exists on Binance
- Trading Disabled
- Set
BINANCE_TESTNET=true
for trading functions - Verify testnet API credentials
- Set
Debug Mode
Set LOG_LEVEL=debug
for detailed logging:
API Rate Limits
The server respects Binance API rate limits:
- Market data: 1200 requests per minute
- Account data: 180 requests per minute
- Orders: 10 orders per second, 100,000 orders per 24 hours
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Update documentation
- Submit a pull request
License
MIT License - see LICENSE file for details
Support
For issues and questions:
- Check the troubleshooting section
- Review Binance API documentation
- Open an issue on GitHub
Disclaimer
This software is for educational and development purposes. Use at your own risk. Always test with testnet before using real funds.
This server cannot be installed
A Model Context Protocol server that provides Claude Code with seamless access to Binance exchange API functionality for market data retrieval, account management, and trading operations.
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server that allows Claude to interact with Linear's API for managing teams, issues, projects, and cycles.Last updated -301TypeScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server that allows Claude to make API requests on your behalf, providing tools for testing various APIs including HTTP requests and OpenAI integrations without sharing your API keys in the chat.Last updated -Python
- AsecurityAlicenseAqualityAn implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.Last updated -886JavaScriptMIT License
- -securityAlicense-qualityA Model Context Protocol server that exposes Binance cryptocurrency exchange data to LLMs, allowing agents to access real-time prices, order books, and historical market data without requiring API keys.Last updated -4PythonMIT License