Reddit MCP Server

Reddit MCP Server

Provides AI assistants with read-only access to Reddit's API for browsing subreddits, reading posts and comments, searching Reddit, and retrieving user/subreddit information. Enables safe exploration of Reddit content without posting capabilities through natural language interactions.

Category
访问服务器

README

Reddit MCP Server

A comprehensive Model Context Protocol (MCP) server that provides AI assistants with read-only access to Reddit's API. This server enables Claude and other MCP-compatible AI assistants to browse subreddits, read posts and comments, search Reddit, and get user/subreddit information.

Features

🛠️ Available Tools

  • get_subreddit_posts - Browse posts from any subreddit with flexible sorting options
  • get_post_details - Get detailed information about specific posts
  • get_post_comments - Read comments from any post with various sorting methods
  • search_reddit - Search across Reddit or within specific subreddits
  • get_user_profile - View public user profiles and recent activity
  • get_subreddit_info - Get subreddit details, rules, and moderation info

✨ Key Benefits

  • Read-only access - Safe browsing without posting capabilities
  • Comprehensive error handling - Graceful handling of API limits and errors
  • Flexible parameters - Customizable limits, sorting, and filtering options
  • Rich formatting - Well-structured responses with all relevant metadata
  • Rate limit compliant - Respects Reddit's API guidelines

Installation

Prerequisites

  1. Reddit API Credentials

    • Go to Reddit App Preferences
    • Click "Create another app..."
    • Choose "script" as the app type
    • Set redirect URI to http://localhost:8080
    • Save your Client ID and Client Secret
  2. Python Environment

    • Python 3.8 or higher
    • pip package manager

Setup Steps

  1. Clone and install:
git clone https://github.com/yourusername/reddit-mcp-server.git
cd reddit-mcp-server
pip install -r requirements.txt
  1. Configure environment:
cp .env.example .env
# Edit .env with your Reddit API credentials
  1. Environment variables:
REDDIT_CLIENT_ID=your_reddit_client_id_here
REDDIT_CLIENT_SECRET=your_reddit_client_secret_here
REDDIT_USER_AGENT=RedditMCPServer/1.0.0

Install via pip (Coming Soon)

pip install reddit-mcp-server

Usage

With Claude Desktop

Add to your Claude Desktop configuration file:

Location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json

Configuration:

{
  "mcpServers": {
    "reddit": {
      "command": "python",
      "args": ["/path/to/reddit-mcp-server/server.py"],
      "env": {
        "REDDIT_CLIENT_ID": "your_client_id",
        "REDDIT_CLIENT_SECRET": "your_client_secret",
        "REDDIT_USER_AGENT": "RedditMCPServer/1.0.0"
      }
    }
  }
}

Standalone Usage

python server.py

Tool Examples

Get Subreddit Posts

Ask Claude: "Get the top 10 hot posts from r/python"

This uses: get_subreddit_posts(subreddit="python", sort="hot", limit=10)

Search Reddit

Ask Claude: "Search for posts about machine learning in r/MachineLearning from the past week"

This uses: search_reddit(query="machine learning", subreddit="MachineLearning", time_filter="week")

Get Post Details

Ask Claude: "Get details and comments for this Reddit post: [post URL]"

This uses: get_post_details(post_id="url", include_comments=true)

User Profile

Ask Claude: "What can you tell me about Reddit user spez?"

This uses: get_user_profile(username="spez")

Tool Reference

get_subreddit_posts

Browse posts from a specific subreddit.

Parameters:

  • subreddit (required): Subreddit name without "r/"
  • sort: "hot", "new", "rising", "top" (default: "hot")
  • time_filter: For "top" sort - "hour", "day", "week", "month", "year", "all"
  • limit: Number of posts (1-100, default: 25)

get_post_details

Get comprehensive information about a specific post.

Parameters:

  • post_id (required): Reddit post ID or full URL
  • include_comments: Include top comments (default: false)

get_post_comments

Retrieve comments from a post with flexible sorting.

Parameters:

  • post_id (required): Reddit post ID or full URL
  • sort: "best", "top", "new", "controversial" (default: "best")
  • limit: Number of comments (1-100, default: 50)

search_reddit

Search Reddit posts with advanced filtering.

Parameters:

  • query (required): Search terms
  • subreddit: Limit to specific subreddit (optional)
  • sort: "relevance", "hot", "top", "new", "comments" (default: "relevance")
  • time_filter: "hour", "day", "week", "month", "year", "all" (default: "all")
  • limit: Number of results (1-100, default: 25)

get_user_profile

Get public information about a Reddit user.

Parameters:

  • username (required): Reddit username without "u/"

get_subreddit_info

Get detailed information about a subreddit.

Parameters:

  • subreddit (required): Subreddit name without "r/"

Error Handling

The server includes comprehensive error handling for:

  • Invalid subreddit names
  • Non-existent posts or users
  • Reddit API rate limits
  • Network connectivity issues
  • Malformed requests

All errors are returned as descriptive text messages to help users understand what went wrong.

Rate Limiting & Best Practices

  • The server respects Reddit's API rate limits (60 requests per minute)
  • Implements proper error handling for rate limit exceeded scenarios
  • Uses efficient PRAW configurations to minimize API calls
  • Includes appropriate User-Agent strings for identification

Security & Privacy

  • Read-only access: Cannot post, comment, or modify any Reddit content
  • No authentication storage: Uses app-only authentication (no user tokens)
  • Privacy-focused: Only accesses publicly available Reddit data
  • No data persistence: Does not store or cache any Reddit data locally

Development

Project Structure

reddit-mcp-server/
├── server.py              # Main MCP server implementation
├── requirements.txt       # Python dependencies
├── .env.example          # Environment template
├── setup.py              # Package configuration
├── README.md             # Documentation
└── tests/                # Test suite (coming soon)

Running Tests

# Install development dependencies
pip install -r requirements-dev.txt

# Run tests
pytest tests/

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for new functionality
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Troubleshooting

Common Issues

"Invalid credentials" error:

  • Verify your Reddit API credentials in the .env file
  • Ensure the Reddit app is configured as "script" type
  • Check that the User-Agent string is properly formatted

"Subreddit not found" error:

  • Verify the subreddit name is correct (without "r/" prefix)
  • Check if the subreddit is private or banned
  • Ensure the subreddit name is spelled correctly

Rate limit errors:

  • Wait a few minutes before making more requests
  • Consider reducing the limit parameter in your requests
  • The server automatically handles most rate limiting scenarios

MCP connection issues:

  • Verify the path to server.py in your Claude configuration
  • Check that all required environment variables are set
  • Ensure Python and dependencies are properly installed

Debug Mode

To run the server with detailed logging:

export MCP_DEBUG=1
python server.py

Changelog

Version 1.0.0

  • Initial release
  • Core Reddit API tools implementation
  • Comprehensive error handling
  • Production-ready MCP server

License

MIT License - see LICENSE file for details.

Support

Related Projects


Built for the MCP community

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选