npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@enisze/reddit-mcp

v1.0.0

Published

A Model Context Protocol server that allows read-only interaction with Reddit using OAuth2, enabling searching posts and subreddits.

Readme

Reddit MCP Server

This MCP server allows Clients to interact with Reddit using OAuth2 authentication, enabling read-only access to search for posts within subreddits.

Features

  • Search posts: Search for posts within specific subreddits with various sorting options (relevance, hot, top, new, comments)
  • OAuth2 authentication: Secure authentication using Reddit's OAuth2 client credentials flow
  • Read-only access: Safe, read-only access to Reddit data without requiring user credentials

Quick Start

  1. Create a Reddit application to get your API credentials:

    • Go to https://www.reddit.com/prefs/apps
    • Click "Create App" or "Create Another App"
    • Choose "script" as the app type
    • Note down your client ID and client secret
  2. Add this configuration to your Claude Desktop config file:

Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "reddit-mcp": {
      "command": "npx",
      "args": ["-y", "@enisze/reddit-mcp"],
      "env": {
        "REDDIT_CLIENT_ID": "your_client_id_here",
        "REDDIT_CLIENT_SECRET": "your_client_secret_here",
        "REDDIT_USER_AGENT": "reddit-mcp-server/1.0.0"
      }
    }
  }
}
  1. Restart Claude Desktop

That's it! Claude can now search Reddit through the search_posts tool.

Example Usage

Try asking Claude:

  • "Can you search for posts about 'artificial intelligence' in the MachineLearning subreddit?"
  • "Search for the top 10 posts about 'Claude AI' in the artificial subreddit"
  • "Find recent discussions about 'programming best practices' in the programming subreddit"

Environment Variables

  • REDDIT_CLIENT_ID: Your Reddit app's client ID
  • REDDIT_CLIENT_SECRET: Your Reddit app's client secret
  • REDDIT_USER_AGENT: User agent string (optional, defaults to "reddit-mcp-server/1.0.0")

Development

If you want to contribute or run from source:

  1. Clone the repository:
git clone <repository-url>
cd reddit-mcp
  1. Install dependencies:
npm install
  1. Build:
npm run build
  1. Run:
npm start
  1. Test:
# Run unit tests (no API credentials needed)
npm test

# Run API integration tests (requires Reddit credentials)
npm run test:api

Running Evaluations

To test the functionality of the Reddit MCP server:

npm run eval

This will run a series of evaluations to ensure all tools are working correctly.

Running Evals

The evals package loads an MCP client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found here.

OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/index.ts

Docker Support

You can also run this MCP server using Docker:

# Build the Docker image
docker build -t reddit-mcp .

# Run the container with environment variables
docker run -e REDDIT_CLIENT_ID=your_client_id \
           -e REDDIT_CLIENT_SECRET=your_client_secret \
           reddit-mcp

API Documentation

search_posts

Searches for posts in a Reddit subreddit using OAuth2 authentication.

Parameters:

  • query (string, required): Search query
  • subreddit (string, required): The subreddit name (without r/ prefix)
  • count (number, optional): Number of posts to return (1-100, default: 25)
  • sort (string, optional): Sort order - 'relevance', 'hot', 'top', 'new', 'comments' (default: 'relevance')

Troubleshooting

Authentication Issues

  • Make sure your Reddit client ID and secret are correct
  • Ensure your Reddit app is configured as a "script" type
  • Check that your user agent string is descriptive and unique

Rate Limiting

  • The server implements basic rate limiting (2 seconds between requests)
  • Reddit has its own rate limits - if you hit them, wait before retrying

Common Errors

  • "Subreddit not found": Check the subreddit name spelling
  • "OAuth2 authentication failed": Verify your Reddit app credentials
  • "Invalid credentials": Make sure your client ID and secret are correct

Testing

The project includes comprehensive tests to verify functionality:

Unit Tests

Run basic functionality tests without requiring Reddit API credentials:

npm test

These tests verify:

  • Response formatting
  • Type definitions
  • Data structure handling
  • Error handling logic

API Integration Tests

Test actual Reddit API functionality (requires credentials):

npm run test:api

Set up your credentials in .env first (copy from .env.example).

These tests verify:

  • OAuth2 authentication flow
  • Search functionality
  • API response handling
  • Error handling for various scenarios

See TEST.md for detailed testing instructions.

License

MIT