使用说明
CCXT MCP服务器
通过CCXT库提供交易功能的模型上下文协议(MCP)服务器。
特性
- 获取任何交易品种的股票行情数据
- 获取订单簿数据
- 查看最近的交易
- 创建订单(市场、限额等)
- 取消订单
- 提取账户余额
- 交易分析提示
- 订单管理指南
- 测试网支持
- 支持CCXT支持的任何交换
- 缓存交换实例以提高性能
项目结构
src/ccxt_mcp/
├── __init__.py # Main server file
├── utils/
│ └── exchange.py # Exchange management with testnet support
├── tools/
│ ├── fetch_ticker.py # Ticker data tool
│ ├── fetch_order_book.py # Order book tool
│ ├── fetch_trades.py # Trades tool
│ ├── create_order.py # Order creation tool
│ ├── cancel_order.py # Order cancellation tool
│ └── fetch_balance.py # Balance fetching tool
└── prompts/
├── trading_analysis.py # Trading analysis prompt
├── order_management.py # Order management prompt
└── testnet_guidance.py # Testnet guidance prompt
安装以运行MCP服务器
先决条件:
这些是Claude Desktop的说明,但此mcp服务器可用于任何mcp客户端。
- 下载github仓库:
git clone https://github.com/pcriadoperez/ccxt-mcp.git
-
输入文件夹
cd ccxt-mcp -
安装mcp服务器
mcp install run.py -
打开克劳德桌面->设置->开发人员->编辑配置
- 添加环境变量
- 您可能在命令中使用了“替换”命令来定位uv位置(您可以发现它正在运行
which uv) - 它应该看起来像下面的配置
{
"mcpServers": {
"CCXT Trading Server": {
"command": "/Users/pablo/.local/bin/uv",
"args": [
"run",
"--with",
"ccxt",
"--with",
"mcp[cli]",
"mcp",
"run",
"/Users/pablo/github/ccxt-mcp-2/run.py"
],
"env":{
"BINANCE_APIKEY": "BINANCE_APIKEY",
"BINANCE_SECRET": "BINANCE_SECRET"
}
}
}
}
- 关闭和打开克劳德
贡献设置
- 克隆存储库:
git clone https://github.com/pcriadoperez/ccxt-mcp.git
cd ccxt-mcp
- 安装依赖项:
uv pip install -e .
- 设置环境变量:
# Copy the example environment file
cp .env.example .env
# Edit .env with your API keys
# Add your exchange API keys in the format:
# {EXCHANGE_ID}_API_KEY=your_api_key
# {EXCHANGE_ID}_SECRET=your_secret
开发人员使用情况
- 运行Dev MCP服务器:
mcp dev run.py
安全
- 永远不要承诺你的
.env文件 - 为API键使用环境变量
- 考虑在生产中使用机密管理服务
- 建议使用测试网进行开发和测试
贡献
- 分叉存储库
- 创建要素分支
- 提交您的更改
- 推到分支
- 创建拉取请求
许可证
麻省理工学院