Reddit platform integration module with OAuth2 authentication and complete Reddit API access functionality.
- Visit Reddit Apps
- Click "Create App" or "Create Another App"
- Fill in application information:
- Name: Application name (e.g., PersonalizationMCP)
- App type: Select "web app"
- Description: Application description (optional)
- About URL: About page URL (optional)
- Redirect URI:
http://localhost:8888/callback
- After creation, record the following information:
- Client ID: Application ID (below the app name)
- Client Secret: Client secret key
Add Reddit configuration to the config file in the project root directory:
# Reddit API Configuration
REDDIT_CLIENT_ID=your_client_id_here
REDDIT_CLIENT_SECRET=your_client_secret_here
REDDIT_REDIRECT_URI=http://localhost:8888/callback# 1. Setup OAuth2 authentication
setup_result = mcp_personalhub_setup_reddit_oauth(
client_id="your_client_id",
client_secret="your_client_secret"
)
# 2. Visit the returned authentication URL for authorization
# User needs to visit the auth URL in browser and authorize
# 3. Complete authentication (after getting authorization code)
complete_result = mcp_personalhub_complete_reddit_oauth(
client_id="your_client_id",
client_secret="your_client_secret",
authorization_code="authorization_code_from_callback"
)If you already have valid access tokens, you can configure directly:
REDDIT_ACCESS_TOKEN=your_access_token
REDDIT_REFRESH_TOKEN=your_refresh_token- User Overview: Get mixed timeline of posts and comments
- Karma Breakdown: View karma distribution across subreddits
- User Preferences: Get account settings and preferences
- Trophies & Achievements: View Reddit trophies and achievements
- Submitted Posts: Get all user-submitted posts
- Comment History: View user's comment records
- Saved Content: Get saved posts and comments
- Hidden Posts: View hidden content
- Voting Records: Get upvoted/downvoted content
- Subscribed Subreddits: View followed communities
- Moderated Communities: Get subreddits where user is moderator
- Contributor Permissions: View subreddits with contributor access
- Inbox: Get all messages
- Unread Messages: View unread messages
- Sent Messages: View sent message history
# Configuration status check
get_reddit_config()
test_reddit_credentials()
# OAuth2 authentication flow
setup_reddit_oauth(client_id, client_secret, redirect_uri?)
complete_reddit_oauth(client_id, client_secret, authorization_code, redirect_uri?)
# Token management
get_reddit_token_status()
refresh_reddit_token()
auto_refresh_reddit_token_if_needed()# Basic information
get_user_subreddits(access_token?, limit=100)
get_user_trophies(access_token?)
get_user_preferences(access_token?)
get_user_karma_breakdown(access_token?)
# Community permissions
get_moderated_subreddits(access_token?, limit=100)
get_contributor_subreddits(access_token?, limit=100)# Posts and comments
get_user_submitted_posts(username?, access_token?, limit=100, sort="new")
get_user_comments(username?, access_token?, limit=100, sort="new")
get_user_overview(username?, access_token?, limit=100, sort="new")
# Saved and interactions
get_saved_content(username?, access_token?, limit=100)
get_hidden_posts(username?, access_token?, limit=100)
get_upvoted_content(username?, access_token?, limit=100)
get_downvoted_content(username?, access_token?, limit=100)# Message management (requires privatemessages scope)
get_inbox_messages(access_token?, limit=100)
get_unread_messages(access_token?, limit=100)
get_sent_messages(access_token?, limit=100)# Get recent posts and comments
overview = get_user_overview(limit=20, sort="new")
# Get subscribed communities
subreddits = get_user_subreddits(limit=50)
# Get karma distribution
karma = get_user_karma_breakdown()# Get submitted posts
posts = get_user_submitted_posts(limit=10, sort="top")
# Get comment history
comments = get_user_comments(limit=10, sort="new")
# Get saved content
saved = get_saved_content(limit=20)# Get inbox messages
inbox = get_inbox_messages(limit=10)
# Get unread messages
unread = get_unread_messages(limit=5)Reddit API uses the following OAuth2 permission scopes:
identity: Access user basic informationread: Read user content and subscriptionshistory: Access voting and hidden content historyprivatemessages: Access private messages (optional, requires special permission)
- Request Rate: Reddit API has strict rate limiting
- Permission Requirements: Some features require specific OAuth permissions
- Data Access: Can only access data for the currently authenticated user
- User privacy settings may affect data retrieval
- Some content may be inaccessible due to user settings
- Private messaging functionality requires additional permission requests
- Access tokens are valid for 1 hour
- Refresh tokens can be used to automatically update access tokens
- Recommended to use
auto_refresh_reddit_token_if_needed()for automatic token management
-
403 Forbidden Error
- Check OAuth permission scopes
- Verify token validity
- Confirm user privacy settings
-
Authentication Failure
- Ensure Client ID and Secret are correct
- Check redirect URI matches
- Verify authorization code hasn't expired
-
Empty Data Returns
- May be due to user privacy setting restrictions
- Check query parameters (username, limits, etc.)
- Confirm user has relevant content
- Use
get_reddit_config()to check configuration status - Use
test_reddit_credentials()to verify credentials - Check
get_reddit_token_status()to understand token status