Skip to main content
Glama
@cexyio/mcp

@cexyio/mcp

by cexyio

@cexyio/mcp

The official Model Context Protocol server for the CEXY.io exchange. It lets an AI assistant (Claude Code, Claude Desktop, or any MCP client) read market data and, with your API key, your balances, orders and history.

  • Read-only by default. Trading tools do not exist unless you turn them on.

  • It never moves funds. There are no withdrawal, transfer or deposit-address tools, and CEXY API keys cannot withdraw anyway.

  • Runs locally over stdio. It opens no network port.

  • Built on the official TypeScript SDK, @cexyio/cexy.

Status: 0.x prerelease. Tool names and outputs may still change. Pre-release: npx -y @cexyio/mcp@next; latest currently points at a pre-release until 1.0.

Install

It needs Node.js 22 or newer. Nothing to install globally: MCP clients start it with npx.

Claude Code

Public market data only (no key):

claude mcp add cexy -- npx -y @cexyio/mcp

With your account (read-only key):

claude mcp add cexy \
  -e CEXY_API_KEY=ak_your_key_here \
  -e CEXY_API_SECRET=your_secret_here \
  -- npx -y @cexyio/mcp

With trading enabled and guardrails (see Safety first):

claude mcp add cexy \
  -e CEXY_API_KEY=ak_your_key_here \
  -e CEXY_API_SECRET=your_secret_here \
  -e CEXY_MCP_ENABLE_TRADING=true \
  -e CEXY_MCP_MAX_ORDER_NOTIONAL=100 \
  -e CEXY_MCP_ALLOWED_MARKETS=BTC/USDT,ETH/USDT \
  -- npx -y @cexyio/mcp

Claude Desktop

Add this to claude_desktop_config.json (Settings, Developer, Edit Config) and restart Claude Desktop:

{
  "mcpServers": {
    "cexy": {
      "command": "npx",
      "args": ["-y", "@cexyio/mcp"],
      "env": {
        "CEXY_API_KEY": "ak_your_key_here",
        "CEXY_API_SECRET": "your_secret_here"
      }
    }
  }
}

Leave out the env block for public data only. Add "CEXY_MCP_ENABLE_TRADING": "true" (and the guardrails) only if you want the assistant to place orders.

Other MCP clients

Run npx -y @cexyio/mcp as a stdio server and pass the configuration as environment variables.

Related MCP server: okx-trade-mcp

Configuration

Variable

Default

Meaning

CEXY_API_KEY

unset

API key id (ak_...). Optional; must be set together with the secret.

CEXY_API_SECRET

unset

API key secret. Optional; must be set together with the key. It is used only to sign requests locally and is never sent.

CEXY_BASE_URL

https://api.cexy.io

API base URL. Must be https://.

CEXY_ALLOW_INSECURE

unset

true allows an http:// base URL, and only for localhost, 127.0.0.1 or ::1 (local development).

CEXY_MCP_ENABLE_TRADING

false

Exactly true registers the trading tools (needs a key with the trade scope). Any other value, including 1, yes and TRUE, leaves trading off.

CEXY_MCP_MAX_ORDER_NOTIONAL

unset

Per-order cap, in the market's quote currency (e.g. 100 = 100 USDT on BTC/USDT).

CEXY_MCP_ALLOWED_MARKETS

unset (all)

Comma-separated markets place_order may trade and cancel_orders may cancel in, e.g. BTC/USDT,ETH/USDT. cancel_order (one order) and cancel_all_orders (one named market) do not check it: cancelling only reduces exposure.

CEXY_MCP_LOG_LEVEL

info

debug, info, warn or error. Logs go to stderr only.

The server refuses to start when only one of the key and the secret is set, when the base URL is not https:// (outside the loopback exception above), or when CEXY_MCP_ENABLE_TRADING has an unrecognised value such as tru. It never echoes either of them in tool output, errors or logs.

Tools

Every read tool is annotated readOnlyHint: true and openWorldHint: true. The trading tools are annotated destructiveHint: true.

Public (always available, no key):

Tool

What it returns

get_server_status

Server time and clock skew, maintenance state, page sizes, candle intervals, and this server's own settings

list_markets

Markets with a compact ticker; filters quote, status, search; limit (default 20, max 50), offset

get_market

One market's trading rules (tick/lot size, minimums, order types) and 24h ticker

get_ticker

Compact 24h ticker for one market

get_orderbook

Order-book snapshot, depth 1-50 (default 10)

get_recent_trades

Recent public trades; limit, cursor, direction

get_candles

OHLCV rows; interval, from/to (ISO 8601), limit (default 50, max 200)

list_assets

Assets and, per network, deposit/withdrawal status, maintenance, minimums and fees

get_fees

Maker/taker fee tiers

Read key (registered only when CEXY_API_KEY and CEXY_API_SECRET are set; the key needs the read scope):

Tool

What it returns

get_balances

Balances per asset (with held_incoming, already part of locked); zero balances hidden unless include_zero: true

get_sub_account_balances

Balances of one of your sub-accounts, by id (parent account only; NOT_FOUND for any other id)

list_open_orders

Your open orders; optional symbol, status

get_order

One order, by order_id or client_order_id

get_order_history

Your orders, paged with cursor, limit, direction

get_my_trades

Your fills, paged

list_deposits

Your deposit history, paged (read only)

list_withdrawals

Your withdrawal history, paged (read only)

get_ledger

Every balance change, paged

Trade (registered only when CEXY_MCP_ENABLE_TRADING=true and a key is set; the key needs the trade scope):

Tool

What it does

place_order

Places a real order. Always sends a client_order_id (a UUID, generated if not given) and returns the resulting order state and fills. Never re-sends. If the outcome is ambiguous (network error, timeout, 5xx), the error is retryable: false, carries the client_order_id, and tells the assistant to call get_order with it before doing anything else.

cancel_order

Cancels one order, by order_id or client_order_id (one request either way)

cancel_orders

Cancels up to 20 orders in one request, each by order_id or client_order_id. Each entry gets its own result (cancelled, failed with the reason, or recovered/unknown after a lost answer). With CEXY_MCP_ALLOWED_MARKETS set, every entry's market is checked first and the whole call is refused if any entry is outside the list or cannot be checked.

cancel_all_orders

Cancels your open orders in one market. symbol is required; there is no account-wide cancel.

Never available: withdrawals, transfers (including sub-account transfers), any other sub-account action (reading a sub-account's balances is the only one), liquidity-pool join/exit, deposit-address lookup (the API creates an address on first use), API-key management, login/2FA, exports and any admin function. A test asserts that none of these ever appear.

Output

Results are compact JSON (structuredContent), plus a text block with a one-line summary followed by the same JSON, for clients that read only text. Amounts are decimal strings (never floats) and timestamps are ISO 8601. Lists default to 10-50 items; paged tools return next_cursor (or next_offset) to fetch more. No result is larger than about 20 KB: longer lists are trimmed and marked truncated: true with a note.

Errors come back as MCP tool errors with a structured body:

{ "error": { "code": "FORBIDDEN", "message": "...", "retryable": false, "request_id": "..." } }

code is the API error code (e.g. INSUFFICIENT_FUNDS, RATE_LIMITED), or one of this server's: GUARDRAIL_REJECTED, INVALID_INPUT, TIMEOUT, CONNECTION_ERROR, ORDER_STATE_UNKNOWN, INTERNAL_ERROR. Quote the request_id when you contact support.

Safety

  • Read-only by default. Without CEXY_MCP_ENABLE_TRADING=true the trading tools are not registered at all, so the assistant cannot see or call them.

  • Use a read-only key unless you want trading. Create the key with only the read scope and restrict it to your IP address with allowed_ips.

  • Trading is opt-in, with caps. If you enable it, also set CEXY_MCP_MAX_ORDER_NOTIONAL and CEXY_MCP_ALLOWED_MARKETS. With a notional cap set, place_order refuses any order whose value it cannot bound: limit buys use price x quantity, limit sells use the higher of the price and the best bid, market buys are priced by walking the current asks (or use quote_quantity, a budget that includes the taker fee), market sells use the best bid, and stop orders whose fill price depends on a future book are refused. The check is made against the book at the time of the call; fast markets can move.

  • Orders are real and irreversible once filled. Ask your assistant to confirm each order with you; most MCP clients also ask for approval before calling a tool marked destructive.

  • No withdrawal tools exist, and CEXY API keys cannot withdraw or transfer funds anyway.

  • The server runs locally over stdio, opens no port and sends no telemetry.

Rate limits

The exchange allows about 120 requests per minute per IP without a key, and about 600 per minute per API key. The SDK underneath throttles itself below that (100/min without a key, 300/min with one) and adapts to the server's X-RateLimit-* headers. Most tools make one request; get_server_status and list_assets make two, and place_order with a notional cap may read the order book first. A RATE_LIMITED error includes retry_after_ms.

Development

npm install
npm run lint && npm run typecheck && npm test
npm run build            # dist/cli.js (the bin) and dist/index.js
npm run test:live        # opt-in: a few unauthenticated GETs to api.cexy.io

The server depends on the published SDK, pinned to an exact version (@cexyio/cexy 0.1.0-dev.19).

Security

See SECURITY.md. Never paste real API keys or secrets into issues.

License

MIT, see LICENSE.

Available Tools

9 tools
get_candlesCandles (OHLCV)A
Read-onlyIdempotent

OHLCV candles for one market, returned as rows of [open_time, open, high, low, close, volume]. Use from/to (ISO 8601) to pick a window; the count is capped at 200.

Inputs: symbol (required), interval (required), to, from, +1 more.

get_feesTrading feesA
Read-onlyIdempotent

The trading fee schedule: maker and taker rates (percent) by 30-day USD volume tier.

Inputs: no named parameters.

get_marketMarket detailsB
Read-onlyIdempotent

Full details of one market: trading rules (tick size, lot size, min/max quantity, min notional, decimals, supported order types and time-in-force) and its 24h ticker.

Inputs: symbol (required).

get_orderbookOrder bookA
Read-onlyIdempotent

Order-book snapshot for one market, aggregated by price: bids and asks as [price, quantity] pairs, best first.

Inputs: symbol (required), depth.

get_recent_tradesRecent tradesB
Read-onlyIdempotent

Recent public trades in one market (price, quantity, taker side, time), newest first by default.

Inputs: symbol (required), limit, cursor, direction.

get_server_statusExchange statusA
Read-onlyIdempotent

CEXY.io server time, maintenance state, API limits (page sizes, candle intervals) and this MCP server's own configuration (authenticated or not, trading enabled or not, guardrails). Call this first when unsure what is available.

Inputs: no named parameters.

get_tickerTickerA
Read-onlyIdempotent

Compact 24h ticker for one market: last price, best bid/ask, 24h change, high, low and volume.

Inputs: symbol (required).

list_assetsAssets and networksA
Read-onlyIdempotent

Assets listed on CEXY.io with, for each network, whether deposits and withdrawals are enabled, whether deposit detection is operational, any maintenance, minimums and the withdrawal fee.

Inputs: asset, limit, offset.

list_marketsList marketsA
Read-onlyIdempotent

Lists CEXY.io spot markets with a compact ticker (last price, 24h change, 24h quote volume, best bid/ask). Filter by quote asset, status or search text; page with offset.

Inputs: limit, quote, offset, search, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 9 tools

    Disambiguation5/5

    Each tool targets a distinct data type (trades, ticker, orderbook, server status, market list, market details, candles, assets, fees). The only overlap is that get_market and list_markets include ticker data, but descriptions clearly differentiate scope, so an agent can reliably choose the right tool.

    Naming Consistency5/5

    All tools follow a consistent snake_case verb_noun pattern: get_* for single-resource data and list_* for collections. There are no naming deviations or mixed conventions.

    Tool Count5/5

    Nine tools is well-scoped for a market data server, covering all major public data types without bloat. Each tool has a clear, non-redundant role.

    Completeness4/5

    The surface covers markets, assets, ticker, orderbook, recent trades, candles, fees, and server status, which is comprehensive for public market data. However, notable gaps exist: get_candles lacks an interval parameter (despite server status mentioning candle intervals), there is no single-asset lookup, and no historical trades beyond the most recent.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Provides a comprehensive suite of 20 tools for cryptocurrency trading and technical analysis across 100+ exchanges like Binance and MEXC via CCXT. It enables users to execute orders, track positions, and scan for market opportunities through Claude Desktop using natural language.
      20
      37 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with OKX cryptocurrency exchange, providing tools for market data, trading, account management, and more through the Model Context Protocol.
      117
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables LLM agents to access BingX cryptocurrency exchange market data and execute trades through the official API, with support for account management, order creation, and technical indicators.
      -