@daanrongen/reddit-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +108 -0
  2. package/dist/main.js +35598 -0
  3. package/package.json +55 -0
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # reddit-mcp
2
+
3
+ MCP server for [Reddit](https://www.reddit.com/) — search posts, browse subreddits, read comments, and write with OAuth2 user auth over stdio.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npx -y @daanrongen/reddit-mcp
9
+ ```
10
+
11
+ ## Tools (13 total)
12
+
13
+ | Domain | Tools | Coverage |
14
+ | ---------- | --------------------------------------------------------------------------- | ------------------------------------------ |
15
+ | **Search** | `search_posts`, `search_subreddits` | Full-text post and subreddit search |
16
+ | **Browse** | `get_subreddit_posts`, `get_post`, `get_comments`, `get_subreddit_info` | Read posts, comments, and subreddit info |
17
+ | **User** | `get_user_profile`, `get_user_posts`, `get_user_comments` | User profiles and activity history |
18
+ | **Write** | `submit_post`, `submit_comment`, `vote`, `save_post` | Post, comment, vote, and save (OAuth only) |
19
+
20
+ ## Setup
21
+
22
+ ### Reddit OAuth2 app
23
+
24
+ 1. Go to [https://www.reddit.com/prefs/apps](https://www.reddit.com/prefs/apps)
25
+ 2. Create a **script** app (for personal use) or **web app** (for user auth)
26
+ 3. Note the **client ID** (under the app name) and **client secret**
27
+ 4. For write access, obtain a refresh token via the OAuth2 flow
28
+
29
+ ### Environment variables
30
+
31
+ | Variable | Required | Description |
32
+ | ----------------------- | -------------- | -------------------------------------- |
33
+ | `REDDIT_CLIENT_ID` | Yes | OAuth2 app client ID |
34
+ | `REDDIT_CLIENT_SECRET` | Yes | OAuth2 app client secret |
35
+ | `REDDIT_REFRESH_TOKEN` | For write tools | Refresh token for user-level access |
36
+ | `REDDIT_USERNAME` | For write tools | Reddit username |
37
+
38
+ Read-only tools (`search_posts`, `browse`, `user` tools) work with just `REDDIT_CLIENT_ID` and `REDDIT_CLIENT_SECRET` using app-only auth. Write tools require a valid refresh token.
39
+
40
+ ### Claude Desktop
41
+
42
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
43
+
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "reddit": {
48
+ "type": "stdio",
49
+ "command": "npx",
50
+ "args": ["-y", "@daanrongen/reddit-mcp"],
51
+ "env": {
52
+ "REDDIT_CLIENT_ID": "your-client-id",
53
+ "REDDIT_CLIENT_SECRET": "your-client-secret",
54
+ "REDDIT_REFRESH_TOKEN": "your-refresh-token",
55
+ "REDDIT_USERNAME": "your-username"
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ Or via the CLI:
63
+
64
+ ```bash
65
+ claude mcp add reddit \
66
+ -e REDDIT_CLIENT_ID=your-client-id \
67
+ -e REDDIT_CLIENT_SECRET=your-client-secret \
68
+ -- npx -y @daanrongen/reddit-mcp
69
+ ```
70
+
71
+ ## Development
72
+
73
+ ```bash
74
+ bun install
75
+ bun run dev # run with --watch
76
+ bun test # run test suite
77
+ bun run build # bundle to dist/main.js
78
+ bun run inspect # open MCP Inspector in browser
79
+ ```
80
+
81
+ ## Inspecting locally
82
+
83
+ `bun run inspect` launches the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) against the local build:
84
+
85
+ ```bash
86
+ bun run build && bun run inspect
87
+ ```
88
+
89
+ This opens the Inspector UI in your browser where you can call any tool interactively and inspect request/response shapes.
90
+
91
+ ## Architecture
92
+
93
+ ```
94
+ src/
95
+ ├── config.ts # Effect Config — REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, …
96
+ ├── main.ts # Entry point — ManagedRuntime + StdioServerTransport
97
+ ├── domain/
98
+ │ ├── RedditClient.ts # Context.Tag service interface
99
+ │ ├── errors.ts # RedditError, AuthError
100
+ │ └── models.ts # Schema.Class models (Post, Comment, Subreddit, …)
101
+ ├── infra/
102
+ │ ├── RedditClientLive.ts # Layer.scoped — OAuth2 token management + Reddit API
103
+ │ └── RedditClientTest.ts # In-memory test adapter
104
+ └── mcp/
105
+ ├── server.ts # McpServer wired to ManagedRuntime
106
+ ├── utils.ts # formatSuccess, formatError
107
+ └── tools/ # search.ts, browse.ts, user.ts, write.ts
108
+ ```