Reddit MCP Server

Reddit MCP Server

Provides access to Reddit's API for retrieving posts, comments, user information, and search functionality. Supports multiple authentication methods and comprehensive Reddit data operations including subreddit browsing, post retrieval, and user profile access.

Category
访问服务器

README

Reddit MCP Server

A Model Context Protocol (MCP) server that provides access to Reddit's API for retrieving posts, comments, user information, and search functionality.

Features

  • Subreddit Operations: Get posts from any subreddit with various sorting options
  • Post Operations: Retrieve specific posts and their comments
  • User Operations: Get user information, posts, and comments
  • Search: Search for posts and subreddits
  • Authentication: Supports multiple Reddit API authentication methods

Available Tools

get_subreddit_posts

Get posts from a specific subreddit.

Parameters:

  • subreddit (required): Name of the subreddit (without r/ prefix)
  • sort (optional): Sort order - hot, new, top, rising (default: hot)
  • limit (optional): Number of posts to retrieve, 1-100 (default: 25)

get_post

Get details of a specific Reddit post.

Parameters:

  • postId (required): Reddit post ID

get_post_comments

Get comments from a Reddit post.

Parameters:

  • postId (required): Reddit post ID
  • sort (optional): Sort order - best, top, new, controversial, old (default: best)

get_subreddit_info

Get information about a subreddit.

Parameters:

  • subreddit (required): Name of the subreddit (without r/ prefix)

get_user_info

Get information about a Reddit user.

Parameters:

  • username (required): Reddit username (without u/ prefix)

get_user_posts

Get posts submitted by a user.

Parameters:

  • username (required): Reddit username (without u/ prefix)
  • sort (optional): Sort order - hot, new, top (default: new)
  • limit (optional): Number of posts to retrieve, 1-100 (default: 25)

get_user_comments

Get comments made by a user.

Parameters:

  • username (required): Reddit username (without u/ prefix)
  • sort (optional): Sort order - hot, new, top (default: new)
  • limit (optional): Number of comments to retrieve, 1-100 (default: 25)

search_posts

Search for Reddit posts.

Parameters:

  • query (required): Search query
  • subreddit (optional): Restrict search to specific subreddit
  • sort (optional): Sort order - relevance, hot, top, new, comments (default: relevance)
  • limit (optional): Number of results to retrieve, 1-100 (default: 25)

search_subreddits

Search for subreddits.

Parameters:

  • query (required): Search query for subreddit names/descriptions
  • limit (optional): Number of results to retrieve, 1-100 (default: 25)

Setup

1. Reddit API Application

  1. Go to https://www.reddit.com/prefs/apps
  2. Click "Create App" or "Create Another App"
  3. Choose application type:
    • script for personal use
    • web app for server applications
  4. Note your client ID (under the app name) and client secret

2. Environment Configuration

Copy .env.example to .env and configure:

cp .env.example .env

Edit .env with your Reddit API credentials:

REDDIT_CLIENT_ID=your_client_id_here
REDDIT_CLIENT_SECRET=your_client_secret_here
REDDIT_USER_AGENT=reddit-mcp-server/1.0.0 by your_username

# Choose one authentication method:
REDDIT_USERNAME=your_username
REDDIT_PASSWORD=your_password

3. Installation

npm install

4. Build

npm run build

5. Usage with Claude Code

Add to your Claude Code MCP configuration:

{
  "mcpServers": {
    "reddit": {
      "command": "node",
      "args": ["/path/to/reddit-mcp/dist/index.js"],
      "env": {
        "REDDIT_CLIENT_ID": "your_client_id",
        "REDDIT_CLIENT_SECRET": "your_client_secret",
        "REDDIT_USER_AGENT": "reddit-mcp-server/1.0.0 by your_username",
        "REDDIT_USERNAME": "your_username",
        "REDDIT_PASSWORD": "your_password"
      }
    }
  }
}

Authentication Methods

1. Username/Password (Recommended for personal use)

REDDIT_USERNAME=your_username
REDDIT_PASSWORD=your_password

2. Refresh Token (Recommended for production)

REDDIT_REFRESH_TOKEN=your_refresh_token

3. Access Token (For testing only - expires in 1 hour)

REDDIT_ACCESS_TOKEN=your_access_token

4. Client Credentials (Read-only access)

Leave username/password empty to use client credentials flow.

Rate Limits

Reddit API has rate limits:

  • Free tier: 100 requests per minute per OAuth client
  • Requests are averaged over a 10-minute window
  • Commercial use requires Reddit's permission

Important Notes

  1. User-Agent: Must be unique and descriptive
  2. Commercial Use: Requires Reddit's permission
  3. Data Retention: Must delete user content that's been deleted from Reddit
  4. Rate Limiting: Built-in authentication token management

Development

Run in development mode:

npm run dev

Build:

npm run build

Clean build artifacts:

npm run clean

Data Types

RedditPost

interface RedditPost {
  id: string;
  title: string;
  author: string;
  subreddit: string;
  url: string;
  selftext: string;
  created_utc: number;
  score: number;
  num_comments: number;
  permalink: string;
  is_self: boolean;
  domain: string;
  thumbnail?: string;
}

RedditComment

interface RedditComment {
  id: string;
  author: string;
  body: string;
  created_utc: number;
  score: number;
  permalink: string;
  parent_id: string;
  subreddit: string;
}

RedditSubreddit

interface RedditSubreddit {
  display_name: string;
  title: string;
  description: string;
  subscribers: number;
  created_utc: number;
  public_description: string;
  url: string;
  over18: boolean;
}

RedditUser

interface RedditUser {
  name: string;
  id: string;
  created_utc: number;
  comment_karma: number;
  link_karma: number;
  is_verified: boolean;
  has_verified_email: boolean;
}

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选