Token导航 LogoToken导航TokenDH.com
Reddit Vader Sentiment Analysis Integration MCP Server Prod logo
金融服务stdio官方级别未说明来源级核验

Reddit Vader Sentiment Analysis Integration MCP Server Prod

MCP Server

一个结合Reddit API和VADER情感分析的MCP服务器,用于监控和分析Reddit讨论的情感倾向。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
情感分析区块链支付Python自然语言处理

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Traia-IO

提供方

Traia-IO

最后核验

2026/5/17 20:22

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python mcp_health_check.py

详细介绍

Reddit+VADER情感分析集成MCP服务器

这是一个MCP(模型上下文协议)服务器,它将Reddit API集成(PRAW)与VADER情绪分析相结合,为Reddit讨论提供全面的情绪监测。它使用D402支付协议进行安全访问控制。

特性

  • 🔧 MCP协议:基于模型上下文协议构建,实现无缝的人工智能集成
  • 📊 Reddit集成:使用PRAW(Python Reddit API包装器)获取帖子和评论
  • 💭 维德情绪:社交媒体文本的专业情感分析
  • 💳 D402支付协议:使用HTTP 402支付协议进行安全访问
  • 🔍 高级搜索:关键字过滤和subreddit搜索功能
  • 📈 综合指标:详细的情绪分布和统计数据
  • 🐳 Docker支持:使用Docker和Docker Compose轻松部署
  • 异步操作:内置FastMCP,实现高效异步处理
  • 🎯 生产就绪:针对生产环境进行了优化

可用工具

此服务器为Reddit情绪分析提供了以下工具:

1. analyze_subreddit_sentiment

使用可选的关键字过滤分析子版块中帖子的情绪。

参数:

  • subreddit_name (string):子版块的名称(不含r/)
  • keywords (字符串,可选):逗号分隔的关键字用于筛选帖子
  • limit (整数):要分析的最大帖子数(最大100,默认值:25)
  • time_filter (string):时间过滤器(小时、天、周、月、年、全部,默认值:天)
  • sort_by (string):排序方法(热、新、顶部、上升、默认:热)

退货:

  • 带有情绪分析和整体情绪指标的帖子

付款: 每个请求0.00002个令牌

2. search_and_analyze_reddit_sentiment

使用关键字在subreddit中搜索帖子并分析他们的情绪。

参数:

  • subreddit_name (string):子版块的名称(不含r/)
  • query (string):搜索查询/关键字
  • limit (整数):要分析的最大帖子数(最大100,默认值:25)
  • time_filter (string):时间过滤器(小时、天、周、月、年、全部,默认值:月)
  • sort_by (string):排序方法(相关性、热门、顶部、新、评论、默认:相关性)

退货:

  • 带有情绪分析的搜索结果

付款: 每个请求0.00002个令牌

3. analyze_post_comments_sentiment

从Reddit帖子中获取评论并分析他们的情绪。

参数:

  • post_id (字符串):Reddit帖子ID
  • limit (整数):要分析的最大评论数(默认值:50)
  • sort_by (string):排序方法(top、best、new、conference、old、qa、default:top)

退货:

  • 带有情绪分析和整体情绪指标的评论

付款: 每次请求0.000015个令牌

4. get_api_info

获取有关Reddit+VADER集成服务及其状态的信息。

退货:

  • 服务信息、身份验证状态和可用端点

付款: 每个请求0.000005个令牌

安装

使用Docker(推荐)

  1. 克隆此存储库:
   git clone https://github.com/Traia-IO/reddit-vader-sentiment-analysis-integration-mcp-server.git
   cd reddit-vader-sentiment-analysis-integration-mcp-server
  1. 设置环境变量:
   export SERVER_ADDRESS="your-iatp-wallet-address"
   export MCP_OPERATOR_PRIVATE_KEY="your-operator-key"
  1. 使用Docker运行:
   ./run_local_docker.sh

使用Docker Compose

  1. 创建一个 .env 使用您的配置文件:
   SERVER_ADDRESS=your-iatp-wallet-address
   MCP_OPERATOR_PRIVATE_KEY=your-operator-key
   PORT=8000
   LOG_LEVEL=INFO
   D402_TESTING_MODE=false
   FACILITATOR_URL=https://facilitator.example.com
  1. 启动服务器:
   docker-compose up

手动安装

  1. 使用安装依赖项 uv:
   uv pip install -e .
  1. 运行服务器:
   SERVER_ADDRESS="your-iatp-wallet-address" uv run python -m server

用法

健康检查

测试服务器是否正在运行:

python mcp_health_check.py

使用CrewAI

from traia_iatp.mcp.traia_mcp_adapter import create_mcp_adapter

# Connect to the MCP server with payment
with create_mcp_adapter(
    url="http://localhost:8000/mcp/"
) as tools:
    # Use the tools
    for tool in tools:
        print(f"Available tool: {tool.name}")
        
    # Example: Analyze subreddit sentiment
    result = await tool.analyze_subreddit_sentiment(
        subreddit_name="cryptocurrency",
        keywords="bitcoin,btc",
        limit=25,
        sort_by="hot"
    )
    print(f"Analyzed {result['posts_analyzed']} posts")
    print(f"Overall sentiment: {result['overall_sentiment']}")
    
    # Example: Search and analyze sentiment
    result = await tool.search_and_analyze_reddit_sentiment(
        subreddit_name="Bitcoin",
        query="price prediction",
        limit=20
    )
    print(f"Found {result['posts_analyzed']} matching posts")
    
    # Example: Analyze post comments
    result = await tool.analyze_post_comments_sentiment(
        post_id="abc123",
        limit=50,
        sort_by="top"
    )
    print(f"Analyzed {result['comments_analyzed']} comments")

示例响应

次级情感分析

{
  "status": "success",
  "subreddit": "cryptocurrency",
  "posts_analyzed": 25,
  "overall_sentiment": {
    "positive_count": 12,
    "negative_count": 5,
    "neutral_count": 8,
    "average_compound_score": 0.2145,
    "dominant_sentiment": "positive",
    "sentiment_distribution": {
      "positive_percentage": 48.00,
      "negative_percentage": 20.00,
      "neutral_percentage": 32.00
    }
  },
  "posts": [
    {
      "id": "abc123",
      "title": "Bitcoin reaches new high",
      "score": 1234,
      "sentiment_analysis": {
        "scores": {
          "neg": 0.0,
          "neu": 0.4,
          "pos": 0.6,
          "compound": 0.7
        },
        "category": "positive"
      }
    }
  ]
}

Reddit身份验证

此服务器需要Reddit API凭据。您可以通过两种方式提供它们:

选项1:通过授权标头(推荐)

格式: client_id:client_secret:user_agent

Authorization: Bearer your_client_id:your_client_secret:MyApp/1.0

选项2:通过自定义标头(传统)

X-Reddit-Client-ID: your_client_id
X-Reddit-Client-Secret: your_client_secret
X-Reddit-User-Agent: MyApp/1.0

获取Reddit API证书:

  1. 首选https://www.reddit.com/prefs/apps
  2. 创建新应用程序(脚本类型)
  3. 记下你的client_id和client_secret

支付协议

此服务器使用D402支付协议(HTTP 402)进行访问控制:

  • 要求付款:所有工具调用都需要付款验证
  • 基于代用券:使用区块链代币进行支付(默认情况下为Sepolia testnet)
  • 引导者:付款通过协调员服务处理
  • 测试模式:可以禁用开发使用 D402_TESTING_MODE=true
  • 双模式:支持支付和Reddit API身份验证

支付配置

设置以下环境变量:

  • SERVER_ADDRESS:您的IATP钱包合约地址(必填)
  • MCP_OPERATOR_PRIVATE_KEY:支付验证的操作员签名密钥(必填)
  • FACILITATOR_URL:支付服务商URL(除非启用了测试模式,否则为必填项)
  • D402_TESTING_MODE:设置为“true”以绕过主持人进行测试(默认值:false)
  • NETWORK:区块链网络(默认:sepolia)

发展

测试服务器

  1. 在本地启动服务器
  2. 运行健康检查: python mcp_health_check.py
  3. 使用CrewAI适配器测试单个工具

添加新工具

要添加新工具,请编辑 server.py 以及:

  1. 添加 @mcp.tool()@require_payment_for_tool() 装饰功能
  2. 使用新工具更新此README
  3. 更新 deployment_params.json 工具名称位于功能数组中
  4. 更新 endpoints.json 使用新的端点文档

部署

部署配置

deployment_params.json 文件包含此MCP服务器的部署配置:

{
  "github_url": "https://github.com/Traia-IO/reddit-vader-sentiment-analysis-integration-mcp-server",
  "mcp_server": {
    "name": "reddit-vader-integration-mcp",
    "description": "Combines Reddit API integration (PRAW) with VADER sentiment analysis to provide comprehensive sentiment monitoring of Reddit discussions around crypto topics and other subjects. Uses D402 payment protocol for access control.",
    "server_type": "streamable-http",
    "requires_api_key": true,
    "capabilities": [
      "analyze_subreddit_sentiment",
      "search_and_analyze_reddit_sentiment",
      "analyze_post_comments_sentiment",
      "get_api_info"
    ],
    "payment_protocol": "402"
  }
}

重要:始终更新 capabilities 添加或删除工具时使用数组!

谷歌云运行

此服务器旨在部署在Google Cloud Run上。部署将:

  1. 从Dockerfile构建一个容器
  2. 使用指定配置部署到Cloud Run
  3. 暴露 /mcp 客户端连接的端点

环境变量

  • PORT:服务器端口(默认值:8000)
  • STAGE:环境阶段(默认:MAINNET,选项:MAINNET、TESTNET)
  • LOG_LEVEL:日志记录级别(默认值:INFO)
  • SERVER_ADDRESS:付款地址(IATP钱包合约)- D402支付协议要求
  • MCP_OPERATOR_PRIVATE_KEY:支付协议的操作员签名密钥- 必需的
  • D402_TESTING_MODE:跳过测试主持人(默认值:false)
  • FACILITATOR_URL:支付服务商URL- 如果测试模式被禁用,则需要
  • D402_FACILITATOR_API_KEY:主持人服务的API密钥(可选)
  • NETWORK:区块链网络(默认:sepolia)

特性和功能

Reddit整合(PRAW)

  • 从任何公共子版块获取帖子
  • 使用关键字搜索帖子
  • 使用各种排序选项获取帖子评论
  • 支持所有Reddit排序方法(热门、新、顶部、上升等)
  • 基于时间的过滤(小时、天、周、月、年、全部)

VADER情绪分析

  • 专门用于社交媒体文本
  • 返回复合、正、负和中性分数
  • 将情绪分为积极、消极或中性
  • 针对非正式文本和表情进行了优化

综合指标

  • 总体情绪分布
  • 平均复合得分
  • 主导情绪识别
  • 百分比细分
  • 每条帖子/评论的情绪细节

故障排除

  1. 服务器未启动:使用以下命令检查Docker日志 docker logs
  2. 付款错误:确保正确设置SERVER_ADDRESS和MCP_OPERATOR_PRIVATE_KEY
  3. Reddit API错误:验证您的Reddit凭据是否有效
  4. 连接错误:确保服务器在预期端口上运行
  5. 工具错误:检查服务器日志以获取详细的错误消息

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 实施新工具或改进
  4. 更新README、deployment_params.json和endpoints.json
  5. 提交拉取请求

许可证

MIT许可证

目录标签

目录标签

情感分析区块链支付Python自然语言处理本地部署社交媒体监控RedditAPI

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP