BingX MCP Server
Allows OpenAI Agents SDK to access BingX exchange market data and execute trades through the MCP server.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@BingX MCP Servershow my BTC-USDT account balance"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
BingX MCP Server
Production-ready MCP (Model Context Protocol) server for the BingX cryptocurrency exchange. Enables LLM agents to access BingX market data and execute trades through the official BingX API.
Features
Market Data: Ticker, OHLCV/candles, order book depth, recent trades, funding rate, open interest
Account: Balance, open positions, PnL
Trading: Create/cancel orders, order history, leverage management
Scalping Metrics: Spread, orderbook imbalance, buy/sell delta, volume spike, ATR, RSI, VWAP
Technical Indicators: EMA, SMA, VWAP, RSI, ATR, MACD, Bollinger Bands, Volume Delta, CVD, Momentum, ROC
WebSocket Client: Real-time streams with auto-reconnect
Security: HMAC-SHA256 signature, rate limiting, retry logic, structured logging
Related MCP server: MCP Bitget Trading Server
Architecture
bingx-mcp2/
├── src/
│ ├── api/
│ │ └── client.py # HTTP client with HMAC-SHA256 auth
│ ├── services/
│ │ ├── market.py # Market data service
│ │ ├── account.py # Account/balance service
│ │ ├── trade.py # Trading operations service
│ │ └── indicators.py # Technical indicator calculations
│ ├── tools/
│ │ ├── account_tools.py # Balance, positions MCP tools
│ │ ├── trade_tools.py # Order, leverage MCP tools
│ │ ├── market_tools.py # Ticker, klines, orderbook MCP tools
│ │ └── scalping_tools.py # Indicators, scalping metrics MCP tools
│ ├── models/
│ │ ├── common.py # Shared models
│ │ ├── market.py # Market data Pydantic models
│ │ ├── account.py # Account Pydantic models
│ │ └── trade.py # Trade Pydantic models
│ ├── utils/
│ │ ├── config.py # Environment configuration
│ │ ├── logging.py # Loguru structured logging
│ │ ├── ratelimit.py # Token-bucket rate limiter
│ │ └── retry.py # Exponential backoff retry
│ └── websocket/
│ └── client.py # WebSocket client with auto-reconnect
├── main.py # Entry point
├── requirements.txt
├── .env.example
└── README.mdInstallation
Prerequisites
Python 3.12+
BingX API Key and Secret Key
Setup
# Clone the repository
git clone <repo-url> bingx-mcp2
cd bingx-mcp2
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate # Linux/Mac
# .venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Configure API keys
cp .env.example .env
# Edit .env with your credentialsEnvironment Variables
Create a .env file:
BINGX_API_KEY=your_bingx_api_key
BINGX_SECRET_KEY=your_bingx_secret_key
BINGX_ENV=prod-live # or 'prod-vst' for demo environmentGetting API Keys
Log in to BingX
Navigate to API Management under your user menu
Click Create API
Set permissions: enable Perpetual Futures Trading (at minimum)
Save the API Key and Secret Key securely
Usage
Starting the Server
Stdio transport (default, for Claude Desktop / Cursor):
python main.pySSE transport (for HTTP-based clients, OpenAI Agents SDK):
python main.py --sse --host 0.0.0.0 --port 8000MCP Tools Reference
Tool | Description | Auth |
| Total/available balance, unrealized PnL, per-asset | Yes |
| Open positions with entry price, mark price, liq price | Yes |
| Currently open orders | Yes |
| Historical orders with time/count filters | Yes |
| Create MARKET/LIMIT/STOP/TAKE_PROFIT orders | Yes |
| Cancel order by ID | Yes |
| Cancel all open orders for a symbol | Yes |
| Set leverage (1-125x) | Yes |
| Last price, bid, ask, spread | No |
| OHLCV candlestick data (all intervals) | No |
| Order book depth with imbalance | No |
| Recent public trades | No |
| Open interest | No |
| Funding rate, mark price, index price | No |
| Long/short ratio from trades | No |
| Taker buy/sell volume delta | No |
| EMA, SMA, RSI, MACD, BB, VWAP, ATR, etc. | No |
| Comprehensive scalping snapshot | No |
Order Types Supported
# Market order
create_order(symbol="BTC-USDT", side="BUY", type="MARKET", quantity=0.01)
# Limit order
create_order(symbol="BTC-USDT", side="SELL", type="LIMIT", quantity=0.01, price=100000)
# Stop-loss market
create_order(symbol="BTC-USDT", side="SELL", type="STOP_MARKET", quantity=0.01, stop_price=95000)
# Stop-loss limit
create_order(symbol="BTC-USDT", side="SELL", type="STOP", quantity=0.01, price=94900, stop_price=95000)
# Take-profit market
create_order(symbol="BTC-USDT", side="SELL", type="TAKE_PROFIT_MARKET", quantity=0.01, stop_price=105000)
# Take-profit limit
create_order(symbol="BTC-USDT", side="SELL", type="TAKE_PROFIT", quantity=0.01, price=105100, stop_price=105000)Claude Desktop Integration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"bingx": {
"command": "python",
"args": ["/absolute/path/to/bingx-mcp2/main.py"],
"env": {
"BINGX_API_KEY": "your_api_key",
"BINGX_SECRET_KEY": "your_secret_key"
}
}
}
}Cursor Integration
Add to Cursor's MCP configuration (~/.cursor/mcp.json):
{
"mcpServers": {
"bingx": {
"command": "python",
"args": ["/absolute/path/to/bingx-mcp2/main.py"],
"env": {
"BINGX_API_KEY": "your_api_key",
"BINGX_SECRET_KEY": "your_secret_key"
}
}
}
}OpenAI Agents SDK Integration
Run the server in SSE mode:
python main.py --sse --port 8000Then connect in your agent:
from agents import Agent, Runner
from agents.mcp import MCPServerSse
async def main():
async with MCPServerSse(
name="bingx",
params={
"url": "http://localhost:8000/sse",
},
) as server:
agent = Agent(
name="trading_agent",
instructions="You are a crypto trading assistant with access to BingX market data.",
mcp_servers=[server],
)
result = await Runner.run(agent, "What's the current BTC price and order book imbalance?")
print(result.final_output)Technical Details
API Endpoints Used
Based on the official BingX API documentation:
Category | Endpoint | Method |
Market |
| GET |
Market |
| GET |
Market |
| GET |
Market |
| GET |
Market |
| GET |
Market |
| GET |
Market |
| GET |
Account |
| GET |
Account |
| GET |
Trade |
| POST |
Trade |
| DELETE |
Trade |
| GET |
Trade |
| GET |
Trade |
| DELETE |
Trade |
| POST |
Authentication
Requests are signed using HMAC-SHA256:
Parameters are sorted alphabetically
Query string is built:
param1=value1¶m2=value2&...×tamp=...HMAC-SHA256 signature is computed with the secret key and hex-encoded
Signature is appended:
querystring&signature=...
Rate Limiting
The client enforces BingX API rate limits:
Market data: 500 requests/10 seconds per IP
Account/Trade: 5-10 requests/second
Error Handling
Automatic retry with exponential backoff (max 3 attempts)
Domain fallback (bingx.com -> bingx.pro)
Structured logging to stderr and rotating log files
All errors returned as JSON with descriptive messages
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jools333/bingx-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server