Reddit 搜索与内容阅读工具

一个面向编码代理的 Reddit 只读访问服务,支持搜索 Reddit 及单个社区、浏览帖子流,并保存完整帖子和讨论内容供本地分析,无需 API 密钥。

  • by TiranSpierer
  • TypeScript
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 TiranSpierer/reddit-mcp

使用说明

Reddit

Read-only Reddit access for coding agents: search Reddit and individual communities, browse feeds, and save complete posts with their discussions for local analysis. No API key is required.

[!TIP] Recommended: Install web-platforms from the agent plugin marketplace. The CLI is preferred for better token efficiency.

[!IMPORTANT] Migrating from v1: replace the old implicit npx -y git+https://github.com/TiranSpierer/reddit-mcp.git command with the explicit MCP command shown below.

MCP installation

Standard configuration:

{
  "mcpServers": {
    "reddit": {
      "command": "npx",
      "args": [
        "-y",
        "-p",
        "git+https://github.com/TiranSpierer/reddit.git",
        "reddit-mcp"
      ]
    }
  }
}
Claude Code
claude mcp add reddit -s user -- npx -y -p git+https://github.com/TiranSpierer/reddit.git reddit-mcp
Codex
codex mcp add reddit -- npx -y -p git+https://github.com/TiranSpierer/reddit.git reddit-mcp
VS Code / Copilot
code --add-mcp '{"name":"reddit","command":"npx","args":["-y","-p","git+https://github.com/TiranSpierer/reddit.git","reddit-mcp"]}'
Antigravity
agy mcp add reddit -- npx -y -p git+https://github.com/TiranSpierer/reddit.git reddit-mcp
Authenticated mode (optional)

Set REDDIT_CLIENT_ID and REDDIT_CLIENT_SECRET for OAuth client-credentials access and higher rate limits.

{
  "mcpServers": {
    "reddit": {
      "command": "npx",
      "args": ["-y", "-p", "git+https://github.com/TiranSpierer/reddit.git", "reddit-mcp"],
      "env": {
        "REDDIT_CLIENT_ID": "your_client_id",
        "REDDIT_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

Claude Code:

claude mcp add reddit -s user \
  -e REDDIT_CLIENT_ID=your_client_id \
  -e REDDIT_CLIENT_SECRET=your_client_secret \
  -- npx -y -p git+https://github.com/TiranSpierer/reddit.git reddit-mcp

Codex:

codex mcp add reddit \
  --env REDDIT_CLIENT_ID=your_client_id \
  --env REDDIT_CLIENT_SECRET=your_client_secret \
  -- npx -y -p git+https://github.com/TiranSpierer/reddit.git reddit-mcp

To request credentials, use Reddit's developer form. See Reddit's API access policy for details.


CLI

Run directly:

npx -y -p git+https://github.com/TiranSpierer/reddit.git reddit-cli --help

Commands:

reddit-cli search "typescript error" --sort top --time year
reddit-cli search "budget mop" --subreddit RobotVacuums
reddit-cli search "robot vacuum" --subreddits

reddit-cli subreddit info RobotVacuums
reddit-cli subreddit posts RobotVacuums --sort new

reddit-cli post 1w391er
reddit-cli post <reddit-url> --comment-sort top
reddit-cli post 1w391er --comment p6ypqcs

Searches and feeds print compact YAML with an after cursor. Subreddit sidebars/rules and post bodies/comments are saved under the OS temporary directory; stdout returns compact metadata and file paths.

See docs/CLI.md for the full command reference.

MCP tools
Tool Description
search_reddit Search posts across Reddit
search_subreddits Find communities by topic
get_subreddit_info Get community metadata and save its sidebar/rules
get_subreddit_posts Browse a community feed
search_subreddit_posts Search within a community
get_post Save a post and selected comment discussion

The MCP adapter preserves the established six tool names and input schemas. It uses the same compact summaries and deterministic files as the CLI.

Debugging

Add --debug before or after a CLI command. Normal errors remain concise on stderr; when Reddit returned an HTTP response, its untouched body is printed to stdout. Authorization, cookies, client secrets, and OAuth tokens are never printed.

reddit-cli subreddit info missing-community --debug
reddit-cli --debug post missing-post
Requirements
  • Node.js 20+
  • No Reddit API key required; OAuth credentials are optional