Reddit股票分析服务器

一个提供Reddit浏览和高级股票符号检测分析功能的MCP服务器,适用于AI助手分析Reddit股票讨论和趋势。

  • by MaorAmsallem
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 MaorAmsallem/reddit-mcp-server

使用说明

Reddit MCP服务器🚀

一个强大的 模型上下文协议(MCP)服务器 它为Reddit浏览功能提供了先进的股票代码检测和分析。该服务器使AI助手能够浏览Reddit,分析股票动态,并通过智能上下文分析检测趋势股票。

🌟 特性

Reddit核心功能

  • 浏览热门帖子:从任何子版块获取热门帖子
  • 搜索Reddit:在Reddit或特定子版块搜索帖子
  • 评论分析:从特定帖子中提取并分析评论
  • 实时数据:通过PRAW API访问Reddit实时数据

高级库存检测🧠

  • 智能符号检测:具有置信度评分的上下文感知股票代码检测
  • API验证:使用Yahoo Finance API进行实时验证
  • 误报过滤:取消了诸如$HTTPS、$neneneba API等技术术语。
  • 信心评分:先进的算法可提高检测质量(0-100%)

库存分析工具📊

  • 股票热议分析:跟踪提及频率和随时间变化的趋势
  • 趋势库存扫描仪:根据上下文查找被提及最多的股票
  • 智能股票扫描仪:使用API验证和置信度指标进行高级检测
  • 每日故障:随着时间的推移,将提及模式可视化

🚀 快速开始

先决条件

  • Python 3.8+
  • Reddit API证书
  • pip包管理器

1.克隆存储库

git clone https://github.com/MaorAmsallem/reddit-mcp-server.git
cd reddit-mcp-server

2.安装依赖项

pip install -r requirements.txt

3.配置Reddit API

  1. 首选 Reddit应用
  2. 点击“创建应用程序”或“创建另一个应用程序”
  3. 选择“脚本”作为应用程序类型
  4. 将您的凭据复制到 .env 文件:
cp .env.example .env
# Edit .env with your credentials

4.运行服务器

python server.py

📋 可用工具

基本Reddit工具

  • get_hot_posts -从subreddit获取热门帖子
  • search_reddit -使用自定义查询搜索帖子
  • get_post_comments -从特定帖子中提取评论

库存分析工具

  • analyze_stock_buzz -分析Reddit上关于特定股票代码的讨论
  • find_trending_stocks -查找趋势股票(基本检测)
  • smart_stock_scanner -通过人工智能验证进行高级库存检测

🎯 智能库存检测

我们先进的库存检测系统使用多层分析:

第1层:模式识别

# Detects both formats
$AAPL  # Dollar prefix (high confidence)
AAPL   # Plain text (requires context validation)

第二层:上下文分析

# Financial context keywords boost confidence
"buying AAPL calls"     # High confidence
"AAPL earnings report"  # Medium confidence
"AAPL website URL"      # Low confidence (filtered out)

第3层:API验证

  • 实时雅虎金融API验证
  • 缓存以防止重复的API调用
  • 公司名称和行业信息

第四层:信心评分

90%+ = High Confidence (🔥🔥🔥)
70-89% = Medium Confidence (🔥🔥)
50-69% = Low Confidence (🔥)
<50% = Filtered Out (❌)

🔧 配置

环境变量

# Reddit API Configuration
REDDIT_CLIENT_ID=your_client_id
REDDIT_CLIENT_SECRET=your_client_secret
REDDIT_USERNAME=your_username
REDDIT_PASSWORD=your_password
REDDIT_USER_AGENT=my-mcp-bot/1.0

MCP客户端设置

添加到MCP客户端配置中:

{
  "mcpServers": {
    "reddit-mcp-server": {
      "command": "python",
      "args": ["path/to/reddit-mcp-server/server.py"],
      "env": {
        "REDDIT_CLIENT_ID": "your_client_id",
        "REDDIT_CLIENT_SECRET": "your_client_secret",
        "REDDIT_USERNAME": "your_username",
        "REDDIT_PASSWORD": "your_password"
      }
    }
  }
}

📊 示例用法

查找热门股票

# Basic trending stocks
find_trending_stocks(subreddit="wallstreetbets", limit=100)

# Smart detection with high confidence
smart_stock_scanner(
    subreddit="wallstreetbets",
    limit=200,
    min_confidence=0.8,
    validate_api=True
)

分析股票行情

# Analyze TSLA mentions over the last 7 days
analyze_stock_buzz(
    symbol="TSLA",
    days_back=7,
    subreddit="wallstreetbets"
)

搜索Reddit

# Search for posts about AI
search_reddit(
    query="artificial intelligence",
    subreddit="technology",
    limit=20
)

🛡️ 安全与隐私

  • 环境变量:敏感凭据存储在 .env 文件
  • 速率限制:对Reddit API限制的内置尊重
  • 错误处理:全面的错误处理和记录
  • 无数据存储:Reddit数据没有持久存储

🤝 贡献

  1. 分叉存储库
  2. 创建要素分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m 'Add amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求

📝 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

🔗 依赖项

  • 法律:Reddit API包装器
  • 金融:雅虎金融API股票验证
  • 主控程序:模型上下文协议SDK
  • python dotenv:环境变量管理
  • 异步IO:异步编程支持

🐛 故障排除

常见问题

Reddit身份验证失败

# Check your .env file
cat .env
# Verify credentials at https://www.reddit.com/prefs/apps/

库存检测不起作用

# Install yfinance for API validation
pip install yfinance
# Check internet connection for API calls

MCP连接问题

# Check server output for debug messages
python server.py
# Verify MCP client configuration

📈 路线图

  • []添加股票提及的情绪分析
  • []支持多个证券交易所
  • []历史数据分析
  • []与财经新闻API集成
  • []高级可视化工具
  • []实时通知

🙋‍♂️ 支持

如果您有疑问或需要帮助:

  1. 检查 问题 页
  2. 创建包含详细信息的新问题
  3. 加入我们的社区讨论

⭐ 表示支持

如果这个项目对你有帮助,请给它一个⭐ 在GitHub上!


由以下材料制成❤️ 面向MCP和Reddit社区