加密货币投资分析系统

一个多代理架构的加密货币投资分析系统,集成了多种MCP服务器,提供宏观经济、基本面、情绪分析和投资建议生成功能。

  • by justmy2satoshis
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 justmy2satoshis/crypto-skills-mcp

使用说明

加密技能MCP

Claude Desktop/Code的多代理加密货币投资分析系统,集成MCP。

概述

该软件包实现了一个专门的多代理架构,用于全面的加密货币投资分析:

  • 加密宏观分析师宏观经济体制分析、美联储政策影响和机构流动跟踪
  • CryptoVC分析师:基本尽职调查,包括代币经济学、技术健康和流动性分析
  • CryptoSentiment分析师:人群情绪分析、恐惧与贪婪指数和鲸鱼活动跟踪
  • Thesis合成器:通过多代理冲突解决生成投资论文

主要优势

✅ 专题分析 -四个专门用于宏观、基础、情感和论文综合的代理 ✅ MCP集成 -与6+加密货币MCP服务器无缝集成 ✅ 异步架构 -并行代理执行,实现快速分析 ✅ 生产就绪 -全面测试、类型安全和错误处理 ✅ 缓存层 -智能缓存将冗余MCP调用减少了约70%

安装

先决条件

  • Python 3.8或更高版本
  • 支持MCP的Claude Desktop或Claude Code
  • 至少一个受支持的MCP服务器(请参阅 MCP集成)

快速开始

# Clone repository
git clone https://github.com/justmy2satoshis/crypto-skills-mcp.git
cd crypto-skills-mcp

# Install with all dependencies
pip install -e ".[all]"

# Or install minimal version
pip install -e .

# Run tests to verify installation
pytest tests/

安装选项

# Core installation only
pip install -e .

# With skills utilities (pandas, numpy)
pip install -e ".[skills]"

# With agent framework (pydantic, typing-extensions)
pip install -e ".[agents]"

# With development tools (testing, linting, formatting)
pip install -e ".[dev]"

# With testing tools only
pip install -e ".[test]"

# Everything
pip install -e ".[all]"

MCP配置

安装脚本会自动配置您的MCP服务器 .claude.json 文件。如果需要手动配置,请将其添加到您的 .claude.json:

{
  "mcpServers": {
    "crypto-skills-mcp": {
      "type": "stdio",
      "command": "/path/to/python",
      "args": ["server.py"],
      "cwd": "/path/to/crypto-skills-mcp",
      "env": {
        "MODE": "hybrid",
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}

替换占位符:

  • /path/to/python → Python可执行文件的完整路径(例如。, C:\Python313\python.exe 或 /usr/bin/python3)
  • /path/to/crypto-skills-mcp → 克隆存储库的完整路径

示例配置:

  • 看 claude.json.示例 完整示例
  • 窗户: command: "C:\\Users\\YourName\\AppData\\Local\\Programs\\Python\\Python313\\python.exe"
  • macOS/Linux: command: "/usr/local/bin/python3"

故障排除

安装后未应用配置: 如果 pip install 成功,但 .claude.json 未更新:

  1. 运行验证脚本: python scripts/validate_install.py
  2. 如果验证失败,请手动运行配置: python scripts/post_install.py
  3. 重新启动Claude代码
  4. 在MCP服务器状态面板中验证连接

连接失败:

  1. 验证Python路径: which python3 (Unix)或 where python (Windows)
  2. 检查 .claude.json 有 "type": "stdio" 字段(必填)
  3. 确保 cwd 指向加密技能mcp目录
  4. 验证 args 是 ["server.py"] 不 ["-m", "mcp_client"]
  5. 检查 PYTHONUNBUFFERED 设置为 "1" 在env中
  6. 配置更改后重新启动克劳德桌面/代码

导入错误:

  • 跑 pip install -e ".[all]" 安装所有依赖项,包括FastMCP
  • 验证安装: python -c "import fastmcp; print(fastmcp.__version__)"
  • 如果FastMCP缺失: pip install fastmcp>=2.0.0

服务器未加载:

  • 检查克劳德桌面/代码MCP服务器状态面板
  • 在控制台/日志中查找错误消息
  • 验证服务器是否手动启动: cd /path/to/crypto-skills-mcp && python server.py
  • 运行验证: python scripts/validate_install.py

安装验证: 运行全面的验证脚本以检查所有组件:

cd /path/to/crypto-skills-mcp
python scripts/validate_install.py

这将验证:

  • 软件包安装
  • FastMCP依赖性
  • server.py文件
  • .claude.json配置
  • 服务器编译

建筑

多代理系统

                    ┌─────────────────────────────────┐
                    │   ThesisSynthesizer Agent       │
                    │  (Investment Thesis Generation) │
                    │   - Synthesizes multi-agent     │
                    │   - Resolves conflicts          │
                    │   - BUY/HOLD/SELL signals       │
                    └─────────────────────────────────┘
                                  ▲
              ┌───────────────────┼───────────────────┐
              │                   │                   │
    ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
    │  CryptoMacro    │ │  CryptoVC       │ │ CryptoSentiment │
    │  Analyst        │ │  Analyst        │ │ Analyst         │
    │                 │ │                 │ │                 │
    │ • Fed policy    │ │ • Tokenomics    │ │ • Fear & Greed  │
    │ • Inst. flows   │ │ • Tech health   │ │ • Social metrics│
    │ • Risk regime   │ │ • Liquidity     │ │ • Whale activity│
    └─────────────────┘ └─────────────────┘ └─────────────────┘
              │                   │                   │
              └───────────────────┼───────────────────┘
                                  ▼
                    ┌─────────────────────────────────┐
                    │      MCP Client Wrapper         │
                    │   (Caching + Error Handling)    │
                    └─────────────────────────────────┘
                                  │
              ┌───────────────────┼───────────────────┐
              │                   │                   │
    ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
    │  ccxt-mcp       │ │ crypto-indicators│ │ crypto-sentiment│
    │  (Price Data)   │ │ (Technical)      │ │ (Social Metrics)│
    └─────────────────┘ └─────────────────┘ └─────────────────┘

专业代理

代理 专业化 关键方法 输出格式
加密宏观分析师 宏观制度、美联储政策、制度流动 analyze_macro_regime(), track_institutional_flows(), assess_risk_sentiment() 风险制度分类、流量信号
CryptoVC分析师 基本面尽职调查、代币经济学、流动性 analyze_tokenomics(), assess_technical_health(), calculate_risk_score() 0-100风险评分,头寸规模
CryptoSentiment分析师 市场心理、恐惧与贪婪、社会趋势 analyze_crowd_sentiment(), track_whale_activity(), generate_contrarian_signal() 情绪机制,反向信号
Thesis合成器 多智能体合成、投资理论 generate_investment_thesis(), synthesize_analysis() 买入/持有/卖出,进入/退出水平

使用示例

示例1:基本比特币分析

import asyncio
from agents import CryptoMacroAnalyst, CryptoVCAnalyst, CryptoSentimentAnalyst
from mcp_client import MCPClientWrapper

async def analyze_bitcoin():
    # Initialize MCP client wrapper
    mcp_client = MCPClientWrapper()

    # Initialize specialized agents
    macro = CryptoMacroAnalyst(mcp_client=mcp_client)
    vc = CryptoVCAnalyst(mcp_client=mcp_client)
    sentiment = CryptoSentimentAnalyst(mcp_client=mcp_client)

    # Run parallel analysis
    macro_result = await macro.synthesize_macro_outlook("BTC")
    vc_result = await vc.generate_due_diligence_report("BTC")
    sentiment_result = await sentiment.synthesize_sentiment_outlook("bitcoin")

    print(f"Macro Regime: {macro_result['regime']}")
    print(f"Risk Score: {vc_result['overall_score']}/100")
    print(f"Sentiment: {sentiment_result['sentiment_assessment']}")

asyncio.run(analyze_bitcoin())

示例2:完成投资论文

from agents import ThesisSynthesizer

async def generate_thesis():
    mcp_client = MCPClientWrapper()
    synthesizer = ThesisSynthesizer(mcp_client=mcp_client)

    # Generate complete investment thesis
    thesis = await synthesizer.generate_investment_thesis("BTC", horizon_days=30)

    print(f"Recommendation: {thesis['recommendation']}")
    print(f"Confidence: {thesis['confidence']:.2f}")
    print(f"Entry Range: ${thesis['entry_range']['low']:,.0f} - ${thesis['entry_range']['high']:,.0f}")
    print(f"Position Size: {thesis['position_size'] * 100:.1f}%")

    for target in thesis['exit_targets']:
        print(f"Target: ${target['price']:,.0f} - {target['reasoning']}")

asyncio.run(generate_thesis())

示例3:多资产比较

async def compare_assets():
    """Compare multiple cryptocurrencies for portfolio allocation."""
    mcp_client = MCPClientWrapper()

    assets = ["BTC", "ETH", "SOL"]
    results = {}

    for asset in assets:
        # Generate thesis for each asset
        synthesizer = ThesisSynthesizer(mcp_client=mcp_client)
        thesis = await synthesizer.generate_investment_thesis(asset, horizon_days=30)

        results[asset] = {
            "recommendation": thesis["recommendation"],
            "confidence": thesis["confidence"],
            "risk_score": thesis.get("risk_score", 0),
            "position_size": thesis["position_size"]
        }

    # Sort by confidence and risk-adjusted returns
    ranked = sorted(results.items(), key=lambda x: x[1]["confidence"], reverse=True)

    for asset, metrics in ranked:
        print(f"{asset}: {metrics['recommendation']} (confidence: {metrics['confidence']:.2f})")

asyncio.run(compare_assets())

MCP集成

此软件包与您环境中当前配置的以下加密货币MCP服务器集成。

核心MCP服务器(必需)

  • ccxt mcp:24个以上交易所的交易数据(价格、OHLCV、订单簿)
  • 加密指标mcp:技术指标(RSI、MACD、布林带、70+指标)
  • 加密货币情绪mcp:社交情绪指标(Reddit、Telegram、Discord)
  • 加密恐惧mcp:加密货币恐惧与贪婪指数(0-100分)
  • 加密货币项目mcp:通过Mobula API的项目基础(6000多个代币)
  • cryptopanic mcp服务器:加密货币新闻聚合和情绪

增强型MCP服务器(可选)

  • etf流量mcp:CoinGlass API的比特币/以太坊ETF流量数据
  • grok搜索mcp:基于人工智能的情绪分析的网络/新闻搜索(xAI Grok)
  • 标记度量mcp:人工智能交易信号和价格预测(每月5000次免费通话)
  • 困惑mcp:研究和信息综合

演出

缓存策略

MCP客户端包装器实现智能缓存,以减少冗余的API调用:

  • 票务数据:60秒TTL(实时价格更新)
  • OHLCV数据:60秒TTL(烛台数据)
  • 恐惧与贪婪指数:300秒TTL(5分钟)
  • 项目数据:3600秒TTL(1小时)
  • 新闻数据:300秒TTL(5分钟)

缓存命中率:在典型的分析工作流程中,冗余MCP调用减少了约70%

异步性能

使用asyncio的并行代理执行支持并发分析:

  • 单一资产分析:约2-3秒(缓存命中)
  • 多资产比较:3个资产约5-7秒(并行执行)
  • 完成投资论文:~3-5秒(合成所有试剂)

数据库集成

支持多数据库架构:

  • PostgreSQL:结构化元数据(标记组学、基础)
  • MongoDB:文档存储(社交帖子、新闻文章)
  • 瑞迪斯:实时缓存(价格数据、情绪评分)
  • DuckDB:分析(时间序列分析、回溯测试)
  • Qdrant:矢量存储(研究报告的语义搜索)

发展

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black .

# Lint
ruff check .

# Type check
mypy agents/ mcp_client.py

目录结构

crypto-skills-mcp/
├── agents/              # Specialized cryptocurrency analysis agents
│   ├── __init__.py
│   ├── crypto_macro_analyst.py      # Macro regime and institutional flows
│   ├── crypto_vc_analyst.py         # Fundamental due diligence
│   ├── crypto_sentiment_analyst.py  # Market psychology and sentiment
│   └── thesis_synthesizer.py        # Investment thesis generation
├── mcp_client.py        # MCP Client Wrapper with caching and retry logic
├── examples/            # Production usage examples
│   └── production_usage.py
├── tests/               # Unit and integration tests
│   ├── __init__.py
│   ├── conftest.py      # Pytest fixtures and configuration
│   ├── test_agents.py   # Agent unit tests
│   └── test_mcp_client.py
├── .github/             # GitHub Actions workflows
│   └── workflows/
│       ├── tests.yml    # CI testing across OS and Python versions
│       ├── lint.yml     # Code quality checks
│       └── release.yml  # Automated PyPI publishing
├── pyproject.toml       # Modern Python package configuration
├── setup.py             # Package setup with modular installation
├── requirements.txt     # Core dependencies
├── LICENSE              # MIT License
├── CONTRIBUTING.md      # Contribution guidelines
├── CHANGELOG.md         # Version history
└── README.md            # This file

许可证

MIT许可证-请参阅 许可证 文件以获取详细信息。

贡献

欢迎投稿!看 贡献.md 作为指导方针。

支持