mcpField
C
Codex CCXT MCP

Codex CCXT MCP

Local
github.comFinance0Updated 21w ago

About Codex CCXT MCP

Codex CCXT MCP is a standalone stdio MCP server that exposes exchange market, account, and trading operations through CCXT to Codex. Trading is disabled and dry-run is enabled by default; both settings must be explicitly changed for live trading.

Key features

  1. 01Market and exchange-status queries
  2. 02Account, balance, position, and ledger queries
  3. 03Order and conditional-order management
  4. 04Derivatives and funding-rate data
  5. 05Trading protection with dry-run by default
  6. 06Proxy support and outbound IP checks

Use cases

  1. 01Review exchange markets and account positions
  2. 02Test order and account-change operations
  3. 03Query derivatives rates and long/short sentiment data

MCP support

It exposes CCXT exchange capabilities to Codex as a stdio MCP server. Mutating operations are guarded by trading switches and dry-run; live trading requires explicit enablement.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"lucyfox199818-collab-ccxt": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"BINANCE_API_KEY",
"-e",
"BINANCE_API_SECRET",
"-e",
"CCXT_EXCHANGE_ID",
"-e",
"CCXT_DEFAULT_TYPE",
"-e",
"CCXT_SANDBOX",
"-e",
"CCXT_ENABLE_TRADING",
"-e",
"CCXT_DRY_RUN",
"ghcr.io/lucyfox199818-collab/ccxt-mcp:0.1.0"
],
"env": {
"BINANCE_API_KEY": "<BINANCE_API_KEY>",
"BINANCE_API_SECRET": "<BINANCE_API_SECRET>",
"CCXT_EXCHANGE_ID": "<CCXT_EXCHANGE_ID>",
"CCXT_DEFAULT_TYPE": "<CCXT_DEFAULT_TYPE>",
"CCXT_SANDBOX": "<CCXT_SANDBOX>",
"CCXT_ENABLE_TRADING": "<CCXT_ENABLE_TRADING>",
"CCXT_DRY_RUN": "<CCXT_DRY_RUN>"
}
}
}
}
Run commanddocker run -i --rm -e BINANCE_API_KEY -e BINANCE_API_SECRET -e CCXT_EXCHANGE_ID -e CCXT_DEFAULT_TYPE -e CCXT_SANDBOX -e CCXT_ENABLE_TRADING -e CCXT_DRY_RUN ghcr.io/lucyfox199818-collab/ccxt-mcp:0.1.0
Environment variables to set
BINANCE_API_KEYSecretOptional Binance API key for private account data and explicitly enabled trading.
BINANCE_API_SECRETSecretOptional Binance API secret.
CCXT_EXCHANGE_IDCCXT exchange identifier.
CCXT_DEFAULT_TYPEDefault CCXT market type.
CCXT_SANDBOXUse the exchange sandbox when supported.
CCXT_ENABLE_TRADINGExplicit live-trading permission gate. Keep false for read-only and dry-run use.
CCXT_DRY_RUNReturn simulated results for mutating tools instead of sending exchange actions.

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
ocighcr.io/lucyfox199818-collab/ccxt-mcp:0.1.0

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

ccxt-mcp

ccxt-mcp 是一个独立的 MCP stdio 服务,用 CCXT 暴露加密货币交易所能力给 Codex 调用。默认交易关闭并启用 dry-run;需要真实下单时必须同时设置 CCXT_ENABLE_TRADING=true 和 CCXT_DRY_RUN=false。

MCP Registry 名称:io.github.lucyfox199818-collab/ccxt-mcp

公开 OCI 镜像:ghcr.io/lucyfox199818-collab/ccxt-mcp:0.1.0

功能

  • 市场数据:markets、ticker、tickers、ticker summary、order book、trades、OHLCV、交易所状态、交易所时间、币种、手续费。
  • 账户信息:accounts、balance/free/used/total balance、positions、ledger、my trades、充值/提现记录、充值地址、杠杆档位。
  • 订单交易:普通下单/批量下单、查询订单、查询全部订单、编辑订单、撤单、批量撤单、全部撤单。
  • 条件单和衍生品交易:trigger、stop loss、take profit、stop order、stop limit、stop market、trailing、post-only、reduce-only、TP/SL 组合单。
  • 合约/资金费率:funding rate/history、open interest/history、mark price、mark/index/premium index OHLCV。
  • Binance USDT-M 公共衍生品情绪数据:open-interest history、global long/short、top trader account/position long/short、taker buy/sell volume,均为只读免费公开数据端点。
  • 账户变更:set leverage、margin mode、position mode、add/reduce/set margin、transfer、withdraw,全部走交易开关和 dry-run 保护。
  • 通用能力:ccxt_call 可以调用当前交易所实例上存在的任意 CCXT 方法,包含 unified API 和 exchange-specific implicit API。
  • 代理/IP:支持 TRADINGAGENTS_PROXY_URL 或 CCXT_PROXY_URL,并提供 ccxt_proxy_ip 检查当前出口 IP 是否命中配置的白名单 IP。
  • Docker:支持构建成独立镜像,通过 stdio 运行 MCP。

环境变量

变量说明
TRADINGAGENTS_PROXY_URL / CCXT_PROXY_URLHTTP、HTTPS、SOCKS4 或 SOCKS5 代理 URL。
BINANCE_API_KEY / CCXT_API_KEYAPI key。
BINANCE_API_SECRET / CCXT_SECRET / CCXT_API_SECRETAPI secret。
CCXT_EXCHANGE_IDCCXT 交易所 ID,默认 binance。
CCXT_DEFAULT_TYPEBinance 常用市场类型,例如 spot、future、swap。
CCXT_SANDBOX是否开启交易所 sandbox/testnet。
CCXT_ENABLE_TRADING是否允许真实交易类调用,默认 false。
CCXT_DRY_RUN是否强制 dry-run,默认 true。
CCXT_WHITELIST_IPS / BINANCE_WHITELIST_IPS逗号分隔的预期出口 IP,用于 ccxt_proxy_ip 对比。
CCXT_IP_CHECK_URL出口 IP 检查地址,默认 https://api.ipify.org?format=json。

本地运行

cd ccxt-mcp
npm install
npm run build
node dist/index.js

Codex MCP stdio 配置示例:

{
  "mcpServers": {
    "ccxt": {
      "command": "node",
      "args": ["/home/adon/codes/codex-binance-agent/ccxt-mcp/dist/index.js"],
      "cwd": "/home/adon/codes/codex-binance-agent/ccxt-mcp"
    }
  }
}

Docker

直接运行公开镜像:

docker run --rm -i \
  -e CCXT_ENABLE_TRADING=false \
  -e CCXT_DRY_RUN=true \
  ghcr.io/lucyfox199818-collab/ccxt-mcp:0.1.0

或从源码构建:

cd ccxt-mcp
docker build -t ccxt-mcp:local .
docker run --rm -i --env-file .env ccxt-mcp:local

Docker MCP stdio 配置示例:

{
  "mcpServers": {
    "ccxt": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "--env-file", "/home/adon/codes/codex-binance-agent/ccxt-mcp/.env", "ccxt-mcp:local"]
    }
  }
}

工具列表

当前显式注册 101 个 MCP tools;此外 ccxt_call 可以调用当前交易所实例上存在的任意 CCXT 方法。

基础和市场数据:

  • ccxt_get_config
  • ccxt_list_exchanges
  • ccxt_exchange_info
  • ccxt_proxy_ip
  • ccxt_load_markets
  • ccxt_fetch_currencies
  • ccxt_fetch_status
  • ccxt_fetch_time
  • ccxt_fetch_ticker
  • ccxt_fetch_tickers
  • ccxt_fetch_ticker_summary
  • ccxt_fetch_order_book
  • ccxt_fetch_trades
  • ccxt_fetch_ohlcv
  • ccxt_fetch_trading_fees
  • ccxt_fetch_trading_fee
  • ccxt_fetch_deposit_withdraw_fees
  • ccxt_fetch_deposit_withdraw_fee
  • ccxt_call

账户信息:

  • ccxt_fetch_accounts
  • ccxt_fetch_balance
  • ccxt_fetch_free_balance
  • ccxt_fetch_used_balance
  • ccxt_fetch_total_balance
  • ccxt_fetch_positions
  • ccxt_fetch_positions_for_symbol
  • ccxt_fetch_positions_risk
  • ccxt_fetch_positions_history
  • ccxt_fetch_leverage
  • ccxt_fetch_leverages
  • ccxt_fetch_leverage_tiers
  • ccxt_fetch_market_leverage_tiers
  • ccxt_fetch_ledger
  • ccxt_fetch_ledger_entry
  • ccxt_fetch_my_trades
  • ccxt_fetch_order_trades
  • ccxt_fetch_deposit_address
  • ccxt_fetch_deposit_addresses
  • ccxt_fetch_deposit_addresses_by_network
  • ccxt_fetch_deposits
  • ccxt_fetch_withdrawals
  • ccxt_fetch_deposits_withdrawals
  • ccxt_fetch_borrow_interest

订单和条件单:

  • ccxt_fetch_order
  • ccxt_fetch_orders
  • ccxt_fetch_open_orders
  • ccxt_fetch_open_algo_orders
  • ccxt_cancel_algo_order
  • ccxt_cancel_all_algo_orders
  • ccxt_fetch_closed_orders
  • ccxt_fetch_canceled_orders
  • ccxt_fetch_canceled_and_closed_orders
  • ccxt_create_order
  • ccxt_create_orders
  • ccxt_edit_order
  • ccxt_edit_orders
  • ccxt_cancel_order
  • ccxt_cancel_orders
  • ccxt_cancel_all_orders
  • ccxt_cancel_all_orders_after
  • ccxt_cancel_orders_for_symbols
  • ccxt_create_limit_order
  • ccxt_create_market_order
  • ccxt_create_trigger_order
  • ccxt_create_stop_loss_order
  • ccxt_create_take_profit_order
  • ccxt_create_protected_futures_entry
  • ccxt_create_order_with_take_profit_and_stop_loss
  • ccxt_create_trailing_amount_order
  • ccxt_create_trailing_percent_order
  • ccxt_create_stop_order
  • ccxt_create_stop_limit_order
  • ccxt_create_stop_market_order
  • ccxt_create_post_only_order
  • ccxt_create_reduce_only_order

Binance USDT-M close-position 保护单默认会跳过同合约、同方向、同仓位方向的重复 STOP_MARKET / TAKE_PROFIT_MARKET algo 单。需要替换已有保护单时,在创建请求的 params 里显式传 replaceExistingClosePosition: true;工具会先取消匹配的旧 algo 单, 再提交新的 close-position 保护单,并返回撤单和新单结果。

Binance USDT-M protected entry 应优先使用 ccxt_create_protected_futures_entry。该工具会先提交 close-position 止损和止盈 algo 保护单,再提交入场单;如果任一保护单或入场单创建失败,会撤销已经 接受的保护单并返回失败阶段。对 Binance futures 调用 ccxt_create_order_with_take_profit_and_stop_loss 时,服务端也会自动走同一条保护优先路径,避免直通 CCXT 当前不支持的 createOrderWithTakeProfitAndStopLoss。

Binance USDT-M hedge mode 下,关闭 positionSide=LONG / SHORT 的普通订单不应向交易所提交 reduceOnly 参数。服务端会在普通下单工具里自动移除该参数;ccxt_create_reduce_only_order 在此场景下 会改走 createOrder 并保留 positionSide,避免 Binance 返回 -1106 Parameter 'reduceonly' sent when not required。

合约和账户变更:

  • ccxt_fetch_funding_rate
  • ccxt_fetch_funding_rates
  • ccxt_fetch_funding_rate_history
  • ccxt_fetch_funding_history
  • ccxt_fetch_open_interest
  • ccxt_fetch_open_interests
  • ccxt_fetch_open_interest_history
  • ccxt_fetch_binance_derivatives_sentiment
  • ccxt_fetch_binance_global_long_short_account_ratio
  • ccxt_fetch_binance_top_long_short_account_ratio
  • ccxt_fetch_binance_top_long_short_position_ratio
  • ccxt_fetch_binance_taker_long_short_ratio
  • ccxt_fetch_binance_open_interest_hist
  • ccxt_fetch_mark_price
  • ccxt_fetch_mark_prices
  • ccxt_fetch_mark_ohlcv
  • ccxt_fetch_index_ohlcv
  • ccxt_fetch_premium_index_ohlcv
  • ccxt_set_leverage
  • ccxt_set_margin_mode
  • ccxt_set_position_mode
  • ccxt_add_margin
  • ccxt_reduce_margin
  • ccxt_set_margin
  • ccxt_transfer
  • ccxt_withdraw

所有 mutating 工具都会经过交易开关。默认返回 dry-run,不会真实请求下单、撤单、改杠杆、划转或提现类操作。

联系方式

  • 微信:mypcwza
  • Telegram:mypcwza

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.