reddit-mcp-mod

reddit-mcp-mod

Enables Reddit moderation through tool-based access: reading, posting, mod queue management, user management, and report handling.

Category
访问服务器

README

reddit-mcp-mod

A Model Context Protocol (MCP) stdio server exposing Reddit moderation as tools: reading posts/comments, posting/replying, reviewing the mod queue, approving/removing content, resolving reports, and managing users (ban/mute).

  • Entry point: src/index.ts → compiled to dist/index.js (binary name: reddit-mcp-mod)
  • SDK: @modelcontextprotocol/sdk
  • Node: >= 24
  • Auth: Reddit OAuth2 refresh-token flow (works with 2FA-enabled mod accounts; never stores your password)

Setup

1. Create a Reddit app

Go to reddit.com/prefs/apps, click "create app", and choose type web app (not "script" — web apps get a client_secret and support permanent refresh tokens). Set the redirect URI to http://localhost:65010/callback (or a custom port, see --port below).

2. Install and build

pnpm install
pnpm build

3. Mint a refresh token (one-time)

node dist/index.js authorize \
  --client_id <your_client_id> \
  --client_secret <your_client_secret> \
  --user_agent "windows:reddit-mcp-mod:0.1.0 (by /u/yourusername)"

This opens your browser, walks you through Reddit's consent screen, and prints a JSON block with REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, REDDIT_REFRESH_TOKEN, and REDDIT_USER_AGENT. Save these as environment variables — the refresh token grants ongoing access to the account, so keep it secret.

4. Run the server

REDDIT_CLIENT_ID=... REDDIT_CLIENT_SECRET=... REDDIT_REFRESH_TOKEN=... REDDIT_USER_AGENT=... \
  node dist/index.js --subreddits=mysubreddit

By default both --allow_writes and --allow_mod_actions are off, so the server starts read-only. Enable them once you've confirmed reads work.

Configuration

Auth

Supply client_id, client_secret, refresh_token, and user_agent via:

  • Environment variables (recommended — keeps secrets out of argv): REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, REDDIT_REFRESH_TOKEN, REDDIT_USER_AGENT
  • CLI flags: --client_id, --client_secret, --refresh_token, --user_agent
  • A --profile <path.json> file (see below)

user_agent should follow Reddit's recommended format <platform>:<app id>:<version> (by /u/<username>) — Reddit throttles non-compliant user agents. The server logs a warning at startup if the format doesn't match, but doesn't block startup.

Write & moderation safety

Two independent gates, since posting content and banning users have very different blast radii:

  • --allow_writes (default: false) — enables reddit_submit_post, reddit_reply, reddit_edit_content, reddit_delete_content.
  • --allow_mod_actions (default: false) — enables reddit_approve, reddit_remove, reddit_lock, reddit_unlock, reddit_ignore_reports, reddit_unignore_reports, reddit_ban_user, reddit_unban_user, reddit_mute_user, reddit_unmute_user.

Gated tools are not registered at all when their flag is off (they won't appear in the MCP client's tool list), rather than being registered and erroring at call time.

Subreddit allowlist

  • --subreddits sub1,sub2 — restricts every subreddit-scoped tool call to the listed subreddits (case-insensitive, r/ prefix optional). Calls against any other subreddit are rejected before hitting Reddit's API.
  • Default: * (unrestricted). The server logs a warning at startup when unrestricted.

Flags & defaults

Flag Default Description
--allow_writes false Enable posting/replying/editing/deleting
--allow_mod_actions false Enable approve/remove/lock/ban/mute/report actions
--subreddits <a,b,c> * Allowlist of subreddits the server may act on
--timeout_ms <number> 15000 Per-request timeout
--log_level <silent|error|info|debug> info debug logs every HTTP request/response (secrets redacted)
--profile <path.json> JSON file supplying any of the above (CLI flags and env vars take precedence)

Profile file

{
  "client_id": "<redacted>",
  "client_secret": "<redacted>",
  "refresh_token": "<redacted>",
  "user_agent": "windows:reddit-mcp-mod:0.1.0 (by /u/yourusername)",
  "allow_writes": false,
  "allow_mod_actions": true,
  "subreddits": ["mysubreddit"]
}

Tools

Reading (always registered) reddit_get_post, reddit_get_comment, reddit_list_posts, reddit_search, reddit_get_user, reddit_list_user_activity

Posting (requires --allow_writes) reddit_submit_post, reddit_reply, reddit_edit_content, reddit_delete_content

Mod queue (listings always registered; actions require --allow_mod_actions) reddit_get_modqueue, reddit_get_unmoderated, reddit_get_spam, reddit_get_edited, reddit_approve, reddit_remove, reddit_lock, reddit_unlock

Reports (reddit_get_reports always registered; actions require --allow_mod_actions) reddit_get_reports, reddit_ignore_reports, reddit_unignore_reports

Users (list tools always registered; actions require --allow_mod_actions) reddit_ban_user, reddit_unban_user, reddit_mute_user, reddit_unmute_user, reddit_list_banned, reddit_list_muted, reddit_list_moderators

Mod log reddit_get_modlog

All tools return strict JSON (no Markdown) via a content[0].text payload, and use cursor-based pagination (after/meta.next_cursor) matching Reddit's own API, not offset-based pagination.

Use in an MCP client (Claude Desktop / Claude Code)

{
  "mcpServers": {
    "reddit-mod": {
      "command": "node",
      "args": ["/absolute/path/to/reddit-mcp-mod/dist/index.js", "--subreddits=mysubreddit"],
      "env": {
        "REDDIT_CLIENT_ID": "...",
        "REDDIT_CLIENT_SECRET": "...",
        "REDDIT_REFRESH_TOKEN": "...",
        "REDDIT_USER_AGENT": "windows:reddit-mcp-mod:0.1.0 (by /u/yourusername)"
      }
    }
  }
}

Use with Open WebUI (via mcpo)

mcpo is Open WebUI's MCP-to-OpenAPI proxy. It's language-agnostic — it spawns any stdio MCP server as a subprocess and exposes an OpenAPI/HTTP surface on top, so this Node/TypeScript server works with it out of the box:

uvx mcpo --port 8000 -- node /absolute/path/to/reddit-mcp-mod/dist/index.js --subreddits=mysubreddit

Set the Reddit env vars (REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, REDDIT_REFRESH_TOKEN, REDDIT_USER_AGENT) in the shell before running mcpo, or via an mcpo config file using the same mcpServers shape shown above. Once running, http://localhost:8000/docs lists one OpenAPI operation per tool — point Open WebUI's tool server settings at http://localhost:8000.

Development

pnpm install
pnpm build       # tsc -> dist/
pnpm typecheck    # tsc --noEmit
pnpm lint         # eslint src
pnpm test         # node --test against dist/test/**/*.js (run pnpm build first)

Tests mock RedditClient/fetch directly — no live network calls or real Reddit credentials are required to run the suite.

License

MIT

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

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

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选