reddit-mcp-server

reddit-mcp-server

Enables AI models to search, fetch, and read Reddit content with resilient rate-limit handling and smart comment filtering, including zero-config fallback to alternative sources.

Category
Visit Server

README

πŸ€– Reddit MCP Server (AI-Native Edition)

CI Status Python Version License: MIT Zero Config

A highly resilient, open-source Model Context Protocol (MCP) server. It empowers AI models (such as Claude and Cursor) to search, fetch, read, and deep-dive into Reddit content with robust rate-limiting recovery and smart comment-filtering.

Built in Python using FastMCP, this project adheres to a strict 4-Layer Architecture designed for high modularity, testability, and painless contributions.


πŸ—ΊοΈ How it Works (Data Flow Sequence)

Here is a visual sequence diagram showing how the AI model interacts with this server, including our Zero-Config Fallback system:

sequenceDiagram
    autonumber
    actor AI as AI Assistant (Claude/Cursor)
    participant MCP as FastMCP Server (STDIO)
    participant Tools as Application Tools
    participant Reddit as Reddit API (OAuth)
    participant Fallback as DDG & Arctic Shift

    AI->>MCP: Request (e.g., search_knowledge)
    MCP->>Tools: Route request
    Tools->>Reddit: Attempt Fetch (Resilient HTTP)
    alt Has OAuth Credentials & API Healthy
        Note over Reddit,Tools: Handles 429 (Rate Limits) with Retry-After backoff!
        Reddit-->>Tools: Return Official JSON payload
    else Zero-Config OR Reddit API Fails
        Note over Tools,Fallback: Graceful Degradation Active
        Tools->>Fallback: Execute Search / Fetch Archive
        Fallback-->>Tools: Return Alternative JSON payload
    end
    Tools->>Tools: Refine comments (filter bots & short noise)
    Tools-->>MCP: Map to Domain Models (Pydantic)
    MCP-->>AI: Return clean JSON-RPC Response (stdout-safe)

✨ Features

  • πŸš€ Zero-Config Ready: Works completely out of the box! No Reddit API keys required. If credentials are not provided, it seamlessly falls back to DuckDuckGo and the Arctic Shift archive.
  • πŸ›‘οΈ Graceful Degradation: Intelligently switches between the official Reddit API and unauthenticated fallback providers without crashing, ensuring the LLM always gets data.
  • πŸ“ˆ Resilient HTTP Client: Built-in exponential backoff and rate-limiting recovery. If Reddit says 429 Too Many Requests, the server respects the Retry-After header and retries automatically.
  • πŸ” Strategic Search: Integrates a decoupled search provider system (Strategy Pattern) allowing easy addition of custom search engines.
  • πŸ€– LLM-Safe Filtering: Cleans thread payloads by dropping auto-moderators, bot notifications, and low-quality comments, saving precious LLM token costs.
  • ⏱️ Strict LLM Timeout Protection: Uses decorators to force safe API timeouts, returning clean graceful JSON-RPC fallbacks instead of hanging the AI client.

🧰 Available Tools

Tool Name Purpose Best Used For
search_knowledge Broad web search via DuckDuckGo Finding technical explanations and factual discussions across Reddit.
explore_reddit_discussions Discussion search with metrics Gauging sentiment, upvote consensus, and topic exploration.
extract_public_opinion Deep comment tree extraction & filtering Reading high-quality community opinions with noise & bots removed.
analyze_niche_trends Live trending & rising posts tracker Identifying real-time problems, pain points, or new ideas in a niche.

βš™οΈ Prerequisites & Setup

Requirements

  • Python 3.11 or higher
  • Reddit API App credentials (Optional, but recommended for live trending data & better rate limits)

Quick Start (Local Installation)

  1. Clone and Install:
git clone https://github.com/ismailsaoulaj/reddit-mcp-server.git
cd reddit-mcp-server
pip install -e .
  1. Configure your environment (Optional):

To unlock the official Reddit API, create a .env file in the root directory:

REDDIT_CLIENT_ID="your_client_id_here"
REDDIT_CLIENT_SECRET="your_client_secret_here"

🐳 Docker Installation

A multi-stage Dockerfile is provided for seamless execution.

docker build -t reddit-mcp-server .

Note: If using Docker, replace the command in client configs with docker and arguments with run -i --rm reddit-mcp-server.


πŸ› οΈ Configuration for AI Clients

1. Claude Desktop

Edit your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "reddit": {
      "command": "hatch",
      "args": [
        "run",
        "reddit-mcp"
      ],
      "cwd": "/absolute/path/to/reddit-mcp-server"
    }
  }
}

2. Cursor

Go to Settings > Features > MCP and add a new command-based server:

  • Type: command
  • Name: Reddit
  • Command: hatch run reddit-mcp (using the absolute path to your python/hatch environment)

πŸ§ͺ Developer Experience (DX) & Testing

We prioritize high test coverage. We mock all network traffic, ensuring tests run instantly and reliably.

Run Tests

# Install development dependencies
pip install -e ".[dev]"

# Execute pytest
pytest tests/

Manual Testing with the MCP Inspector

npx @modelcontextprotocol/inspector hatch run reddit-mcp

This will launch a web browser UI where you can invoke the search_knowledge, explore_reddit_discussions, extract_public_opinion, and analyze_niche_trends tools directly and inspect the JSON responses.


🀝 Contributing & Architecture

We love contributions! Please check out docs/architecture.md for architectural details and view src/reddit_mcp/infrastructure/search/providers/README.md to learn how to add a new search provider in seconds.

Please make sure your PR passes all linter checks (ruff check .) and unit tests (pytest tests/) before submitting.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured