此仓库包含一个针对 Reddit 的 Model Context Protocol(MCP)服务器实现,该实现允许 AI 助手通过 PRAW(Python Reddit API 包装器)访问和与 Reddit 内容进行交互。
<a href="https://glama.ai/mcp/servers/@Arindam200/reddit-mcp"> <img width="380" height="200" src="https://gips2.baidu.com/it/u=4073398834,4216414244&fm=3081&app=3081&f=PNG?w=760&h=400" alt="Reddit Server MCP 服务器" /> </a>
Model Context Protocol(MCP)是一种标准,用于使 AI 助手能够与外部服务、工具和数据源进行接口。此服务器实现了 MCP 规范,以提供对 Reddit 内容的访问。
要了解更多关于 MCP 的信息,请查看这个视频
git clone https://github.com/Arindam200/reddit-mcp.git
cd reddit-mcp
连接到 MCP 服务器
复制以下 JSON 并用适当的 {{PATH}} 值替换:
{
"mcpServers": {
"reddit": {
"command": "{{PATH_TO_UV}}", // 运行 `which uv` 并在此处放置输出
"args": [
"--directory",
"{{PATH_TO_SRC}}", // 进入仓库目录,运行 `pwd` 并在此处输入输出
"run",
"server.py"
],
"env": {
"REDDIT_CLIENT_ID": "your_client_id",
"REDDIT_CLIENT_SECRET": "your_client_secret",
"REDDIT_USERNAME": "your_username", // 可选,用于认证操作
"REDDIT_PASSWORD": "your_password" // 可选,用于认证操作
}
}
}
}
您可以通过在 Reddit 应用偏好设置页面创建一个应用来获取 Reddit API 凭据。
对于 Claude,请将此文件保存为 claude_desktop_config.json 在您的 Claude Desktop 配置目录中:
~/Library/Application Support/Claude/claude_desktop_config.json
对于 Cursor,请将此文件保存为 mcp.json 在您的 Cursor 配置目录中:
~/.cursor/mcp.json
重启 Claude Desktop / Cursor
打开 Claude Desktop,您现在应该能看到 Reddit 已作为一个可用集成出现。
或者重启 Cursor。
服务器提供了以下工具:
get_user_info(username) - 获取详细的用户分析及互动见解get_top_posts(subreddit, time_filter, limit) - 获取并分析热门帖子get_subreddit_stats(subreddit) - 获取全面的子版块分析get_trending_subreddits() - 获取趋势子版块列表get_submission_by_url(url) - 根据 URL 获取 Reddit 提交内容get_submission_by_id(submission_id) - 根据 ID 获取 Reddit 提交内容who_am_i() - 获取当前认证用户的详细信息create_post(subreddit, title, content, flair, is_self) - 创建优化的帖子reply_to_post(post_id, content, subreddit) - 添加带有互动见解的回复reply_to_comment(comment_id, content, subreddit) - 添加战略性的回复这里有一些示例,您可以向连接到此服务器的 AI 助手询问:
服务器在多个领域提供智能分析:
用户分析
帖子分析
社区分析
服务器支持两种级别的认证:
只读访问
client_id 和 client_secret认证访问
username 和 password欢迎贡献!请随时提交 Pull Request。
本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。