Reddit MCP Server

Reddit MCP Server

Enables AI agents to search, read, and analyze Reddit content, including posts, comments, subreddits, and user profiles using natural language commands. It provides atomic tools for interacting with the Reddit API to retrieve trending topics and community metadata.

Category
访问服务器

README

Reddit MCP Server

A Model Context Protocol (MCP) server that provides atomic tools for interacting with Reddit's API. This server enables AI agents to search, read, and analyze Reddit content through natural language commands.

Features

  • Search Reddit posts by keywords, subreddits, and time periods
  • Get post details including comments, scores, and metadata
  • List subreddits with trending topics and community information
  • Get user profiles and their recent activity
  • Search comments across Reddit
  • Get trending posts from specific subreddits

Installation

Prerequisites

  • Python 3.8 or higher
  • Reddit API credentials (Client ID and Client Secret)

Setup

  1. Clone or download this repository

  2. Install dependencies

    pip install -r requirements.txt
    
  3. Get Reddit API Credentials

    To use this MCP server, you need to create a Reddit application:

    1. Go to https://www.reddit.com/prefs/apps
    2. Click "Create App" or "Create Another App"
    3. Select "script" as the application type
    4. Fill in the required fields:
      • Name: Your app name (e.g., "MCP Reddit Server")
      • Description: Brief description
      • About URL: Can be left blank
      • Redirect URI: Use http://localhost:8080 (not actually used for script apps)
    5. Click "Create App"
    6. Note down your Client ID (the string under your app name) and Client Secret
  4. Configure Environment Variables

    Create a .env file in the project root or set these environment variables:

    export REDDIT_CLIENT_ID="your_client_id_here"
    export REDDIT_CLIENT_SECRET="your_client_secret_here"
    export REDDIT_USER_AGENT="MCP_Reddit_Server/1.0 (by /u/your_username)"
    

Usage

Running the Server

python reddit_mcp_server.py

The server will start on localhost:8080 by default.

Connecting to an MCP Client

Add this server to your MCP client configuration:

{
  "mcpServers": {
    "reddit": {
      "command": "python",
      "args": ["/path/to/reddit_mcp_server.py"],
      "env": {
        "REDDIT_CLIENT_ID": "your_client_id",
        "REDDIT_CLIENT_SECRET": "your_client_secret",
        "REDDIT_USER_AGENT": "MCP_Reddit_Server/1.0"
      }
    }
  }
}

Available Tools

search_reddit_posts

Search for posts across Reddit or within specific subreddits.

Parameters:

  • query (string, required): Search terms
  • subreddit (string, optional): Limit search to specific subreddit
  • limit (integer, optional): Number of results (default: 10, max: 100)
  • time_filter (string, optional): Time period (hour, day, week, month, year, all)

Example Usage:

  • "Search for posts about Python programming"
  • "Find recent posts about machine learning in r/MachineLearning"
  • "Get the top 20 posts about AI from the past week"

get_post_details

Get detailed information about a specific Reddit post.

Parameters:

  • post_id (string, required): Reddit post ID or full URL

Example Usage:

  • "Get details for post t3_abc123"
  • "Show me the full post and comments for https://reddit.com/r/Python/comments/abc123"

list_subreddits

Get information about subreddits, including trending topics.

Parameters:

  • query (string, optional): Search for specific subreddits
  • limit (integer, optional): Number of results (default: 10)

Example Usage:

  • "List popular programming subreddits"
  • "Find subreddits about data science"

get_user_profile

Get information about a Reddit user and their recent activity.

Parameters:

  • username (string, required): Reddit username

Example Usage:

  • "Get profile for user u/spez"
  • "Show me the recent posts by u/username"

search_comments

Search for comments across Reddit.

Parameters:

  • query (string, required): Search terms
  • subreddit (string, optional): Limit search to specific subreddit
  • limit (integer, optional): Number of results (default: 10)

Example Usage:

  • "Search for comments about React hooks"
  • "Find comments about Docker in r/docker"

get_trending_posts

Get trending posts from a specific subreddit.

Parameters:

  • subreddit (string, required): Subreddit name (without r/)
  • limit (integer, optional): Number of results (default: 10)
  • time_filter (string, optional): Time period (hour, day, week, month, year, all)

Example Usage:

  • "Get trending posts from r/Python"
  • "Show me the top posts from r/technology this week"

Error Handling

The server includes robust error handling for:

  • Invalid API credentials
  • Rate limiting (Reddit API has rate limits)
  • Network connectivity issues
  • Invalid parameters
  • Missing or malformed responses

All errors are returned with clear, actionable messages that help the AI understand what went wrong and potentially self-correct.

Rate Limiting

Reddit's API has rate limits:

  • 60 requests per minute for authenticated requests
  • The server automatically handles rate limiting and will retry requests when possible

Security Notes

  • Never commit your Reddit API credentials to version control
  • Use environment variables for all sensitive configuration
  • The server only makes read-only requests to Reddit's API
  • No user authentication is required for public data access

Contributing

This MCP server follows the Klavis AI development guidelines:

  • Atomic, single-purpose tools
  • Clear, descriptive tool names and descriptions
  • Comprehensive error handling
  • User-centric design for AI agents

License

This project is part of the Klavis AI MCP server collection.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选