Redlib MCP Server
An MCP server that integrates your private Redlib instance, allowing AI assistants access to utilize Redlib.
š“ Redlib MCP Server
A Model Context Protocol (MCP) server that enables AI agents to interact with Reddit through your private Redlib instance. No Reddit API keys required - just a running Redlib instance!
š Table of Contents
- Features
- Prerequisites
- Quick Start
- Configuration
- Available Tools
- Integration with AI Clients
- Docker Compose
- Security: Default vs Hardened
- Development
- Example Usage with AI
- Contributing
- License
- Acknowledgments
- Links
⨠Features
- š Privacy-First - Uses your self-hosted Redlib, no tracking or API keys
- š ļø 3 Powerful Tools - Search posts, get hot posts, fetch full post details with comments
- š³ Docker Ready - Both simple and hardened Docker images available
- š§© Easy Setup - Works with Claude Desktop, Cursor, VS Code, Codex, ForgeCode, KiloCode and any MCP-compatible client
- š Structured Output - Returns clean JSON instead of raw HTML
š Prerequisites
Before using this MCP server, you need:
-
Redlib Instance - A running Redlib instance (default:
http://localhost:8080) -
MCP Client - One of:
- Claude Desktop
- Cursor
- VS Code with GitHub Copilot
- OpenAI Codex
- ForgeCode
- KiloCode
š Quick Start
Option 1: Docker (Recommended)
# Pull and run the default version
docker run -i --rm \
--network host \
-e REDLIB_URL=http://localhost:8080 \
alfafadock/mcp-redlib:latest
Option 2: Hardened Docker (Security-Focused)
# Uses non-root user and minimal privileges
docker run -i --rm \
--network host \
--cap-drop=ALL \
--security-opt no-new-privileges:true \
-e REDLIB_URL=http://localhost:8080 \
alfafadock/mcp-redlib:hardened
Option 3: Local Development
# Clone and setup
git clone https://github.com/Devthatdoes/redlib-mcp-server.git
cd redlib-mcp-server
# Install dependencies
npm install
# Build
npm run build
# Run
npm start
š³ Docker Compose
Click to expand Docker Compose setup
Create docker-compose.yml:
services:
redlib-mcp:
image: alfafadock/mcp-redlib:latest
container_name: redlib-mcp
network_mode: "host" # Uses host network for MCP client communication
environment:
- REDLIB_URL=http://localhost:8080 # Change if Redlib is on a different port
restart: unless-stopped
# For hardened image, change image to: alfafadock/mcp-redlib:hardened
š§ Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
REDLIB_URL | http://localhost:8080 | URL of your Redlib instance |
Custom Redlib Port Example
If your Redlib runs on a different port (e.g., 8085):
docker run -i --rm \
--network host \
-e REDLIB_URL=http://localhost:8085 \
alfafadock/mcp-redlib:latest
Example .env File
Copy .env.example to .env and modify as needed:
cp .env.example .env
š ļø Available Tools
1. search_reddit
Search Reddit posts using your private Redlib instance.
Parameters:
query(required) - Search query stringsubreddit(optional) - Limit search to specific subreddit
Example:
{
"query": "rust programming",
"subreddit": "rust"
}
Returns: JSON with post IDs, titles, authors, scores, and comment counts.
2. get_subreddit_hot
Get hot posts from a specific subreddit.
Parameters:
subreddit(required) - Subreddit name (without r/)limit(optional) - Number of posts (default: 25)
Example:
{
"subreddit": "rust",
"limit": 10
}
3. get_post
Get a specific post with its comments.
Parameters:
subreddit(required) - Subreddit namepostId(required) - Reddit post ID (from search results)
Example:
{
"subreddit": "rust",
"postId": "abc123"
}
Returns: Full post body, score, and up to 10 top comments.
š Integration with AI Clients
Claude Desktop
Edit ~/.config/claude/claude_desktop_config.json (Linux/macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"redlib": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"--network", "host",
"-e", "REDLIB_URL=http://localhost:8080",
"alfafadock/mcp-redlib:latest"
]
}
}
}
For custom Redlib port (e.g., 8085):
{
"mcpServers": {
"redlib": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"--network", "host",
"-e", "REDLIB_URL=http://localhost:8085",
"alfafadock/mcp-redlib:latest"
]
}
}
}
After updating: Restart Claude Desktop. You should see a hammer icon (šØ) indicating MCP tools are available.
Reference: Claude Desktop MCP Docs
Cursor
Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project level):
{
"mcpServers": {
"redlib": {
"command": "docker",
"args": ["run", "-i", "--rm", "--network", "host", "-e", "REDLIB_URL=http://localhost:8080", "alfafadock/mcp-redlib:latest"]
}
}
}
Project-level setup: Create .cursor/mcp.json in your project root.
After updating: Cursor will automatically detect the changes. Use the Command Palette (Cmd/Ctrl+Shift+P) and search for "MCP" to manage servers.
Reference: Cursor MCP Documentation
VS Code / GitHub Copilot
Option A: Workspace Configuration
Create .vscode/mcp.json in your project:
{
"servers": {
"redlib": {
"command": "docker",
"args": ["run", "-i", "--rm", "--network", "host", "-e", "REDLIB_URL=http://localhost:8080", "alfafadock/mcp-redlib:latest"]
}
}
}
Option B: User Configuration (Global)
Use Command Palette (Cmd/Ctrl+Shift+P) ā "MCP: Open User Configuration"
{
"mcp": {
"servers": {
"redlib": {
"command": "docker",
"args": ["run", "-i", "--rm", "--network", "host", "-e", "REDLIB_URL=http://localhost:8080", "alfafadock/mcp-redlib:latest"]
}
}
}
}
After updating: Reload VS Code. The tools will appear in GitHub Copilot's Agent Mode.
Reference: VS Code MCP Documentation
OpenAI Codex
Edit ~/.codex/config.toml (global) or .codex/config.toml (project):
[mcp_servers.redlib]
command = "docker"
args = ["run", "-i", "--rm", "--network", "host", "-e", "REDLIB_URL=http://localhost:8080", "alfafadock/mcp-redlib:latest"]
Project-level setup: Create .codex/config.toml in your project root.
After updating: Restart Codex. Use codex mcp list to verify the server is loaded.
Reference: Codex MCP Documentation
ForgeCode
ForgeCode supports MCP servers via the forge mcp command for easy import.
Option A: Quick Import (Recommended)
Use the built-in MCP import functionality:
# Import the Redlib MCP server
forge mcp import alfafadock/mcp-redlib:latest
# List imported servers
forge mcp list
# Reload to apply changes
forge mcp reload
Option B: Project Configuration
Create .mcp.json in your project root:
{
"mcpServers": {
"redlib": {
"command": "docker",
"args": ["run", "-i", "--rm", "--network", "host", "-e", "REDLIB_URL=http://localhost:8080", "alfafadock/mcp-redlib:latest"]
}
}
}
Option C: Global Configuration
Edit ForgeCode's config directory (check extension settings for the exact path).
After updating: Reload the ForgeCode extension using forge mcp reload. The MCP tools should appear in the AI assistant interface.
Reference: ForgeCode Documentation
KiloCode
Option A: Global Configuration
Edit ~/.config/kilo/kilo.jsonc or use Settings ā MCP in KiloCode:
{
"mcpServers": {
"redlib": {
"command": "docker",
"args": ["run", "-i", "--rm", "--network", "host", "-e", "REDLIB_URL=http://localhost:8080", "alfafadock/mcp-redlib:latest"]
}
}
}
Option B: Project Configuration
Create .kilocode/mcp.json or kilo.jsonc in your project root:
{
"mcpServers": {
"redlib": {
"command": "docker",
"args": ["run", "-i", "--rm", "--network", "host", "-e", "REDLIB_URL=http://localhost:8080", "alfafadock/mcp-redlib:latest"]
}
}
}
After updating: Open KiloCode Settings ā MCP ā Add Server, or edit the config file directly.
Reference: KiloCode MCP Documentation
š Security: Default vs Hardened
| Feature | Default (latest) | Hardened (hardened) |
|---|---|---|
| User | root | Non-root (mcpuser) |
| File Ownership | root | mcpuser |
| Build Stages | Single | Multi-stage (smaller) |
| Runtime Caps | Default | Requires --cap-drop=ALL |
| Use Case | Development, testing | Production |
Using Hardened Image
docker run -i --rm \
--cap-drop=ALL \
--security-opt no-new-privileges:true \
--network host \
-e REDLIB_URL=http://localhost:8080 \
alfafadock/mcp-redlib:hardened
š» Development
Project Structure
redlib-mcp-server/
āāā src/
ā āāā index.ts # Main server code
āāā dist/ # Compiled JavaScript (gitignored)
āāā Dockerfile # Default Docker image
āāā Dockerfile.hardened # Hardened Docker image
āāā docker-compose.yml # Production compose
āāā package.json
āāā tsconfig.json
āāā README.md
Build from Source
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run locally
npm start
Build Custom Docker Images
# Default version
docker build -t redlib-mcp-server .
# Hardened version
docker build -f Dockerfile.hardened -t redlib-mcp-server:hardened .
š Example Usage with AI
Once connected to your AI client (e.g., Claude), you can:
User: "Search Reddit for 'home lab setup' and summarize the top results"
AI uses search_reddit tool ā
Returns structured JSON with posts ā
AI summarizes the findings for you
User: "Get the full post and comments for that Rust tutorial I searched earlier"
AI uses get_post with postId ā
Returns post body + comments ā
AI provides detailed analysis
š¤ Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
š License
MIT License - feel free to use this project however you want!
š Acknowledgments
- Redlib - The private Reddit front-end this server interfaces with
- Model Context Protocol - The protocol that makes this integration possible
- Cheerio - HTML parsing library used to extract structured data
š Links
- Docker Hub: alfafadock/mcp-redlib
- Issues: GitHub Issues
- Redlib: github.com/redlib-org/redlib
Made with ā¤ļø for the privacy-conscious Reddit community
Related Servers
Bright Data
sponsorDiscover, extract, and interact with the web - one interface powering automated access across the public internet.
Documentation Crawler
Crawl websites to generate Markdown documentation and make it searchable through an MCP server.
Simple MCP Tool Server
A simple MCP server that provides a tool for fetching website content using SSE transport.
Puppeteer
A server for browser automation using Puppeteer, enabling web scraping, screenshots, and JavaScript execution.
Oxylabs AI Studio
AI-powered tools for web scraping, crawling, and browser automation.
ScrAPI MCP Server
A server for scraping web pages using the ScrAPI API.
Financial Data MCP Server
Provides real-time financial market data from Yahoo Finance.
Docs Fetch MCP Server
Fetch web page content with recursive exploration.
GeekNews MCP Server
Fetches and caches daily articles from GeekNews using web scraping.
Outscraper
Access Outscraper's data extraction services for business intelligence, location data, reviews, and contact information from various online platforms.
Webclaw
Web content extraction for LLM pipelines ā clean markdown or structured JSON from any URL using browser-grade TLS fingerprinting, no headless browser required. CLI, REST API, and MCP server.