The Yubit Exchange MCP Server lets AI assistants query market data, manage funds, check balances across spot, TradFi, and earn accounts, and execute perpetual trades using natural language.
It works with , , , , , and any other AI tool compatible with the protocol.
Yubit exchange MCP Server for market data, wallet, perp trading, and diagnostics
Perp balances, positions, open orders, history, account ledger, plus order placement, safe add-to-position, cancellation, TP/SL, leverage, and position mode
After setup finishes, start a new OpenClaw session for the yubit skill so the MCP server is loaded.
3.2 General Install
# Global npm install
npm install -g @yubit/exchange-skill
yubit setup
# Or npx (no install required)
npx @yubit/exchange-skill setup
The setup wizard automatically detects supported AI tools, configures your API credentials, and registers the MCP server.
During first-time setup, you will be prompted for:
API Key
API Secret
API Base URL
Credentials are stored in ~/.exchange-skill/config.json and shared across all clients. To rotate your keys, run yubit config init.
3.3 Source Install
git clone https://github.com/yubit-exchange/exchange-skill.git
cd exchange-skill
./setup/install.sh
Use this path when running from source or doing local development and debugging.
4. Manual Setup (Optional)
If you prefer not to use yubit setup, or want to control the MCP configuration manually, use the following methods.
Place order (market/limit/conditional). This exchange requires positionIdx: 1=Long, 2=Short
perpAddToPosition
Safely add to an existing position. In separate-position mode, it auto-targets the unique position or requires explicit pzLinkId, then reads back to verify no accidental new sub-position was opened
Pre-validation — symbol, quantity range/step, price range, TP/SL direction, leverage range are validated upfront and rejected if non-compliant
Batch operation protection — perpCancelAllOrders/perpClosePosition by settleCoin requires confirmBatch=true
Separate-position add-to-position protection — perpAddToPosition queries current positions on the server first; in separate-position mode, it auto-targets the unique position or requires explicit pzLinkId, then reads back to verify no accidental new sub-position was opened
Intent routing — documentation and skills route "open new position" and "add to existing position" as two separate paths, reducing the risk of the model misinterpreting "add to position" as "open a new sub-position"
Filled-order-but-no-position troubleshooting — if a market order to open a position is marked Filled but perpGetPositions(symbol) returns empty, first check perpGetOrderHistory + perpGetExecutions + perpGetClosedPnl to determine whether the position was closed by a later reverse order; do not start by guessing about symbol mapping or position delays
Audit log — all calls are logged to .data/audit.log (JSON Lines), with sensitive information automatically redacted
Trace records — each call is recorded to .data/trace-records.jsonl, including raw HTTP request/response, retained for 7 days / max 1000 entries
Centralized credential management — ~/.exchange-skill/config.json; client configs do not contain API Key
8.1 Troubleshooting: Filled Order but No Open Position
If a market order to open a position succeeds and an execution is recorded, but the subsequent position query is empty, follow this sequence:
perpGetOrderHistory(symbol, orderId): Confirm open order status is Filled
perpGetExecutions(symbol, orderId): Confirm actual fill qty, price, and time
perpGetPositions(symbol): Confirm the position is indeed empty
perpGetClosedPnl(symbol, limit='10'): Check whether a closed-P&L record with the same size and opposite direction appeared within seconds
If needed, use perpGetOrderHistory(symbol, closeOrderId) to check if the close order has reduceOnly=true
Notes:
Values like M1ETHUSDT in order history are usually just the exchange's internal symbol format. They do not mean the position is hidden under a different symbol.
The more common real cause is that the position was already closed by a later close order.
9. Environment Variables
Variable
Default
Description
EXCHANGE_API_KEY
—
API Key
EXCHANGE_API_SECRET
—
API Secret
EXCHANGE_BASE_URL
https://openapi.yubit.com
API base URL
EXCHANGE_TLS_REJECT
true
TLS verification (set false for test environments)
npm test # Unit tests (no network required)
npm run test:smoke # Smoke tests (requires API Key, executes real trades)
npm run test:all # All tests
Smoke tests will place real orders, cancel them, and close positions. Use a dedicated test account.
14. Contributing
New tools should follow the existing naming convention: {product}{Action} camelCase. Product-specific tools get a prefix (perp/spot/tradfi/earn/tapTrading); shared tools have no prefix.
npm test && npm run test:smoke # Must pass after any changes
15. FAQ
Issue
Solution
MCP Server starts with no output
Normal — stdio mode communicates via stdin/stdout
Cannot connect
Run yubit doctor for diagnostics
LobeChat connection failure
Must use Desktop version; use absolute paths
Signature error (401)
Check Key/Secret (yubit config show), verify system clock accuracy
Order rejected
Check quantity range, price range, balance, TP/SL direction