# CCXT MCP server

> Connect AI agents to over 100 cryptocurrency exchanges and prediction markets for market data, account management, and trading.

- Repository: https://github.com/ccxt/ccxt
- Page: https://hostedmcp.org/servers/ccxt/ccxt-mcp
- Official: yes
- Transport: stdio
- Stars: 44888
- License: MIT
- Latest version: 0.1.3

## Install

### Claude Code

```sh
claude mcp add ccxt-mcp -- npx -y ccxt-mcp
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "ccxt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "ccxt-mcp"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "ccxt-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "ccxt-mcp"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"ccxt-mcp","type":"stdio","command":"npx","args":["-y","ccxt-mcp"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "ccxt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "ccxt-mcp"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add ccxt-mcp -- npx -y ccxt-mcp
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.ccxt-mcp]
command = "npx"
args = ["-y", "ccxt-mcp"]
```

### Gemini CLI

```sh
gemini mcp add -s user ccxt-mcp npx -- -y ccxt-mcp
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "ccxt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "ccxt-mcp"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `BINANCE_APIKEY` | no | no |  |
| `BINANCE_SECRET` | no | no |  |

## Tools (32)

- `list_exchanges`: List every exchange this server supports (built from ccxt.exchanges at runtime), with name, websocket and prediction-market availability. Filter by a name query or by support for a unified method. (read-only)
- `describe_exchange`: One exchange's supported unified methods, market types, timeframes, required credential fields, sandbox availability and documentation URLs. Per-method detail lives in describe_method. (read-only)
- `describe_method`: Search unified method names by keyword, or get one method's signature and parameter documentation. With "exchange" it adds that exchange's own docs (including supported params.* keys and links to the exchange API reference), per-market-type feature support, and searches its implicit (exchange-specific) endpoints too. Full ccxt manual: https://docs.ccxt.com/ (read-only)
- `search_markets`: Search and filter the markets of one exchange (by text, base, quote, settle currency, market type), paginated. Use this to resolve unified symbols — there is deliberately no list-all-markets tool. On prediction exchanges use search_events instead. (read-only)
- `get_tickers`: 24h price tickers for one or more unified symbols on an exchange (outcome handles on prediction exchanges). (read-only)
- `get_orderbook`: Current order book (bids and asks) for one unified symbol. (read-only)
- `get_ohlcv`: Historical OHLCV candlestick data for a symbol and timeframe. Rows are [timestampMs, open, high, low, close, volume]. Page back with "since"; "params.until" bounds the end. (read-only)
- `get_trades`: Recent public trades for one unified symbol. (read-only)
- `search_events`: Search events on a prediction-market exchange (polymarket, kalshi, limitless, myriad, hyperliquid with prediction=true). A scoping filter is required: query, tags, or params.eventId/params.slug. Returns events with their markets and outcome handles — outcome handles are what you pass as the symbol to get_tickers/get_orderbook/create_order on prediction exchanges. (read-only)
- `call_read_method`: Escape hatch covering every unified read method not served by a dedicated tool (fetchFundingRate, fetchLedger, fetchOpenInterest, fetchLiquidations, fetchEvent, fetchSettlements, …). Only fetch*/load* methods are accepted — writes are structurally rejected. Get the signature first with describe_method. Docs: https://docs.ccxt.com/ (read-only)
- `call_implicit_get`: Call an exchange-specific implicit REST endpoint over HTTP GET, for data the unified API does not cover. Pass the implicit method name in the "method" argument (e.g. "publicGetTickerPrice"); these are exchange-specific — find them with describe_method {"query": ..., "exchange": ...} (its results list the name to pass here). The response is the raw exchange payload. Consult the exchange API reference (describe_exchange .urls.doc) and the ccxt manual: https://docs.ccxt.com/ (read-only)
- `get_safety_status`: What this server is currently allowed to do: configured accounts (names only — never credentials), enabled capability tiers, caps, sandbox/live environments, journal location, unresolved order intents, and any configuration problems. (read-only)
- `watch_subscribe`: Open a background WebSocket subscription to a ccxt.pro watch* method so the agent can pull fresh data on demand. Returns a subscriptionId and a "streamKind". STATE streams are snapshots of "what is X right now" — watchTicker(s), watchOrderBook(ForSymbols), watchOHLCV(ForSymbols), watchBalance, watchPositions, watchBidsAsks, watchMarkPrice(s), watchFundingRate(s): watch_read returns the COMPLETE current set in "latest" (the server merges live updates into a full snapshot, so a multi-symbol stream always shows every subscribed symbol, not just the one that just ticked). EVENT streams are logs of discrete events — watchTrades and the private watchOrders/watchMyTrades/watch(My)Liquidations (private ones need an account): watch_read returns each new item oldest-first in "events" with a cursor. Call watch_unsubscribe to stop; streams auto-stop after 10 minutes with no read. Not every exchange streams every method — check describe_exchange. (read-only)
- `watch_read`: Get the latest data from a stream. For a STATE stream (streamKind "state": ticker(s), order book(s), ohlcv, balance, positions, ...) it returns the COMPLETE current snapshot in "latest" — the full merged set, so call it whenever you need the current value; "updatesSinceRead" tells you how much changed since you last read. The shape of "latest" mirrors the fetch* method: a single object for watchTicker/watchOrderBook/watchBalance, keyed by symbol for watchTickers/watchBidsAsks ({"BTC/USDT": {...}}), an array for watchPositions, and nested by symbol then timeframe for watchOHLCV ("latest"["BTC/USDT"]["1m"] = [[ts,o,h,l,c,v], ...]). For an EVENT stream (streamKind "events": trades, orders, my trades, liquidations) it returns new updates oldest-first in "events" plus a "nextCursor" — thread that back as "cursor" on each poll so you do not re-receive (double-count) old items. Each "events" element is a wrapper {seq, timestamp, datetime, data} where "data" holds the record(s) for that tick (an array — ccxt delivers a batch per update, e.g. events[i].data is the trades from that tick). "moreBuffered": true means call again with nextCursor for more, and "missedBeforeBuffer" > 0 means older updates were evicted before you read them. Set waitForChange:true to BLOCK until the next update arrives (or timeout) instead of returning immediately — the efficient way to wait for a slow event like an order fill or a position change ("timedOut": true means the wait elapsed with nothing new). (read-only)
- `watch_unsubscribe`: Stop a WebSocket subscription and release its socket. Always stop streams you no longer need.
- `watch_list`: List the currently active WebSocket subscriptions (id, exchange, method, streamKind, account and environment for private streams, args, active flag, age, seconds since last read, update count, and last error). (read-only)
- `list_accounts`: Locally configured named exchange accounts. Returns aliases and capability flags only — credential values are never exposed by any tool. (read-only)
- `get_balance`: Balances for a named account. Returns non-zero balances by default (exchanges report every listed currency — hundreds of zero rows). (read-only)
- `get_orders`: Orders for a named account: one order by id, or a list filtered by status ("open" default, "closed", "canceled", "all"). Many exchanges require a symbol for list queries. (read-only)
- `get_my_trades`: The account's own executed trades (fills). Many exchanges require a symbol. (read-only)
- `get_positions`: Open derivatives positions for a named account (prediction-market positions on prediction exchanges). (read-only)
- `create_order`: Place an order on a trading-enabled account (works on prediction exchanges with outcome handles as the symbol). Validated against market precision/limits and the account's notional caps. Whether it returns a preview + confirmToken first depends on the account's "confirm" policy: always = every order is previewed; live (the default) = only orders on a LIVE account are previewed, sandbox/demo execute immediately; never = no preview. So on a sandbox/demo account under the default policy an order executes without a confirm step. A stop/trigger order also returns meta.note flagging that conditional orders may not appear in get_orders even when live — confirm before treating the stop as guaranteed protection. Use "cost" instead of "amount" to market-buy by quote value where supported. Exchange-specific order params (triggerPrice, timeInForce, postOnly, reduceOnly, …): describe_method {"method": "createOrder", "exchange": ...}.
- `edit_order`: Modify price/amount of an open order. On exchanges without native edit, ccxt emulates it as cancel-then-replace — queue position is lost and the cancel can succeed while the replace fails. Runs the full order validation and confirmation.
- `cancel_order`: Cancel one open order by id. No confirmation step — canceling reduces risk and must never be blocked.
- `cancel_all_orders`: Cancel every open order on an account, optionally restricted to one symbol. The preview lists the orders that would be canceled.
- `set_leverage`: Set the leverage multiplier for a derivatives symbol on a trading-enabled account. Changing leverage changes the risk of existing positions.
- `set_margin_mode`: Set cross or isolated margin mode for a derivatives symbol on a trading-enabled account.
- `call_write_method`: Dispatch the unified write long tail on a trading-enabled account: cancelOrders, cancelOrdersForSymbols, cancelAllOrdersAfter, setPositionMode, addMargin, reduceMargin, setMargin, borrowCrossMargin, borrowIsolatedMargin, repayCrossMargin, repayIsolatedMargin, closePosition, closeAllPositions. Always previews and requires confirmation. Batch order placement is deliberately excluded — use create_order per order so the notional caps apply. Signatures: describe_method.
- `withdraw`: Withdraw cryptocurrency from a funds-enabled account to an external address. Irreversible once dispatched. The preview echoes the exact destination address and network — verify them before confirming.
- `transfer`: Move funds between wallets of the same exchange account (e.g. spot ↔ swap, main ↔ funding) on a funds-enabled account. Wallet names are exchange-specific — see describe_method {"method": "transfer", "exchange": ...}.
- `get_deposit_address`: Deposit address for a currency on a funds-enabled account (creates one where none exists and the exchange supports creation). Gated behind the funds tier because transcript-visible addresses invite substitution scams — always verify addresses out-of-band before sending funds.
- `call_implicit_write`: Call an exchange-specific implicit REST endpoint over POST/PUT/DELETE/PATCH on an account with "implicitWrites" enabled — covers exchange features the unified API does not (including account/key management). No unified validation exists for raw endpoints, so every call previews and requires confirmation, and is journaled. Endpoint names: describe_method {"query": ..., "exchange": ...}; payload per the exchange API reference (describe_exchange .urls.doc).

## FAQ

### Can the AI agent trade on my behalf automatically?

Trading is disabled by default. You must explicitly enable it per account in your local configuration file and set specific safety caps like max order value.

### How do I enable live trading?

To enable live trading, you must set the trading field to 'live' in your config file and define a per-order USD cap using maxOrderValue.

### What happens if I don't provide any configuration?

If no configuration is provided, the server will still function by serving public market data for all supported exchanges.
