CCXT MCP Server

by lazy-dinosaur
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides access to Binance cryptocurrency exchange data and trading capabilities, including price information, order book data, and the ability to execute market/limit orders through the CCXT library

  • Allows retrieval of Bitcoin price information, historical OHLCV data, and execution of Bitcoin trades across supported cryptocurrency exchanges

  • Enables retrieval of market data and execution of trades on Coinbase cryptocurrency exchange, supporting features like price comparison, order management, and account balance checks

CCXT MCP 服务器

한국어 버전(韩语版)

CCXT MCP 服务器是一款允许 AI 模型通过模型上下文协议 (MCP)与加密货币交易所 API 交互的服务器。该服务器使用CCXT 库提供对 100 多个加密货币交易所及其交易功能的访问。

🚀 快速入门

# Install the package globally npm install -g @lazydino/ccxt-mcp # Run with default settings ccxt-mcp # or run without installation npx @lazydino/ccxt-mcp

安装和使用

全局安装

# Install the package globally npm install -g @lazydino/ccxt-mcp

使用 npx 运行

无需安装即可直接运行:

# Using default settings npx @lazydino/ccxt-mcp # Using custom configuration file npx @lazydino/ccxt-mcp --config /path/to/config.json

查看帮助:

npx @lazydino/ccxt-mcp --help

配置

在 Claude Desktop 中注册 MCP 服务器

  1. 打开 Claude 桌面设置
    • 前往 Claude Desktop 应用程序中的“设置”菜单
    • 找到“MCP 服务器”部分
  2. 添加新的 MCP 服务器
    • 点击“添加服务器”按钮
    • 服务器名称: ccxt-mcp
    • 命令: npx @lazydino/ccxt-mcp
    • 附加参数(可选): --config /path/to/config.json
  3. 保存并测试服务器
    • 保存设置
    • 使用“测试连接”按钮测试连接

配置方法 - 两种选择

选项 1:直接在 Claude 桌面设置中包含帐户信息(基本方法)

此方法将 CCXT 帐户信息直接包含在 Claude Desktop 设置文件(claude_desktop_config.json)中:

{ "mcpServers": { "ccxt-mcp": { "command": "npx", "args": ["-y", "@lazydino/ccxt-mcp"], "accounts": [ { "name": "bybit_main", "exchangeId": "bybit", "apiKey": "YOUR_API_KEY", "secret": "YOUR_SECRET_KEY", "defaultType": "spot" }, { "name": "bybit_futures", "exchangeId": "bybit", "apiKey": "YOUR_API_KEY", "secret": "YOUR_SECRET_KEY", "defaultType": "swap" } ] } } }

使用此方法,您不需要单独的配置文件。所有设置都集成在 Claude Desktop 配置文件中。

选项 2:使用单独的配置文件(高级方法)

要将账户信息分离到单独的配置文件中,设置如下:

  1. 创建一个单独的配置文件(例如ccxt-accounts.json ):
{ "accounts": [ { "name": "bybit_main", "exchangeId": "bybit", "apiKey": "YOUR_API_KEY", "secret": "YOUR_SECRET_KEY", "defaultType": "spot" }, { "name": "bybit_futures", "exchangeId": "bybit", "apiKey": "YOUR_API_KEY", "secret": "YOUR_SECRET_KEY", "defaultType": "swap" } ] }
  1. 在 Claude 桌面设置中指定配置文件路径
{ "mcpServers": { "ccxt-mcp": { "command": "npx", "args": [ "-y", "@lazydino/ccxt-mcp", "--config", "/path/to/ccxt-accounts.json" ] } } }

使用单独配置文件的原因

  • 防止递归引用问题
  • 分离 API 密钥等敏感信息
  • 更简单的多环境配置(开发、测试、生产)
  • 改进的配置文件版本控制

主要特点

  • 市场信息检索
    • 列出交易所
    • 按交易所查看市场信息
    • 获取特定符号的价格信息
    • 查看特定符号的订单簿信息
    • 搜索历史 OHLCV 数据
  • 交易功能
    • 创建市价单/限价单
    • 取消订单并检查状态
    • 查看账户余额
    • 查看交易历史
  • 交易分析
    • 每日/每周/每月绩效分析
    • 胜率计算(过去 7 天、30 天、所有时间)
    • 平均盈亏比(R倍数)
    • 最大连续亏损/盈利系列分析
    • 资产变化跟踪
    • 综合绩效指标
    • 交易模式识别
    • 基于期间的回报计算
  • 职位管理
    • 资本比率交易(例如,以5%的账户资本进入)
    • 期货市场杠杆设置(1-100倍)
    • 动态头寸调整(基于波动性)
    • 分割买入/卖出策略实施
  • 风险管理
    • 基于技术指标的止损设置(例如,5分钟图上10根蜡烛中的最低点)
    • 基于波动率的止损/获利(ATR 倍数)
    • 最大允许损失限额(每日/每周)
    • 动态止盈设置(追踪盈利)

工作原理

User <--> AI Model(Claude/GPT) <--> MCP Protocol <--> CCXT MCP Server <--> Cryptocurrency Exchange API
  1. 用户:请求例如“告诉我比特币价格”或“在我的币安账户上购买以太坊”
  2. AI 模型:了解用户请求并确定使用哪些 MCP 工具/资源
  3. MCP 协议:AI 与 CCXT MCP 服务器之间的标准化通信
  4. CCXT MCP 服务器:使用 CCXT 库与加密货币交易所 API 进行通信
  5. 交易所 API :提供实际数据并执行交易订单

与 AI 模型一起使用

在Claude Desktop注册后,您可以向AI模型提出以下类型的请求:

注意事项和建议提示

使用 AI 模型时,请考虑以下注意事项并使用以下提示进行有效交易:

Your goal is to execute trades using the ccxt tools as much as possible Cautions: - Accurately identify whether it's a futures market or spot market before proceeding with trades - If there's no instruction about percentage of capital or amount to use, always calculate and execute trades using the entire available capital

笔记:

  • 人工智能模型有时会混淆期货交易和现货交易。
  • 如果没有关于交易资本规模的明确指导,人工智能可能会感到困惑。
  • 使用上述提示有助于清楚地传达您的交易意图。

基本查询示例

Check and compare the current Bitcoin price on binance and coinbase.

高级交易查询示例

职位管理

Open a long position on BTC/USDT futures market in my Bybit account (bybit_futures) with 5% of capital using 10x leverage. Enter based on moving average crossover strategy and set stop loss at the lowest point among the 12 most recent 5-minute candles.

性能分析

Analyze my Binance account (bybit_main) trading records for the last 7 days and show me the win rate, average profit, and maximum consecutive losses.

详细的交易分析

Analyze my trading performance on the bybit_futures account for BTC/USDT over the last 30 days. Calculate win rate, profit factor, and identify any patterns in my winning trades.
Show me the monthly returns for my bybit_main account over the past 90 days and identify my best and worst trading months.
Analyze my consecutive wins and losses on my bybit_futures account and tell me if I have any psychological patterns affecting my trading after losses.

发展

从源代码构建

# Clone repository git clone https://github.com/lazy-dinosaur/ccxt-mcp.git # Navigate to project directory cd ccxt-mcp # Install dependencies npm install # Build npm run build

🤝 贡献

欢迎贡献代码!欢迎提交 Pull 请求。

📄 许可证

根据 MIT 许可证分发。有关更多信息,请参阅许可证文件。

❤️支持

如果您发现这个项目有用,请考虑在 GitHub 上给它一个⭐️!

ID: mt6hftp7hy