mcp-server-reddit

The MCP Server Reddit is a Model Context Protocol server that allows LLMs to access content from Reddit. It enables retrieval of hot posts from the Reddit frontpage, access to subreddit information, and reading of post comments. It utilizes redditwarp to interact with Reddit's API and exposes its functionalities through the MCP protocol.

GitHub Stars

95

User Rating

Not Rated

Favorites

0

Views

40

Forks

15

Issues

3

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Python 3.6以上
redditwarp 最新版

Installation

Installation

Prerequisites

Please specify required software and versions:
Python: 3.6 or higher
redditwarp: Latest version

Installation Steps

1. Clone Repository

bash
git clone https://github.com/Hawstein/mcp-server-reddit.git
cd mcp-server-reddit

2. Install Dependencies

bash
pip install -r requirements.txt

3. Start Server

bash
python server.py

Troubleshooting

Common Issues

Issue: Server won't start Solution: Check Python version and reinstall dependencies. Issue: Unable to access the API Solution: Verify Reddit API settings and ensure correct authentication credentials are being used.

Configuration

Configuration

Basic Configuration

Server Setup

Configure API keys and settings appropriately in server.py.

Environment Variables

Set the following environment variables as needed:
bash
export REDDIT_API_KEY="your-api-key"

Advanced Configuration

Security Settings

Store API keys in environment variables or secure configuration files.
Set appropriate file access permissions.

Performance Tuning

Configure timeout values.
Limit concurrent executions.

Configuration Example

Basic Configuration

python

server.py

import os REDDIT_API_KEY = os.getenv('REDDIT_API_KEY')

Examples

Examples

Basic Usage

Here are basic usage examples for the MCP server:

Using Python

python
import requests

def get_frontpage_posts(limit=10):
    response = requests.get('http://localhost:3000/mcp/get_frontpage_posts', params={'limit': limit})
    return response.json()

Usage example

posts = get_frontpage_posts() print(posts)

Advanced Examples

Fetching Hot Posts from a Specific Subreddit

python
subreddit = 'Python'
response = requests.get('http://localhost:3000/mcp/get_subreddit_hot_posts', params={'subreddit_name': subreddit})
print(response.json())

Use Cases

Developing an application that fetches and displays the latest hot posts from Reddit's frontpage.
Creating a tool that retrieves information about a specific subreddit and provides users with an overview of that subreddit.
Building a system that monitors new posts in a subreddit and notifies users of posts containing specific keywords.
Conducting a data science project that retrieves detailed information about a specific post and its comments for analysis.

Additional Resources