# Crypto MCP 快速启动指南
## 1. 安装依赖
```bash
# 进入目录
cd crypto_mcp
# 安装 TA-Lib C 库(必需)
# macOS
brew install ta-lib
# Ubuntu/Debian
sudo apt-get install ta-lib
# 安装 Python 依赖
pip install -r requirements.txt
```
## 2. 快速测试
```bash
# 测试核心功能(不使用MCP)
python test_crypto_indicators.py
```
这会测试:
- BTC, ETH, SOL 的技术指标
- 多时间框架分析
- 山寨币数据获取
- 价格变化计算
## 3. 运行 MCP 服务器
```bash
# 启动 MCP 服务器
python crypto_indicators_mcp.py
```
## 4. 测试 MCP 客户端
```bash
# 在另一个终端运行客户端示例
python crypto_indicators_client_example.py
```
## 5. 集成到 Claude Desktop
编辑配置文件:
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
添加:
```json
{
"mcpServers": {
"crypto-indicators": {
"command": "python3",
"args": ["/完整路径/nofx/backend/crypto_mcp/crypto_indicators_mcp.py"]
}
}
}
```
重启 Claude Desktop,然后可以使用:
```
请使用 get_crypto_indicators 获取 BTC 的 1小时 技术指标
```
## 6. 使用 MCP Inspector
```bash
npx @modelcontextprotocol/inspector python3 crypto_indicators_mcp.py
```
打开浏览器访问显示的 URL,可视化测试 MCP 工具。
## 常用命令
```bash
# 测试单个币种
python -c "
from crypto_indicators_mcp import CryptoDataProvider
provider = CryptoDataProvider()
data = provider.get_market_data('BTC', '1h')
print(f'BTC: \${data.current_price:.2f}, RSI: {data.current_rsi7:.2f}')
"
# 测试多时间框架
python -c "
from crypto_indicators_mcp import CryptoDataProvider
provider = CryptoDataProvider()
for tf in ['1d', '4h', '1h']:
data = provider.get_market_data('ETH', tf)
print(f'{tf}: \${data.current_price:.2f}')
"
```
## 支持的交易对
所有 Aster DEX 的 USDT 交易对:
- 主流币: BTC, ETH, BNB
- Layer1: SOL, AVAX, MATIC, ARB, OP
- DeFi: UNI, AAVE, CRV, COMP
- Meme: DOGE, SHIB
- 其他: LINK, DOT, ATOM, etc.
## 常见问题
### Q: TA-Lib 安装失败?
A: 确保先安装 C 库,再安装 Python 包
### Q: 如何获取更多历史数据?
A: 增加 `limit` 参数:`provider.get_market_data('BTC', '1h', limit=2000)`
### Q: 支持哪些时间周期?
A: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d, 1w
### Q: 需要 API 密钥吗?
A: 不需要,直接使用公开 API
## 下一步
- 查看 [README.md](README.md) 了解详细文档
- 查看 [crypto_indicators_mcp.py](crypto_indicators_mcp.py) 了解实现细节
- 查看 [test_crypto_indicators.py](test_crypto_indicators.py) 了解使用示例