Reddit自然语言交互工具

MCP Reddit Companion是一款允许用户通过自然语言与个人Reddit体验交互的工具,支持创建自定义订阅源并使用LLM客户端分析、总结和参与相关内容。

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

使用说明

MCP Reddit伴侣

一个MCP工具,可以与您的个人Reddit体验进行自然语言交互。在Reddit上创建定制的订阅源,并使用您最喜欢的LLM客户端来分析、总结和参与对您重要的内容。

LLM命令示例

以下是一些可以与LLM客户端一起使用的示例命令:

# Basic Feed Interaction
"Show me the latest posts from my 'tech-news' feed"
"Summarize the top posts from my 'science' feed"
"What are the trending topics in my 'programming' feed?"

# Content Analysis
"What are the common themes in my 'ai' feed?"
"Which of my recent posts got the most engagement?"
"Summarize the discussions in my 'philosophy' feed"

# Personal Activity
"Show me my recent Reddit activity"
"What comments have I received on my posts?"
"Are there any unread messages in my inbox?"

# Engagement Tracking
"How are my recent posts performing?"
"Show me the most active discussions in my feeds"
"What posts got the most comments in my 'news' feed?"

先决条件

  • Python 3.11+
  • Reddit帐户凭据(用户名、密码)
  • Docker(可选,用于容器化部署)
  • MCP兼容的LLM客户端(如Cursor)

安装

本地安装

  1. 克隆存储库:
git clone https://github.com/yourusername/mcp-reddit.git
cd mcp-reddit
  1. 使用uv安装依赖项:
uv pip install .
  1. 创建一个 .env 使用您的Reddit API凭据文件:
REDDIT_CLIENT_ID=your_client_id
REDDIT_CLIENT_SECRET=your_client_secret
REDDIT_USERNAME=your_username
REDDIT_PASSWORD=your_password

Docker安装

  1. 构建Docker镜像:
docker build -t mcp-reddit .
  1. 运行容器(用于带有特殊字符的密码):
docker run \
  -e REDDIT_CLIENT_ID='your_client_id' \
  -e REDDIT_CLIENT_SECRET='your_client_secret' \
  -e REDDIT_USERNAME='your_username' \
  -e REDDIT_PASSWORD='your_password' \
  mcp-reddit

注意:如果您的密码包含特殊字符(如!、$等),请确保:

  1. 在密码周围使用单引号
  2. 用反斜杠转义任何特殊字符
  3. 或者使用双引号并转义特殊字符

带有特殊字符的示例:

docker run \
  -e REDDIT_CLIENT_ID='your_client_id' \
  -e REDDIT_CLIENT_SECRET='your_client_secret' \
  -e REDDIT_USERNAME='your_username' \
  -e REDDIT_PASSWORD='your\!password' \
  mcp-reddit

用法

本地使用

  1. 启动MCP服务器:
uv run mcp dev src/mcp_reddit_companion/server.py

或

  1. 在Claude桌面中安装
uv run mcp install src/mcp_reddit_companion/server.py 

Docker使用

容器运行时,MCP服务器将自动启动。连接您的LLM客户端以与您的Reddit提要进行交互。

配置

光标集成

要与Cursor一起使用,请将以下内容添加到您的 ~/.cursor/mcp.json:

{
  "mcpServers": {
    "reddit-companion": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\code\\personal\\mcp-reddit",
        "run",
        "mcp",
        "dev",
        "src/mcp_reddit_companion/server.py"
      ]
    }
  }
}

许可证

麻省理工学院