MCP Server for Reddit official API
概览
A Model Context Protocol (MCP) server that provides read-only tools for browsing and searching Reddit content through Reddit's official API. Built with for seamless integration and automatic serialization. This server allows you to search for posts, read post details, and get subreddit information through MCP-compatible clients. - 🔍 : Search for posts in specific subreddits with various sorting and filtering options - 🌐 : Search across all of Reddit with keyword queries - 📊 : Retrieve detailed information about subreddits - 🔥 : Fetch hot posts from subreddits - 📋 : Get comprehensive details about specific posts - ⚡ : Built with FastMCP for automatic serialization and seamless MCP compatibility 1. installed on your system 2. package manager installed (installation guide) 3. (see setup section below) - Go to Reddit App Preferences - Click "Create App" or "Create Another App" - Choose "script" for the app type - Fill in the required fields: - Name: Your app name (e.g.
README
以下为原文 README 节选,完整内容请查看原文。
Reddit MCP Tool
A Model Context Protocol (MCP) server that provides read-only tools for browsing and searching Reddit content through Reddit’s official API. Built with FastMCP for seamless integration and automatic serialization. This server allows you to search for posts, read post details, and get subreddit information through MCP-compatible clients.
Features
- 🔍 Search Posts: Search for posts in specific subreddits with various sorting and filtering options
- 🌐 Site-wide Search: Search across all of Reddit with keyword queries
- 📊 Get Subreddit Info: Retrieve detailed information about subreddits
- 🔥 Get Hot Posts: Fetch hot posts from subreddits
- 📋 Get Post Details: Get comprehensive details about specific posts
- ⚡ FastMCP Integration: Built with FastMCP for automatic serialization and seamless MCP compatibility
Prerequisites
- Python 3.10+ installed on your system
- uv package manager installed (installation guide)
- Reddit API credentials (see setup section below)
Reddit API Setup
-
Create a Reddit App:
- Go to Reddit App Preferences
- Click “Create App” or “Create Another App”
- Choose “script” for the app type
- Fill in the required fields:
- Name: Your app name (e.g., “Reddit MCP Tool”)
- Description: Brief description
- About URL: Can be blank
- Redirect URI: http://localhost:8080 (required but not used)
-
Get Your Credentials:
- Client ID: Found under your app name (short string)
- Client Secret: Found in the app details (longer string)
Installation
-
Clone or download this repository:
git clone cd reddit-mcp-tool -
Install dependencies using uv:
uv sync -
Quick setup (recommended):
uv run python scripts/setup.pyThis will create your
.envfile and show you what to do next. -
Manual setup:
cp env.example .envEdit the
.envfile with your Reddit API credentials:REDDIT_CLIENT_ID=your_client_id_here REDDIT_CLIENT_SECRET=your_client_secret_here REDDIT_USER_AGENT=reddit-mcp-tool:v0.2.0 (by /u/yourusername) -
Test your setup:
uv run python scripts/test_basic.pyNote: This server operates in read-only mode and only requires the client ID, secret, and user agent for basic API access.
Troubleshooting
If you encounter issues, see TROUBLESHOOTING.md for detailed solutions to common problems.
Usage
Running the MCP Server
uv run reddit-mcp-tool
Or directly with Python:
uv run python -m reddit_mcp.server
Available Tools
1. Search Reddit Posts (Subreddit-specific)
Search for posts in a specific subreddit:
{
"name": "search_reddit_posts",
安装
uvx reddit-mcp-tool@latest配置
{
"mcpServers": {
"reddit-mcp-tool": {
"command": "uvx",
"args": ["reddit-mcp-tool@latest"],
"env": {
"REDDIT_CLIENT_ID": "your_client_id_here",
"REDDIT_CLIENT_SECRET": "your_client_secret_here",
"REDDIT_USER_AGENT": "reddit-mcp-tool:v0.2.0 (by /u/yourusername)"
}
}
}
}