Bitunix MCP
Enables Claude Code to trade on BitUnix exchange via the MCP protocol, supporting futures and spot trading with advanced order management, leverage, and TP/SL.
README
BitUnix Trading MCP Server
A powerful Model Context Protocol (MCP) server that provides a bridge between Claude Code and the BitUnix Exchange API. It supports both Futures and Spot trading with advanced order management.
✨ Features
📈 Futures Trading
- Order Placement: Market and Limit orders with hedge mode support.
- Leverage & Margin: Set leverage and margin mode (Isolated/Cross) per symbol.
- Position Management: Close positions, flash-close (emergency exit), and monitor PnL.
- Batch Orders: Execute up to 5 orders for the same symbol in a single call.
🛡️ Advanced TP/SL
- Precise Control: Set Take Profit and Stop Loss with specific trigger types (Mark/Last Price).
- Modification Workaround: Includes an internal "Cancel + Re-place" logic to bypass BitUnix API limitations, ensuring reliable TP/SL updates.
💰 Spot Trading & Conversion
- Spot Wallet: Full access to spot balances and trading pairs.
- Auto-Conversion: A unique
convert_currencytool that automates the transfer between Futures and Spot wallets to convert assets (e.g., USDC ↔ USDT) in one step.
🛠️ Installation
Prerequisites
- Node.js: Used for the MCP bridge wrapper.
- Python 3.10+: Used for the core logic (FastMCP).
- BitUnix API Keys: Required for private operations.
Setup
- Open the
.envfile and enter your API keys.- Where to get keys? Log in to your BitUnix account and go to: https://www.bitunix.com/account/apiManagement
- Manual path: Hover over your Profile Icon (top-right) -> Click "API"
- Enter your
BITUNIX_API_KEYandBITUNIX_SECRET_KEYin the file. - Install Python dependencies:
pip install -r requirements.txt
🚀 Usage
Claude Code Configuration
Add the server to your .mcp.json file. Ensure the path to index.js is correct:
{
"mcpServers": {
"bitunix": {
"command": "node",
"args": ["./Bitunix-trading-mcp/index.js"]
}
}
}
Manual Startup (for Testing)
You can start the server manually to verify it's working:
node index.js
Upon startup, the server will output its status to stderr, including the Python path and process ID. It will then wait for MCP JSON-RPC messages on stdin.
Key Tools & Examples
get_account: Check your available balance.place_order: Open a new position.place_tpsl_order: Set protection for an open position.convert_currency: Move and convert funds between wallets.
Example Tool Call (JSON-RPC):
{
"method": "tools/call",
"params": {
"name": "get_account",
"arguments": { "margin_coin": "USDT" }
}
}
⚙️ How it Works (Architecture)
The server uses a dual-layer architecture:
- Node.js Wrapper (
index.js): Acts as the entry point for Claude Code. It searches for a valid Python executable on your system, loads environment variables from.env, and spawns the Python process. - Python Core (
main.py): Uses theFastMCPframework to define and register trading tools. It handles the actual API communication with BitUnix using theBitunixClientclass.
❓ Troubleshooting
1. Python not found
The Node wrapper tries to find python3, python, or py. If it fails, ensure Python is in your system's PATH. You can check what the server is using by looking at the terminal output:
Python: C:\Path\To\python.exe
2. API Errors (Code 2, 10002, etc.)
- Error 10002: Often caused by trying to set leverage/margin inside an order call. The server requires you to set these separately first.
- Error 2: Usually means a required parameter is missing or formatted incorrectly.
3. Connection Issues
Ensure your .env file is in the Bitunix-trading-mcp directory and contains valid keys. The server will output a warning if the .env file cannot be read.
🔒 Security
- Environment Variables: Sensitive keys are loaded from
.envand are excluded from Git via.gitignore. - Hedge Mode: The server defaults to Hedge Mode (separate Long/Short) as required by professional trading standards.
📄 License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。