Reddit内容获取服务

一个允许LLMs从Reddit获取和阅读内容的MCP服务器,支持浏览帖子、评论和子版块列表。

  • by DarkoKuzmanovic-archived
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 DarkoKuzmanovic/reddit-mcp

使用说明

reddit mcp

一个模型上下文协议(MCP)服务器,允许LLM从Reddit获取和读取内容。让克劳德能够浏览帖子、评论和subreddit列表。

特性

  • 帖子页面 --获取标题、正文、元数据和线程注释
  • 子版块列表 --从任何subreddit检索帖子列表
  • 用户页面 --浏览用户的帖子历史记录
  • 短链接 --自动扩展 redd.it 网址
  • 内置安全功能 --不可信内容免责声明、文本截断、超时保护、速率限制处理

需求

  • Node.js 22+

安装

git clone https://github.com/quzma/reddit-mcp.git
cd reddit-mcp
npm install
npm run build

用法

Claude 桌面版

添加到您的Claude Desktop MCP配置(claude_desktop_config.json):

{
  "mcpServers": {
    "reddit": {
      "command": "node",
      "args": ["/absolute/path/to/reddit-mcp/dist/index.js"]
    }
  }
}

Claude 代码

添加到您的Claude Code MCP设置中:

claude mcp add reddit -- node /absolute/path/to/reddit-mcp/dist/index.js

发展

npm run dev

工具

fetch_reddit

从Reddit URL获取内容。

参数 类型 必填 说明
url string 是 Reddit URL(帖子、子版块或用户页面)
comment_limit number No 要包含的最大顶级注释数(0-50,默认值15)

支持的URL格式:

  • https://reddit.com/r/subreddit/comments/id/title/
  • https://reddit.com/r/subreddit/
  • https://reddit.com/user/username/
  • https://redd.it/id
  • 旧/新/www Reddit URL变体

运作原理

使用Reddit的公共JSON API-不需要API密钥或OAuth。服务器使用MCP协议通过stdio进行通信,因此它可以作为任何兼容MCP的客户端的本地工具。

内容安全措施:

  • 所有输出都以不受信任的内容免责声明作为前缀
  • 帖子/评论文本截断为20000个字符
  • 评论嵌套限制为2级,每条评论5条回复
  • 15秒请求超时
  • 速率限制(429)和禁止(403)错误处理

许可证

麻省理工学院——见 许可证