Skip to content

verma6uc/reddit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MCP Reddit Server

A robust Model Context Protocol (MCP) server for fetching and analyzing Reddit content. Built by Glue.tools to provide seamless Reddit integration for AI assistants.

Features

✨ Comprehensive Reddit Access

  • Fetch hot, new, top, controversial, and rising posts
  • Get detailed post content with full comment trees
  • Support for all post types (text, link, gallery, video)
  • Robust error handling for private/banned subreddits

πŸ” Powerful Search & Discovery

  • Search across all of Reddit or within specific subreddits
  • Find related subreddits and trending communities
  • Get detailed subreddit information and statistics

πŸ‘€ User Analysis & Insights

  • Get user profiles, karma, and account information
  • Analyze user's posts and comments
  • Discover which subreddits users are most active in

πŸ“Š Content Analysis & Intelligence

  • Sentiment analysis of subreddit posts
  • Popular keyword extraction and trending topics
  • Subreddit activity tracking and metrics

πŸ”’ Flexible Authentication

  • Works with full Reddit API credentials (recommended)
  • Supports anonymous mode with limited functionality
  • Automatic fallback handling

🎯 Smart Content Parsing

  • Hierarchical comment threading with proper indentation
  • Content type detection and appropriate extraction
  • Link resolution for external URLs

Installation

Option 1: Direct Installation (Recommended)

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "reddit": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/glue-tools/mcp-reddit.git", "mcp-reddit"],
      "env": {
        "REDDIT_CLIENT_ID": "your_client_id",
        "REDDIT_CLIENT_SECRET": "your_client_secret",
        "REDDIT_REFRESH_TOKEN": "your_refresh_token"
      }
    }
  }
}

Option 2: Local Development

git clone https://github.com/glue-tools/mcp-reddit.git
cd mcp-reddit
pip install -e .

Authentication Setup (Optional but Recommended)

  1. Go to Reddit App Preferences
  2. Click "Create App" or "Create Another App"
  3. Choose "script" type
  4. Set redirect URI to http://localhost:8080
  5. Note your client ID and secret
  6. Generate a refresh token using Reddit's OAuth flow

Without authentication, the server runs in anonymous mode with rate limiting.

Available Tools

πŸ”₯ Post Fetching & Sorting

fetch_hot_threads

Fetch hot posts from any subreddit.

fetch_hot_threads(subreddit="programming", limit=5)

fetch_top_threads

Fetch top posts from a subreddit within a timeframe.

fetch_top_threads(subreddit="python", timeframe="week", limit=10)

fetch_new_threads

Fetch newest posts from a subreddit.

fetch_new_threads(subreddit="technology", limit=15)

fetch_controversial_threads

Fetch controversial posts from a subreddit.

fetch_controversial_threads(subreddit="politics", timeframe="month", limit=5)

fetch_rising_threads

Fetch rising posts from a subreddit.

fetch_rising_threads(subreddit="startups", limit=10)

fetch_post_content

Get detailed post content with comment trees.

fetch_post_content(post_id="1a2b3c4", comment_limit=20, comment_depth=3)

πŸ” Search & Discovery

search_reddit

Search across Reddit or within specific subreddits.

search_reddit(query="artificial intelligence", subreddit="MachineLearning", sort="top", limit=10)

search_subreddit

Search within a specific subreddit (alias for search_reddit).

search_subreddit(subreddit="programming", query="python tutorial", limit=5)

get_subreddit_info

Get detailed subreddit information and statistics.

get_subreddit_info(subreddit="python")

find_related_subreddits

Find subreddits related to a given subreddit.

find_related_subreddits(subreddit="webdev", limit=10)

get_trending_subreddits

Get currently trending subreddits.

get_trending_subreddits(limit=15)

πŸ‘€ User Analysis

get_user_profile

Get user profile information and statistics.

get_user_profile(username="spez")

get_user_posts

Get user's recent posts.

get_user_posts(username="AutoModerator", limit=10)

get_user_comments

Get user's recent comments.

get_user_comments(username="poem_for_your_sprog", limit=15)

get_user_subreddits

Discover which subreddits a user is most active in.

get_user_subreddits(username="gallowboob", limit=25)

πŸ“Š Content Analysis

analyze_sentiment

Analyze sentiment of recent posts in a subreddit.

analyze_sentiment(subreddit="bitcoin", limit=50)

get_popular_keywords

Extract popular keywords from subreddit posts.

get_popular_keywords(subreddit="artificial", limit=30)

track_subreddit_activity

Track subreddit activity metrics over time.

track_subreddit_activity(subreddit="reactjs", timeframe="week")

πŸš€ Advanced Features

get_multireddit

Get content from multireddits (authenticated).

get_multireddit(multi_path="username/tech_news", limit=10)

get_saved_posts

Get your saved posts (requires authentication).

get_saved_posts(limit=20)

get_live_thread

Monitor live threads (limited support).

get_live_thread(thread_id="12345")

Error Handling

The server provides detailed error messages for common issues:

  • Invalid subreddit: "Subreddit r/example not found"
  • Private subreddit: "r/example is private or banned"
  • Rate limiting: "Rate limit exceeded. Please try again later"
  • Deleted posts: "Post with ID 'xyz' has been deleted or removed"

Usage Examples

Basic Subreddit Browsing

Human: What's trending in r/technology?
Assistant: I'll fetch the latest hot threads from r/technology for you.

Tool: fetch_hot_threads(subreddit="technology", limit=5)

Based on the hot threads in r/technology:

1. **"OpenAI announces GPT-5 with breakthrough reasoning capabilities"**
   - Score: 12,400 | Comments: 2,145
   - Author: tech_insider_2024
   - Link: https://example-news-site.com/gpt5-announcement

2. **"Tesla's new battery technology achieves 1000-mile range"**
   - Score: 8,730 | Comments: 1,432
   - Author: ev_enthusiast
   - Type: Link post with technical specifications

3. **"Major security vulnerability found in popular IoT devices"**
   - Score: 6,890 | Comments: 891
   - Author: security_researcher
   - Detailed technical analysis in post content

Deep Dive into Specific Posts

Human: Tell me more about that OpenAI post and what people are saying

Tool: fetch_post_content(post_id="abc123", comment_limit=15, comment_depth=3)

The post reveals extensive community discussion:

Top Comments:
β€’ **dev_veteran** (Score: 1,240)
  "This is a game-changer for software development. The reasoning improvements are incredible."

  -- **ai_skeptic** (Score: 340)
     "Let's wait and see. Remember the hype around GPT-4?"

     -- **tech_realist** (Score: 120)
        "Fair point, but the demos look promising this time"

β€’ **startup_founder** (Score: 890)
  "Already integrating this into our platform. The API response quality is noticeably better."

Contributing

We welcome contributions! This project is maintained by Glue.tools.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with proper error handling
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

Changelog

v0.3.0 (Latest) - Major Feature Update

  • πŸ”₯ Enhanced Post Sorting: Added fetch_top_threads, fetch_new_threads, fetch_controversial_threads, fetch_rising_threads
  • πŸ” Search Functionality: Added search_reddit, search_subreddit with multiple sort options
  • πŸ‘€ User Analysis: Added get_user_profile, get_user_posts, get_user_comments, get_user_subreddits
  • 🌟 Subreddit Discovery: Added get_subreddit_info, find_related_subreddits, get_trending_subreddits
  • πŸ“Š Content Analysis: Added analyze_sentiment, get_popular_keywords, track_subreddit_activity
  • πŸš€ Advanced Features: Added get_multireddit, get_saved_posts, get_live_thread
  • 🎯 18 total tools - Complete Reddit API coverage

v0.2.0

  • βœ… Fixed authentication handling for anonymous mode
  • βœ… Fixed link post content extraction
  • βœ… Improved error handling with specific messages
  • βœ… Added input validation and rate limit handling
  • βœ… Renamed functions for consistency

v0.1.0

  • Initial release with basic Reddit fetching functionality

Built with ❀️ by Glue.tools - Making AI integrations seamless.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5