这是一个基于MCP(Model Context Protocol)协议的Reddit服务器,专门设计用于与Claude等大语言模型进行交互。通过这个服务,你可以让AI助手帮助你浏览和分析Reddit上的内容。
nangeAGICode/reddit_chat_claude/
├── .github/
│ └── workflows/
│ └── docker.yml # GitHub Actions工作流配置
├── src/
│ ├── init.py
│ └── server.py # MCP服务器核心代码
├── .gitignore # Git忽略文件配置
├── Dockerfile # Docker构建文件
├── LICENSE # MIT许可证
├── README.md # 项目说明文档
└── requirements.txt # Python依赖包列表
需要设置以下环境变量:
REDDIT_CLIENT_ID=你的client_id
REDDIT_CLIENT_SECRET=你的client_secret
REDDIT_USER_AGENT=你的user_agent
MAC用户: 1.访问 Docker 官网:https://www.docker.com/products/docker-desktop 2.点击 "Download for Mac" 3.选择对应你的 Mac 芯片的版本(Apple Silicon 或 Intel) 4.下载并安装 .dmg 文件
5.验证安装:
# 检查 Docker 版本
docker --version
# 运行测试容器
docker run hello-world
6.确保 Docker 服务正在运行:
# 检查 Docker 服务状态
docker ps
在你的claude_desktop_config.json
中添加以下配置:
{
"mcpServers": {
"reddit": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e", "REDDIT_CLIENT_ID=你的client_id",
"-e", "REDDIT_CLIENT_SECRET=你的client_secret",
"-e", "REDDIT_USER_AGENT=你的user_agent",
"ghcr.io/nangeplus/mcp-reddit:latest"
]
}
}
}
search_subreddit: 搜索特定subreddit中的帖子
subreddit
: subreddit名称query
: 搜索关键词limit
: 最大返回结果数(默认:5)get_post_details: 获取特定帖子的详细信息
post_id
: Reddit帖子IDcomment_limit
: 获取评论的最大数量(默认:10)get_subreddit_hot: 获取subreddit中的热门帖子
subreddit
: subreddit名称limit
: 返回帖子的最大数量(默认:5)在Claude中,你可以这样使用工具:
{
"tool": "get_subreddit_hot",
"arguments": {
"subreddit": "Python",
"limit": 3
}
}
示例对话:
用户:帮我查看Python subreddit中最热门的3个帖子。
Claude:好的,我来帮你查看。我将使用get_subreddit_hot
工具:
{
"tool": "get_subreddit_hot",
"arguments": {
"subreddit": "Python",
"limit": 3
}
}
[Claude会返回帖子信息]
用户:帮我查看第一个帖子的详细内容和评论。
Claude:我将使用get_post_details
工具:
{
"tool": "get_post_details",
"arguments": {
"post_id": "返回的帖子ID"
}
}
git clone https://github.com/nangeplus/mcp-reddit.git
cd mcp-reddit
pip install -r requirements.txt
python src/server.py
docker build -t mcp-reddit .
docker run -i --rm \
-e REDDIT_CLIENT_ID=你的client_id \
-e REDDIT_CLIENT_SECRET=你的client_secret \
-e REDDIT_USER_AGENT=你的user_agent \
mcp-reddit
安全性
使用限制
故障排除
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情
{
"mcpServers": {
"reddit": {
"env": {},
"args": [
"run",
"-i",
"--rm",
"-e",
"REDDIT_CLIENT_ID=你的client_id",
"-e",
"REDDIT_CLIENT_SECRET=你的client_secret",
"-e",
"REDDIT_USER_AGENT=你的user_agent",
"ghcr.io/nangeplus/mcp-reddit:latest"
],
"command": "docker"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.