mcp-reddit Server

repository·master·Indexed 19 days ago

https://github.com/adhikasp/mcp-reddit

A Model Context Protocol (MCP) server that enables LLMs to fetch and analyze Reddit content. It provides tools such as fetch_reddit_hot_threads to retrieve trending posts from subreddits and fetch_reddit_post_content to retrieve detailed post content and comment trees. Requires REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, and REDDIT_REFRESH_TOKEN environment variables for authentication.

Tokens
803
Snippets
5
Records
7
Agent score
15%

What's inside mcp-reddit

  1. Features of MCP Reddit Server

    master

    The MCP Reddit Server provides tools to interact with Reddit content, specifically allowing for:

    • Fetching hot threads from any subreddit.
    • Retrieving detailed post content, including associated comments.
    • Support for various post types such as text, link, and gallery.
  2. Manual Installation of MCP Reddit Server

    master

    If you are configuring an MCP client manually, add the following configuration to your client settings. This installation uses uvx to run the server directly from the GitHub repository.

    {
      "reddit": {
        "command": "uvx",
        "args": ["--from", "git+https://github.com/adhikasp/mcp-reddit.git", "mcp-reddit"],
        "env": {}
      }
    }
  3. Example usage with mcp-client-cli

    master

    Once installed, you can use the server through an MCP client. For example, using mcp-client-cli, you can ask natural language questions about specific subreddits, and the client will invoke tools like fetch_hot_threads to retrieve the data.

    $ llm what are latest hot thread in r/victoria3
  4. Configure Reddit API credentials via environment variables

    master

    The Reddit MCP server requires the following environment variables to authenticate with the Reddit API via redditwarp:

    • REDDIT_CLIENT_ID: Your Reddit application client ID.
    • REDDIT_CLIENT_SECRET: Your Reddit application client secret.
    • REDDIT_REFRESH_TOKEN: Your Reddit refresh token.

    All three must be provided for the client to initialize correctly.

  5. Fetch hot threads from a subreddit with `fetch_reddit_hot_threads`

    master

    Use the fetch_reddit_hot_threads tool to retrieve a list of currently trending (hot) posts from a specific subreddit. The tool returns a human-readable string containing the title, score, comment count, author, post type, content (or link), and a direct Reddit URL for each post.

    Arguments:

    • subreddit (str): The name of the subreddit to query.
    • limit (int, default: 10): The maximum number of posts to fetch.
    # Example tool call via MCP
    await fetch_reddit_hot_threads(subreddit="python", limit=5)
  6. Fetch detailed post content and comments with `fetch_reddit_post_content`

    master

    Use the fetch_reddit_post_content tool to retrieve the full details of a specific Reddit post, including its body/link and a formatted tree of comments.

    Arguments:

    • post_id (str): The unique Reddit post ID.
    • comment_limit (int, default: 20): The number of top-level comments to fetch.
    • comment_depth (int, default: 3): The maximum depth of the comment tree to traverse.

    Returns: A human-readable string containing the post's title, score, author, type, content, and a nested list of comments with their authors, scores, and bodies.

    # Example tool call via MCP
    await fetch_reddit_post_content(post_id="1abcde", comment_limit=10, comment_depth=2)