Reddit MCP Server
Enables read-only access to Reddit for searching posts within specific subreddits using OAuth2 authentication. It allows users to search by query and sort results by relevance, popularity, or date.
README
Reddit MCP Server
This MCP server allows Clients to interact with Reddit using OAuth2 authentication, enabling read-only access to search for posts within subreddits.
Features
- Search posts: Search for posts within specific subreddits with various sorting options (relevance, hot, top, new, comments)
- OAuth2 authentication: Secure authentication using Reddit's OAuth2 client credentials flow
- Read-only access: Safe, read-only access to Reddit data without requiring user credentials
Quick Start
-
Create a Reddit application to get your 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 ID and client secret
-
Add this configuration to your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"reddit-mcp": {
"command": "npx",
"args": ["-y", "@enisze/reddit-mcp"],
"env": {
"REDDIT_CLIENT_ID": "your_client_id_here",
"REDDIT_CLIENT_SECRET": "your_client_secret_here",
"REDDIT_USER_AGENT": "reddit-mcp-server/1.0.0"
}
}
}
}
- Restart Claude Desktop
That's it! Claude can now search Reddit through the search_posts tool.
Example Usage
Try asking Claude:
- "Can you search for posts about 'artificial intelligence' in the MachineLearning subreddit?"
- "Search for the top 10 posts about 'Claude AI' in the artificial subreddit"
- "Find recent discussions about 'programming best practices' in the programming subreddit"
Environment Variables
REDDIT_CLIENT_ID: Your Reddit app's client IDREDDIT_CLIENT_SECRET: Your Reddit app's client secretREDDIT_USER_AGENT: User agent string (optional, defaults to "reddit-mcp-server/1.0.0")
Development
If you want to contribute or run from source:
- Clone the repository:
git clone <repository-url>
cd reddit-mcp
- Install dependencies:
npm install
- Build:
npm run build
- Run:
npm start
- Test:
# Run unit tests (no API credentials needed)
npm test
# Run API integration tests (requires Reddit credentials)
npm run test:api
Running Evaluations
To test the functionality of the Reddit MCP server:
npm run eval
This will run a series of evaluations to ensure all tools are working correctly.
Running Evals
The evals package loads an MCP client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found here.
OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/index.ts
Docker Support
You can also run this MCP server using Docker:
# Build the Docker image
docker build -t reddit-mcp .
# Run the container with environment variables
docker run -e REDDIT_CLIENT_ID=your_client_id \
-e REDDIT_CLIENT_SECRET=your_client_secret \
reddit-mcp
API Documentation
search_posts
Searches for posts in a Reddit subreddit using OAuth2 authentication.
Parameters:
query(string, required): Search querysubreddit(string, required): The subreddit name (without r/ prefix)count(number, optional): Number of posts to return (1-100, default: 25)sort(string, optional): Sort order - 'relevance', 'hot', 'top', 'new', 'comments' (default: 'relevance')
Troubleshooting
Authentication Issues
- Make sure your Reddit client ID and secret are correct
- Ensure your Reddit app is configured as a "script" type
- Check that your user agent string is descriptive and unique
Rate Limiting
- The server implements basic rate limiting (2 seconds between requests)
- Reddit has its own rate limits - if you hit them, wait before retrying
Common Errors
- "Subreddit not found": Check the subreddit name spelling
- "OAuth2 authentication failed": Verify your Reddit app credentials
- "Invalid credentials": Make sure your client ID and secret are correct
Testing
The project includes comprehensive tests to verify functionality:
Unit Tests
Run basic functionality tests without requiring Reddit API credentials:
npm test
These tests verify:
- Response formatting
- Type definitions
- Data structure handling
- Error handling logic
API Integration Tests
Test actual Reddit API functionality (requires credentials):
npm run test:api
Set up your credentials in .env first (copy from .env.example).
These tests verify:
- OAuth2 authentication flow
- Search functionality
- API response handling
- Error handling for various scenarios
See TEST.md for detailed testing instructions.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。