Skip to main content
Glama

Reddit MCP Tool

test_minimal.py•1.8 kB
#!/usr/bin/env python3 """ Minimal Reddit API test. """ import os import praw from dotenv import load_dotenv def main(): load_dotenv() print("šŸ”§ Minimal Reddit Test") reddit = praw.Reddit( client_id=os.getenv("REDDIT_CLIENT_ID"), client_secret=os.getenv("REDDIT_CLIENT_SECRET"), user_agent=os.getenv("REDDIT_USER_AGENT"), ) print("āœ… Reddit instance created") # Try different subreddits test_subreddits = ["popular", "all", "AskReddit", "funny"] for sub_name in test_subreddits: try: print(f"\nšŸ” Testing r/{sub_name}...") subreddit = reddit.subreddit(sub_name) # Just try to access the display name name = subreddit.display_name print(f" āœ… Name: {name}") # Try to get subscriber count (this sometimes fails with 401) try: subs = subreddit.subscribers print(f" āœ… Subscribers: {subs:,}") except Exception as e: print(f" āš ļø Subscribers failed: {e}") # Try to get a few hot posts try: hot_posts = list(subreddit.hot(limit=2)) print(f" āœ… Hot posts: {len(hot_posts)} found") for post in hot_posts: print(f" - {post.title[:40]}...") break # If we get here, it's working! except Exception as e: print(f" āš ļø Hot posts failed: {e}") except Exception as e: print(f" āŒ Failed: {e}") print(f"\nšŸŽÆ If any test succeeded above, your credentials are working!") 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