@lmex-official/lmex-mcp-server
v1.0.2
Published
A Model Context Protocol (MCP) server for the LMEX exchange API — full spot and futures trading, market data, wallet management, and more.
Maintainers
Readme
LMEX MCP Server
A Model Context Protocol (MCP) server that exposes the full LMEX exchange API as AI-callable tools — spot trading, futures trading, market data, wallet management, and more.
Works with any MCP client: Claude Desktop, Cursor, Windsurf, and others.
Features
47 tools covering the entire LMEX REST API:
| Category | Tools | |-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| | Spot — Market Data | Market summary, OHLCV, price, orderbook (grouped + L2), trades, server time | | Spot — Trading | Create order (LIMIT/MARKET/OCO/PEG/STOP/TRIGGER), amend order, cancel order, query order, open orders, trade history, fees, dead man's switch | | Spot — Algo | Create PEG (algo) order | | Futures — Market Data | Market summary, OHLCV, price, orderbook (grouped + L2), trades, funding history | | Futures — Trading | Create/amend/cancel/query order, algo order, open orders, trade history, fees, dead man's switch, bind TP/SL, close position | | Futures — Account | Positions, leverage (get/set), risk limit (get/set), position mode (get/set), margin, settlement currency | | Wallet | Futures wallet balance, wallet history, transfer between SPOT/CROSS/ISOLATED wallets |
Quick Start (npx — no install required)
Add to your MCP client config for LIVE trading:
{
"mcpServers": {
"lmex": {
"command": "npx",
"args": ["-y", "@lmex-official/lmex-mcp-server"],
"env": {
"LMEX_API_KEY": "your_api_key",
"LMEX_API_SECRET": "your_api_secret",
"LMEX_TESTNET": "false"
}
}
}
}Add to your MCP client config for TESTNET trading:
{
"mcpServers": {
"lmex": {
"command": "npx",
"args": ["-y", "@lmex-official/lmex-mcp-server"],
"env": {
"LMEX_API_KEY": "your_testnet_api_key",
"LMEX_API_SECRET": "your_testnet_api_secret",
"LMEX_TESTNET": "true"
}
}
}
}
LMEX_TESTNET=false(default) points to productionhttps://api.lmex.io.
SetLMEX_TESTNET=trueto use the testnet athttps://test-api.lmex.io.
Authentication
LMEX uses HMAC-SHA384 signatures. Create your API key at:
- Testnet: https://test.lmex.io → Account → API
- Production: https://lmex.io → Account → API
The signature is computed automatically: HMAC-SHA384(secret, path + nonce + body).
Required permissions
- Public endpoints (market data) — no key needed
- Spot trading —
Tradingpermission - Futures trading —
Tradingpermission - Read endpoints (history, fees, positions) —
Readpermission - Wallet transfers —
Transferpermission
Claude Desktop Config
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
or ~/.claude.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"lmex": {
"command": "npx",
"args": ["-y", "@lmex-official/lmex-mcp-server"],
"env": {
"LMEX_API_KEY": "your_api_key_here",
"LMEX_API_SECRET": "your_api_secret_here",
"LMEX_TESTNET": "false"
}
}
}
}Environment Variables
| Variable | Required | Default | Description |
|-------------------|----------|---------|----------------------------------------|
| LMEX_API_KEY | Yes | — | Your LMEX API key |
| LMEX_API_SECRET | Yes | — | Your LMEX API secret |
| LMEX_TESTNET | No | false | true = testnet, false = production |
Tool Reference
Spot — Market Data (public)
| Tool | Description |
|----------------------------|------------------------------------------------------------------------------------------|
| lmex_spot_market_summary | Market summary for all or one spot market (last price, bid/ask, 24hr stats) |
| lmex_spot_ohlcv | OHLCV candlestick data (resolutions: 1, 5, 15, 30, 60, 240, 360, 1440, 10080, 43200 min) |
| lmex_spot_price | Current index, last, and mark price |
| lmex_spot_orderbook | Grouped L2 orderbook snapshot |
| lmex_spot_orderbook_l2 | Raw L2 orderbook at a given depth |
| lmex_spot_trades | Recent trade fills (max 30-day window) |
| lmex_spot_server_time | Server time in ISO and epoch format |
Spot — Trading
| Tool | Description |
|-------------------------------|-------------------------------------------------------------------|
| lmex_spot_create_order | Create LIMIT, MARKET, OCO, PEG, STOP, or TRIGGER order |
| lmex_spot_amend_order | Amend price, size, trigger price, or all fields |
| lmex_spot_cancel_order | Cancel by orderID, clOrderID, or all orders for a symbol |
| lmex_spot_query_order | Query a specific order by ID |
| lmex_spot_create_algo_order | Create an algo (PEG) order that tracks the index price |
| lmex_spot_cancel_all_after | Dead man's switch — cancel all after a TTL (timeout=0 to disable) |
| lmex_spot_open_orders | List open unfilled orders |
| lmex_spot_trade_history | Historical trade fills |
| lmex_spot_fees | Maker/taker fee schedule |
Futures — Market Data (public)
| Tool | Description |
|--------------------------------|-----------------------------------------------------------------|
| lmex_futures_market_summary | Futures market summary including open interest and funding rate |
| lmex_futures_ohlcv | OHLCV candlestick data |
| lmex_futures_price | Current index, last, and mark price |
| lmex_futures_orderbook | Grouped L2 orderbook |
| lmex_futures_orderbook_l2 | Raw L2 orderbook |
| lmex_futures_trades | Recent trade fills |
| lmex_futures_funding_history | Historical funding rates |
Futures — Trading
| Tool | Description |
|----------------------------------|---------------------------------------------------------------------|
| lmex_futures_create_order | Create LIMIT, MARKET, OCO, PEG, STOP, TRIGGER, or reduce-only order |
| lmex_futures_amend_order | Amend price, size, trigger price, or all fields |
| lmex_futures_cancel_order | Cancel by orderID, clOrderID, or all orders |
| lmex_futures_query_order | Query a specific order |
| lmex_futures_create_algo_order | Create a PEG algo order |
| lmex_futures_cancel_all_after | Dead man's switch |
| lmex_futures_open_orders | List open orders |
| lmex_futures_trade_history | Historical trade fills |
| lmex_futures_fees | Maker/taker fee schedule |
| lmex_futures_bind_tpsl | Bind take-profit and stop-loss to an open position |
| lmex_futures_close_position | Close an open position at market or limit |
Futures — Account
| Tool | Description |
|----------------------------------------|-----------------------------------------------------|
| lmex_futures_positions | Open positions (all or per symbol) |
| lmex_futures_get_leverage | Current leverage and margin mode |
| lmex_futures_set_leverage | Set leverage (requires ONE_WAY mode for simple use) |
| lmex_futures_get_risk_limit | Current risk limit level |
| lmex_futures_set_risk_limit | Set risk limit |
| lmex_futures_get_position_mode | ONE_WAY or HEDGE mode |
| lmex_futures_set_position_mode | Switch between ONE_WAY and HEDGE |
| lmex_futures_get_margin | Wallet margin summary for a symbol |
| lmex_futures_set_settlement_currency | Change settlement currency for a position |
Wallet
| Tool | Description |
|-------------------------------|----------------------------------------------------|
| lmex_futures_wallet | Futures wallet balances (all or by currency) |
| lmex_futures_wallet_history | Wallet transaction history |
| lmex_futures_transfer | Transfer between SPOT, CROSS, and ISOLATED wallets |
Transfer examples
# Move USDT from futures cross wallet to spot:
walletSrcType: "CROSS"
walletDestType: "SPOT"
apiWallets: [{ currency: "USDT", balance: "500" }]
# Move BTC from spot back to futures:
walletSrcType: "SPOT"
walletDestType: "CROSS"
apiWallets: [{ currency: "BTC", balance: "0.01" }]
# Move USDT into isolated BTC-PERP margin:
walletSrcType: "CROSS"
walletDestType: "ISOLATED"
walletDest: "BTC-PERP"
apiWallets: [{ currency: "USDT", balance: "1000" }]Order Types
Spot
| Type | txType | Description |
|----------|-----------|----------------------------------------------------------|
| LIMIT | LIMIT | Standard limit order |
| MARKET | LIMIT | Market order (size = quote spend for BUY) |
| LIMIT | STOP | Stop-loss limit (triggerPrice required) |
| MARKET | STOP | Stop-loss market + optional trailValue for trailing stop |
| MARKET | TRIGGER | Take-profit market |
| OCO | LIMIT | One-Cancels-Other (stopPrice + triggerPrice required) |
| PEG | — | Algo order tracking index by deviation % |
Time-in-Force
GTC · IOC · FOK · HALFMIN · FIVEMIN · HOUR · TWELVEHOUR · DAY · WEEK · MONTH
API Status Codes
| Code | Meaning | |------|----------------------------| | 2 | Order inserted | | 4 | Order fully transacted | | 5 | Order partially transacted | | 6 | Order cancelled | | 9 | Trigger order inserted | | 10 | Trigger order activated | | 123 | Order amended |
Development
git clone https://github.com/LMEXofficial/lmex-mcp-server
cd lmex-mcp-server
npm install
cp .env.example .env
# Fill in LMEX_API_KEY and LMEX_API_SECRET
npm run build # compile TypeScript
npm run dev # run from source with tsx
npm test # unit tests
npx tsx test-live.ts # live testnet end-to-end testsRate Limits
| Category | Per API | Per User | |----------|----------|----------| | Query | 15 req/s | 30 req/s | | Orders | 75 req/s | 75 req/s |
License
MIT — LMEX.io
