This guide will walk you through obtaining Reddit API credentials for the Fantasy Football MCP Server's sentiment analysis feature.
The app uses Reddit's API (via the PRAW library) to analyze fantasy football player sentiment from subreddits like:
- r/fantasyfootball
- r/DynastyFF
- r/Fantasy_Football
- r/nfl
-
Go to Reddit's App Preferences
- Visit: https://www.reddit.com/prefs/apps
- You must be logged into your Reddit account
-
Create a New Application
- Scroll to the bottom and click "create another app..." or "create app"
- Fill in the application details:
- Name:
Fantasy Football MCP(or any name you prefer) - Type: Select "script" (this is important!)
- Description: Optional - e.g., "Fantasy football sentiment analysis"
- About URL: Leave blank or add your GitHub repo URL
- Redirect URI: For script apps, use:
http://localhost:8080(required but not used for script apps)
- Name:
-
Submit the Form
- Click "create app"
After creating the app, you'll see a page with your app details:
-
Client ID (under your app name)
- This is a string that looks like:
abc123def456ghi789 - Copy this value - this is your
REDDIT_CLIENT_ID
- This is a string that looks like:
-
Secret (shown as "secret" next to your app)
- This is a longer string that looks like:
xyz789abc123def456ghi789jkl012mno345 - Click "edit" or "reveal" to see it if hidden
- Copy this value - this is your
REDDIT_CLIENT_SECRET
- This is a longer string that looks like:
-
Username (optional but recommended)
- Your Reddit username (the one you're logged in as)
- This is used in the user agent string for API requests
- This is your
REDDIT_USERNAME
Add the following lines to your .env file in the project root:
# Reddit API Credentials (for sentiment analysis)
REDDIT_CLIENT_ID=your_client_id_here
REDDIT_CLIENT_SECRET=your_client_secret_here
REDDIT_USERNAME=your_reddit_usernameExample:
REDDIT_CLIENT_ID=abc123def456ghi789
REDDIT_CLIENT_SECRET=xyz789abc123def456ghi789jkl012mno345
REDDIT_USERNAME=myusernameMake sure the required packages are installed:
pip install praw textblobOr if using the requirements file:
pip install -r requirements.txtThe Reddit API will be automatically initialized when you use features that require it, such as:
ff_analyze_reddit_sentiment- Analyze Reddit sentiment for players
If credentials are missing or incorrect, the app will:
- Log a warning message
- Continue operating without Reddit sentiment analysis
- Use fallback sentiment analysis methods
- Reddit API has rate limits (typically 60 requests per minute)
- The app includes rate limiting and error handling
- If you hit rate limits, wait a few minutes before trying again
- Must use "script" type - This is the correct type for server-side applications
- "web app" and "installed app" types won't work with this setup
- Never commit your
.envfile to version control - Keep your
REDDIT_CLIENT_SECRETprivate - The username is optional but helps identify your app to Reddit
"Reddit API credentials not configured"
- Check that all three variables are in your
.envfile - Verify there are no extra spaces or quotes around the values
- Restart the MCP server after adding credentials
"Reddit API connection test failed"
- Verify your Client ID and Secret are correct
- Check that you selected "script" as the app type
- Ensure you're using the correct Reddit account
"PRAW not available"
- Run:
pip install praw textblob - Check that you're in the correct Python environment
You can test your credentials manually with this Python snippet:
import os
from dotenv import load_dotenv
import praw
load_dotenv()
reddit = praw.Reddit(
client_id=os.getenv("REDDIT_CLIENT_ID"),
client_secret=os.getenv("REDDIT_CLIENT_SECRET"),
user_agent=f"fantasy-football-mcp:v1.0 by /u/{os.getenv('REDDIT_USERNAME', 'unknown')}"
)
# Test connection
try:
subreddit = reddit.subreddit("fantasyfootball")
print(f"✅ Connected! Subreddit has {subreddit.subscribers} subscribers")
except Exception as e:
print(f"❌ Connection failed: {e}")The app will still function normally, but:
- Reddit sentiment analysis will be unavailable
- The
ff_analyze_reddit_sentimenttool will return fallback results - You'll see warnings in the logs about missing credentials
All other features (lineup optimization, draft assistance, etc.) work independently of Reddit API.