reddit-mcp

reddit-mcp

A local, read-only Reddit MCP server that provides tools for searching posts, retrieving posts/comments, subreddit information, and user content via the official Reddit Data API with caching and privacy-focused features.

Category
访问服务器

README

Local Reddit MCP

CI License: Unlicense Node

A local, single-user, read-only Reddit MCP (Model Context Protocol) server. It exposes five tools that retrieve public Reddit content through the official Reddit Data API with OAuth 2.0. Retrieved content is cached locally in SQLite with full-text search and TTL expiry.

Key properties

  • Read-only: No write actions to Reddit. No scraping. Uses the official Reddit Data API.
  • Local & single-user: Runs on your machine via stdio. No remote HTTP transport.
  • Privacy-conscious: Secrets stored in OS-backed encrypted storage (Windows DPAPI). No secrets in logs, commits, or tool results. Cache is local and purgeable.
  • Bounded: Every tool enforces input/output caps. No arbitrary URL fetching.
  • Honest: Deleted, restricted, and NSFW content represented honestly. Every result carries provenance, timestamps, expiry, stale flag, and truncation markers.
  • Secure: SSRF prevention via host allowlist. Rate-limit handling with backoff. Circuit breaker. Untrusted content marked.

Tools

  1. search_reddit — search public posts/subreddits by query with bounded pagination
  2. get_post — retrieve a single post by ID or permalink
  3. get_post_comments — retrieve comments for a post with bounded depth/count
  4. get_subreddit_info — retrieve subreddit metadata
  5. get_user_content — retrieve a user's public posts/comments with bounds

Prerequisites

  • Node.js ≥ 22.9.0 (requires the built-in node:sqlite module and the --env-file-if-exists flag)
  • A Reddit developer application (https://www.reddit.com/prefs/apps) with OAuth credentials

Quick start

npm install
cp .env.example .env    # then add your Reddit credentials
npm run build
npm run auth -- login   # complete OAuth in browser
npm run start           # start MCP stdio server

MCP client configuration

Add the server to your MCP client configuration, e.g.:

{
  "mcpServers": {
    "reddit": {
      "command": "node",
      "args": ["/path/to/RedditMCP/dist/index.js"],
      "env": {
        "REDDIT_CLIENT_ID": "your_client_id",
        "REDDIT_REDIRECT_URI": "http://127.0.0.1:8888/callback",
        "REDDIT_USER_AGENT": "RedditMCP/1.0 (by your_username)",
        "CACHE_DB_PATH": "./data/reddit-cache.db"
      }
    }
  }
}

Store REDDIT_CLIENT_SECRET in your MCP client's secure/secret mechanism rather than committing it or placing it in a shared config file.

Environment variables

Variable Required Default Description
REDDIT_CLIENT_ID yes — Reddit app client ID
REDDIT_CLIENT_SECRET no — Reddit app secret; empty = PKCE flow
REDDIT_REDIRECT_URI yes http://127.0.0.1:8888/callback Loopback redirect URI
REDDIT_USER_AGENT yes — Descriptive User-Agent (Reddit requires)
CACHE_DB_PATH no ./data/reddit-cache.db SQLite cache location
CACHE_TTL_SECONDS no 3600 Cache TTL in seconds
CACHE_MAX_ITEMS no 10000 Max cached items (oldest evicted)
LOG_LEVEL no info Log level
HTTP_TIMEOUT_MS no 10000 Outbound HTTP timeout
HTTP_MAX_RETRIES no 3 Retries on transient failures
CIRCUIT_BREAKER_THRESHOLD no 5 Failures before circuit opens
MAX_REQUESTS_PER_MINUTE no 45 Outbound rate limit

Commands

Command Description
npm run start Start the MCP stdio server
npm run auth -- login Authenticate with Reddit OAuth
npm run auth -- status Check authentication status
npm run auth -- logout Revoke and delete stored tokens
npm run doctor Run health checks (config/db/auth)
npm run cache:status Show cache statistics
npm run cache:purge Purge all cached data

The npm scripts load a local .env file automatically when run from the project directory.

Development

npm run quality       # format check, lint, typecheck, tests, audit
npm test              # unit + integration tests
npm run test:e2e      # end-to-end MCP tests (vitest.e2e.config.ts)
npm run format        # format sources
npm run lint          # eslint
npm run typecheck     # tsc --noEmit

CI (.github/workflows/ci.yml) runs format check, lint, typecheck, tests, build, e2e tests, and npm audit on push/PR to main/master.

Documentation

  • docs/install.md — installation and MCP client setup
  • docs/oauth-setup.md — OAuth app registration, scopes, and token storage
  • docs/operations.md — operations, privacy, retention, and troubleshooting
  • docs/decisions.md — design decisions

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选