Comprehensive Reddit research MCP server using PRAW
Project description
Reddit MCP Server
A focused market research platform for Reddit using PRAW (Python Reddit API Wrapper) built as an MCP (Model Context Protocol) server. This server provides 20 specialized tools for gathering Reddit data, optimized for AI-powered market research and analysis.
Note: This server focuses on data collection while the AI model using this MCP performs the actual analysis. All tools return structured JSON data optimized for AI processing.
Features
This MCP server is optimized for market research, providing 20 focused tools for gathering Reddit data. The AI model using this server will perform the actual analysis.
๐ง Reddit Instance Tools (3)
get_random_subreddit- Get a random subredditcheck_username_available- Check if a username is availableget_reddit_info- Get Reddit instance information
๐๏ธ Subreddit Discovery & Analysis (8)
search_subreddits- Search for subreddits by name or topicget_popular_subreddits- Get popular subredditsget_new_subreddits- Get newly created subredditsget_subreddit_info- Get detailed subreddit informationget_subreddit_rules- Get subreddit rulesget_subreddit_moderators- Get subreddit moderatorsget_subreddit_traffic- Get subreddit traffic stats (requires mod access)get_subreddit_wiki- Get subreddit wiki pages
๐ Content Retrieval (6)
search_subreddit_content- Search for posts within a specific subreddit (keywords, brands)get_hot_posts- Get trending posts from a subredditget_top_posts- Get top posts with time filters (day/week/month/year/all)get_post_details- Get detailed post information including engagement metricsget_post_comments- Get all comments from a post for sentiment analysissearch_all_reddit- Search across all of Reddit for keywords/brands
๐ค User Analysis (1)
search_user_content- Search a specific user's posts and comments
๐ Best Communities (1)
get_best_communities- Get Reddit's curated list of best communities with rankings
๐ Data Export (1)
export_data- Export collected data as JSON or CSV for external analysis
โ Completed Implementation (20 Tools)
All 20 tools have been fully implemented and are ready for use:
- Reddit Instance Tools: 3/3 โ
- Subreddit Discovery & Analysis: 8/8 โ
- Content Retrieval: 6/6 โ
- User Analysis: 1/1 โ
- Best Communities: 1/1 โ
- Data Export: 1/1 โ
๐ฏ Key Features for Market Research
1. Brand Monitoring
- Search for brand mentions across Reddit or within specific communities
- Track competitor discussions and comparisons
- Monitor product launches and announcements
2. Engagement Metrics
- Get upvote ratios, comment counts, and award data
- Track post performance over time
- Identify viral content and trending discussions
3. Time-based Analysis
- Filter content by time periods: hour, day, week, month, year
- Track seasonal trends and patterns
- Monitor real-time discussions with "new" and "hot" sorting
4. Export Capabilities
- Export data as JSON for programmatic analysis
- Export as CSV for Excel, Google Sheets, or BI tools
- Flatten nested data structures automatically
5. Influencer Tracking
- Monitor specific user activity and engagement
- Track user karma and posting patterns
- Analyze influencer impact on discussions
Installation
1. Install the package
# Clone the repository
git clone https://github.com/your-org/reddit-mcp-server
cd reddit-mcp-server
# Install dependencies
pip install -e .
2. Additional Requirements
This server uses Puppeteer for web scraping certain Reddit pages that aren't available through the API (such as the best communities rankings). You'll need:
- Node.js (v14 or higher)
- Puppeteer (installed via npm)
The Puppeteer dependency will need to be installed separately:
# Install Node.js if you don't have it
# On Ubuntu/Debian:
sudo apt-get install nodejs npm
# On macOS with Homebrew:
brew install node
# Install Puppeteer globally
npm install -g puppeteer
Note: The server will attempt to use Puppeteer for the get_best_communities tool. Make sure Puppeteer is properly installed for this feature to work.
Custom Chrome/Chromium Executable: If you have Chrome or Chromium installed in a non-standard location, you can set the PUPPETEER_EXECUTABLE_PATH environment variable to point to your executable. This is useful in Docker containers or systems with custom Chrome installations.
3. Get Reddit API Credentials
- Go to https://www.reddit.com/prefs/apps/
- Click "Create App" or "Create Another App"
- Choose "script" as the app type
- Note down your
client_idandclient_secret
4. Configure Environment Variables
Copy the example environment file and fill in your credentials:
cp .env.example .env
Edit .env with your Reddit API credentials:
# Required credentials
REDDIT_CLIENT_ID=your_client_id_here
REDDIT_CLIENT_SECRET=your_client_secret_here
REDDIT_USER_AGENT=reddit-mcp-server:v1.0.0 (by /u/yourusername)
# Optional - for authenticated access
REDDIT_USERNAME=your_reddit_username
REDDIT_PASSWORD=your_reddit_password
# Optional - for custom Chrome/Chromium executable path
PUPPETEER_EXECUTABLE_PATH=/opt/google/chrome/google-chrome
5. Configure MCP Client
Add the server to your MCP client configuration (e.g., Claude Desktop):
{
\"mcpServers\": {
\"reddit-research\": {
\"command\": \"python\",
\"args\": [\"-m\", \"reddit_mcp_server.server\"],
\"cwd\": \"/path/to/your/reddit-mcp-server\",
\"env\": {
\"REDDIT_CLIENT_ID\": \"your_client_id_here\",
\"REDDIT_CLIENT_SECRET\": \"your_client_secret_here\",
\"REDDIT_USER_AGENT\": \"reddit-mcp-server:v1.0.0 (by /u/yourusername)\",
\"REDDIT_USERNAME\": \"your_reddit_username\",
\"REDDIT_PASSWORD\": \"your_reddit_password\",
\"PUPPETEER_EXECUTABLE_PATH\": \"/opt/google/chrome/google-chrome\"
}
}
}
}
Usage
Quick Start Examples
# 1. Brand Monitoring - Track iPhone 15 discussions
iphone_mentions = search_subreddit_content(
subreddit_name=\"apple\",
query=\"iPhone 15 Pro\",
time_filter=\"week\",
sort=\"top\"
)
# 2. Competitor Analysis - Compare brands
competitor_data = search_all_reddit(
query=\"Samsung Galaxy S24 vs iPhone 15\",
time_filter=\"month\",
limit=100
)
# 3. Market Trends - Find trending topics
trending = get_hot_posts(subreddit_name=\"technology\", limit=50)
top_weekly = get_top_posts(subreddit_name=\"gadgets\", time_filter=\"week\")
# 4. Product Launch Reception - Analyze a specific announcement
post_data = get_post_details(post_id=\"1ac3def\")
user_feedback = get_post_comments(post_id=\"1ac3def\", limit=500, sort=\"best\")
# 5. Influencer Tracking - Monitor key voices
tech_influencer = search_user_content(
username=\"mkbhd\",
content_type=\"posts\",
sort=\"top\",
time_filter=\"month\"
)
# 6. Subreddit Discovery - Find your audience
crypto_communities = search_subreddits(query=\"cryptocurrency\", limit=20)
finance_subs = get_popular_subreddits(limit=50)
# 7. Best Communities - Discover top-ranked communities
best_communities = get_best_communities(page=1)
# Returns ranked communities with member counts and pagination info
# Navigate through pages to explore more communities
page_2_communities = get_best_communities(page=2)
# 8. Export for Analysis
export_data(data={
\"brand_mentions\": iphone_mentions,
\"competitor_analysis\": competitor_data,
\"user_feedback\": user_feedback
}, format=\"csv\")
Complete Market Research Workflow Example
# Step 1: Find relevant subreddits for your market
subreddits = search_subreddits(query=\"electric vehicles\", limit=10)
# Step 2: Explore top-ranked communities in your market
best_communities = get_best_communities(page=1)
# Find highly engaged communities related to your market
for community in best_communities[\"communities\"]:
if \"tech\" in community[\"name\"].lower() or \"electric\" in community[\"name\"].lower():
print(f\"Found relevant community: {community['name']} with {community['members_count']} members\")
# Step 3: Analyze trending discussions in the main subreddit
hot_posts = get_hot_posts(subreddit_name=\"electricvehicles\", limit=50)
# Step 4: Search for specific brand mentions
brand_mentions = search_subreddit_content(
subreddit_name=\"electricvehicles\",
query=\"Tesla Model 3 vs Polestar 2\",
time_filter=\"month\",
sort=\"relevance\"
)
# Step 5: Deep dive into high-engagement posts
for post in brand_mentions[:5]: # Top 5 posts
# Get detailed metrics
post_details = get_post_details(post_id=post[\"id\"])
# Get all comments for sentiment analysis
comments = get_post_comments(post_id=post[\"id\"], limit=200, sort=\"best\")
# Export individual post analysis
export_data(
data={
\"post\": post_details,
\"comments\": comments,
\"metadata\": {
\"subreddit\": \"electricvehicles\",
\"search_query\": \"Tesla Model 3 vs Polestar 2\",
\"collected_date\": \"2025-01-24\"
}
},
format=\"json\"
)
# Step 6: Track influencer opinions
influencers = [\"teslaexpert123\", \"evanalyst\", \"electriccarsguy\"]
influencer_data = []
for username in influencers:
user_content = search_user_content(
username=username,
content_type=\"both\",
sort=\"top\",
time_filter=\"month\"
)
influencer_data.append(user_content)
# Step 7: Export complete dataset for analysis
export_data(
data={
\"market_subreddits\": subreddits,
\"trending_posts\": hot_posts,
\"brand_comparisons\": brand_mentions,
\"influencer_opinions\": influencer_data
},
format=\"csv\"
)
Authentication Modes
Read-Only Mode
- Only requires
REDDIT_CLIENT_ID,REDDIT_CLIENT_SECRET, andREDDIT_USER_AGENT - Can access public content, popular subreddits, search functionality
- Cannot access user-specific data or private subreddits
Authenticated Mode
- Requires all credentials including
REDDIT_USERNAMEandREDDIT_PASSWORD - Full access to Reddit API including private subreddits and user data
- Rate limits apply (60 requests per minute)
Development
Project Structure
src/reddit_mcp_server/
โโโ __init__.py # Package initialization
โโโ server.py # Main MCP server
โโโ reddit_client.py # PRAW wrapper with async support
โโโ puppeteer_client.py # Puppeteer integration for web scraping
โโโ tools/ # Tool implementations
โ โโโ __init__.py
โ โโโ reddit_instance_tools.py
โ โโโ subreddit_tools.py
โ โโโ content_tools.py
โ โโโ user_tools.py
โ โโโ comment_tools.py
โ โโโ advanced_tools.py
โ โโโ best_communities_tools.py
โโโ utils/ # Utility functions
โโโ __init__.py
โโโ export.py
Running Tests
pytest tests/
Code Quality
# Format code
black src/ tests/
# Sort imports
isort src/ tests/
# Type checking
mypy src/
# Linting
ruff src/ tests/
Rate Limits & Best Practices
- Reddit API has a rate limit of 60 requests per minute per OAuth client ID
- The server implements error handling and logging for failed requests
- Use appropriate limits when fetching large datasets
- Consider implementing caching for frequently accessed data
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Use Cases for Market Research
Brand Monitoring
- Track brand mentions and sentiment across Reddit
- Monitor competitor discussions
- Identify emerging trends in your market
Audience Research
- Discover where your target audience congregates
- Analyze discussion patterns and interests
- Track influencer activity and impact
Product Feedback
- Find unfiltered user opinions about products
- Identify common complaints or feature requests
- Track product launch reception
Trend Analysis
- Monitor emerging topics in specific industries
- Track viral content patterns
- Identify seasonal trends and patterns
Support
If you encounter any issues or have questions:
- Check the Issues page
- Review the Reddit API documentation: https://praw.readthedocs.io/
- Create a new issue with detailed information about your problem
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reddit_mcp_server-1.2.0.tar.gz.
File metadata
- Download URL: reddit_mcp_server-1.2.0.tar.gz
- Upload date:
- Size: 30.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09dfbd353581fb260f6e853a79d2b927fa39564812977c8bf9a28e2d236a7cde
|
|
| MD5 |
b047d27cd073c3c93e518e67e9894249
|
|
| BLAKE2b-256 |
f9f0c3e428c2af62490c083d55d8df5d8957ea82896d04f4a02a96943375db42
|
File details
Details for the file reddit_mcp_server-1.2.0-py3-none-any.whl.
File metadata
- Download URL: reddit_mcp_server-1.2.0-py3-none-any.whl
- Upload date:
- Size: 26.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db68b5a3fef218638583691a3e7c2a3381c44d3fe1600cf6e5b6534ca6bc4ce3
|
|
| MD5 |
6cc280f50f602a13b9320faeb5943ae8
|
|
| BLAKE2b-256 |
4ab7f0a8e50ad2deaedc22c131589506ed5b8bfbf25e7457f8aa903081cde9f6
|