Skip to main content
Glama

Reddit MCP Tool

check_credentials.py•2.56 kB
#!/usr/bin/env python3 """ Debug Reddit API credentials. """ import os import praw from dotenv import load_dotenv def main(): """Check Reddit credentials step by step.""" load_dotenv() print("šŸ”§ Reddit API Credential Checker") print("=" * 40) # Check environment variables client_id = os.getenv("REDDIT_CLIENT_ID") client_secret = os.getenv("REDDIT_CLIENT_SECRET") user_agent = os.getenv("REDDIT_USER_AGENT") print(f"āœ… Client ID: {client_id[:8] if client_id else 'MISSING'}...") print(f"āœ… Client Secret: {'SET' if client_secret else 'MISSING'}") print(f"āœ… User Agent: {user_agent if user_agent else 'MISSING'}") if not all([client_id, client_secret, user_agent]): print("āŒ Missing credentials!") return print(f"\nšŸ” Client ID length: {len(client_id)} chars") print(f"šŸ” Client Secret length: {len(client_secret)} chars") # Expected lengths if len(client_id) < 10 or len(client_id) > 25: print("āš ļø Client ID seems wrong length (should be ~14-20 chars)") if len(client_secret) < 20 or len(client_secret) > 35: print("āš ļø Client Secret seems wrong length (should be ~27-30 chars)") # Test basic Reddit connection print(f"\nšŸ”— Testing Reddit API connection...") try: reddit = praw.Reddit( client_id=client_id, client_secret=client_secret, user_agent=user_agent, ) # Test with a simple read-only call print("šŸ” Testing read-only access...") # Get Reddit's own account info (public) me = reddit.user.me() if me is None: print("āœ… Read-only access working! (No user authentication)") # Test subreddit access print("šŸ” Testing subreddit access...") subreddit = reddit.subreddit("announcements") print(f"āœ… Subreddit access: {subreddit.display_name}") print(f" Subscribers: {subreddit.subscribers:,}") else: print(f"āœ… Authenticated as: {me.name}") except Exception as e: print(f"āŒ Reddit API Error: {str(e)}") print("\nšŸ”§ Possible issues:") print("1. Wrong Client ID (should be under your app name)") print("2. Wrong Client Secret (longer string)") print("3. Reddit app not set to 'script' type") print("4. User agent not unique enough") if __name__ == "__main__": main()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GeLi2001/reddit-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server