首页
学习
活动
专区
圈层
工具
发布
MCP广场 >详情页
CCXT-MCP2026-10-23191分享添加福利群:解决AI开发者的「MCP实战痛点」
允许AI模型通过Model Context协议与加密货币交易所API交互的服务器,提供对100多家交易所及其交易功能的访问。
By lazy-dinosaur
2026-10-23191
github
详情内容

CCXT MCP服务器

npm version npm downloads GitHub stars License: MIT

한국어 버전(Korean version)

CCXT MCP服务器是一家服务器,允许AI模型通过Model Context Protocol (MCP)。该服务器使用CCXT library提供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 Desktop设置:

    • 转到Claude Desktop应用中的“设置”菜单
    • 查找“ MCP服务器”部分
  2. 添加新的MCP服务器:

    • 单击“添加服务器”按钮
    • 服务器名称:ccxt-mcp
    • 命令:npx @lazydino/ccxt-mcp
    • 其他参数(可选):--config /path/to/config.json
  3. 保存和测试服务器:

    • 保存设置
    • 测试使用“测试连接”按钮的连接

配置方法 - 两个选项

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

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

{
  "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桌面配置文件中。

选项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"
    }
  ]
}

重要:配置文件必须包含一个accounts如上图所示,在根级别的数组。

  1. 在Claude Desktop设置中指定配置文件路径:
{
  "mcpServers": {
    "ccxt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@lazydino/ccxt-mcp",
        "--config",
        "/path/to/ccxt-accounts.json"
      ]
    }
  }
}

注意:使用单独的配置文件与--config选项,服务器将寻找accounts数组直接在JSON文件的根中,而不是mcpServers.ccxt-mcp.accounts小路。

  1. 从命令行中运行使用外部配置文件:
# Using custom configuration file
npx @lazydino/ccxt-mcp --config /path/to/ccxt-accounts.json

您可以在examples/config-example.json在存储库中。

使用单独配置文件的原因**:

  • 防止递归参考问题
  • 分开敏感信息,例如API键
  • 更轻松的多环境配置(开发,测试,生产)
  • 改进的配置文件版本控制

关键功能

  • 市场信息检索:

    • 列表交换
    • 通过交流查看市场信息
    • 获取特定符号的价格信息
    • 查看订单簿信息的特定符号
    • 搜索历史OHLCV数据
  • 交易功能:

    • 创建市场/限制订单
    • 取消订单和检查状态
    • 查看帐户余额
    • 检查交易历史记录
  • 交易分析:

    • 每日/每周/每月绩效分析
    • 赢率计算(最近7天,30天,一直以来)
    • 平均利润/损失比(R-Multiph)
    • 最大连续损失/利润系列分析
    • 资产变化跟踪
    • 全面的性能指标
    • 贸易模式识别
    • 基于周期的返回计算
  • 职位管理:

    • 资本比率交易(例如,以5%的帐户资本输入)
    • 期货市场杠杆设置(1-100X)
    • 动态位置大小(基于波动率)
    • 分拆买卖策略实施
  • 风险管理:

    • 基于技术指标的停止损失设置(例如,5分钟图表中的10个蜡烛中的最低点)
    • 基于波动率的停止损失/获利(ATR倍数)
    • 最大允许损失限制(每日/每周)
    • 动态获利设定(拖延利润)

它如何工作

User <--> AI Model(Claude/GPT) <--> MCP Protocol <--> CCXT MCP Server <--> Cryptocurrency Exchange API
  1. 用户:诸如“告诉我比特币价格”或“在我的Binance帐户上购买以太坊”之类的请求
  2. AI模型:了解用户请求并确定要使用哪些MCP工具/资源
  3. MCP协议:AI和CCXT MCP服务器之间的标准化通信
  4. CCXT MCP服务器:使用CCXT库与加密货币交换API进行通信
  5. Exchange 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

笔记:

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

基本查询示例

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

🤝贡献

欢迎捐款!请随时提交拉动请求。

📄许可证

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

❤️支持

如果您觉得这个项目有用,请考虑在Github上给它一个⭐️!

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档