reddit-mcp-server 2.0.0 → 2.0.1
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.
- package/CHANGELOG.md +112 -0
- package/README.md +73 -19
- package/dist/bin.js +12 -6
- package/dist/bin.js.map +1 -1
- package/dist/index.js +50 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.0.1] - 2026-10-31
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- A blank environment value (`KEY=`, as in a copied `.env.example`) now counts as unset everywhere:
|
|
10
|
+
- `OAUTH_TOKEN=` with `OAUTH_ENABLED=true` generated no token and rejected every HTTP request; the server now generates one and prints it
|
|
11
|
+
- `REDDIT_AUTH_MODE=authenticated` with blank `REDDIT_CLIENT_ID`/`REDDIT_CLIENT_SECRET` started keyless; it now fails at startup, as documented
|
|
12
|
+
- Blank `REDDIT_USERNAME`/`REDDIT_PASSWORD` counted as write credentials, so `test_reddit_mcp_server` reported write access and the write tools' credential checks passed
|
|
13
|
+
- Blank `PORT` and `HOST` gave a `NaN` port and an empty bind address; they now default to 3000 and 127.0.0.1
|
|
14
|
+
- Blank `REDDIT_AUTH_MODE` and `REDDIT_SAFE_MODE` stopped the server with an "invalid mode" error; they now default to `auto` and `standard`
|
|
15
|
+
- Blank `REDDIT_MAX_RETRIES` turned off 429 retries; it now defaults to 3
|
|
16
|
+
- Blank `REDDIT_USER_AGENT` sent an empty `User-Agent` to Reddit; the server now uses its auto-generated agent
|
|
17
|
+
- Blank `REDDIT_BOT_FOOTER` with `REDDIT_BOT_DISCLOSURE=auto` posted no disclosure; the built-in footer is used
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- The README, CLAUDE.md, ROADMAP, SECURITY, `.env.example`, `manifest.json` and `server.json` descriptions, CLI help and startup message are brought up to date with 2.0 and Reddit's API shutdown, citing Reddit's 2026-09-30 announcements
|
|
22
|
+
- The CHANGELOG gains entries for 1.5.1 through 1.7.2
|
|
23
|
+
|
|
5
24
|
## [2.0.0] - 2026-10-31
|
|
6
25
|
|
|
7
26
|
A major version because HTTP clients lose `/sse` and `/ready`, and invalid arguments change shape. Stdio clients (Claude Desktop, Claude Code, `npx`) see no change.
|
|
@@ -30,6 +49,99 @@ A major version because HTTP clients lose `/sse` and `/ready`, and invalid argum
|
|
|
30
49
|
- CORS: preflight and responses still allow any origin, as under FastMCP
|
|
31
50
|
- Keepalive: HTTP responses stream as SSE with periodic keepalive frames, as FastMCP's pings did, so idle-timeout proxies don't cut long tool calls
|
|
32
51
|
|
|
52
|
+
## [1.7.2] - 2026-10-30
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- Keyless list output (search, user posts, user comments) omits the archive's lagging scores and comment counts; keyless `get_reddit_post` replaces its stats with a note and drops the engagement analysis built on them
|
|
57
|
+
- Arctic Shift throttling (HTTP 429 or "Timeout") retries once after the `X-RateLimit-Reset` time, capped at 10 seconds; a second failure says when to retry
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
|
|
61
|
+
- Subreddit and user search results no longer show blank post-only fields (author, comments)
|
|
62
|
+
- `get_subreddit_info` no longer prints an empty Community Analysis for mid-size subreddits
|
|
63
|
+
|
|
64
|
+
## [1.7.1] - 2026-10-28
|
|
65
|
+
|
|
66
|
+
### Fixed
|
|
67
|
+
|
|
68
|
+
- Keyless search no longer reports the default `relevance` sort as ignored, and subreddit search reports its subscriber order
|
|
69
|
+
- `get_reddit_post` no longer prints an empty Engagement Analysis
|
|
70
|
+
- The publish workflow waits up to 15 minutes for the npm tarball and logs in to the MCP Registry after that wait
|
|
71
|
+
|
|
72
|
+
## [1.7.0] - 2026-10-28
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
|
|
76
|
+
- Keyless reads through the [Arctic Shift](https://github.com/ArthurHeitmann/arctic_shift) archive, a free third-party Reddit archive, for posts, comment threads, users, subreddit info and rules, and search within a subreddit. Ranked listings stay on RSS and fall back to the archive's newest posts when RSS fails. Every archive result says where it came from
|
|
77
|
+
- `get_post_comments` lists the ids of collapsed comments, so `get_more_comments` can expand them
|
|
78
|
+
- `test_reddit_mcp_server` reports whether reads come from Reddit's API or keyless sources
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- Dependencies updated to latest, with ts-builds 4 and pnpm 12; Node pinned to 24.21.0 for npm publishing
|
|
83
|
+
|
|
84
|
+
## [1.6.3] - 2026-09-27
|
|
85
|
+
|
|
86
|
+
### Fixed
|
|
87
|
+
|
|
88
|
+
- Link posts show their body text as well as their URL, and comment truncation limits are higher
|
|
89
|
+
- stdio mode warns when stdin is a terminal, which means no MCP client is attached
|
|
90
|
+
|
|
91
|
+
## [1.6.2] - 2026-09-18
|
|
92
|
+
|
|
93
|
+
### Changed
|
|
94
|
+
|
|
95
|
+
- fastmcp 4.20
|
|
96
|
+
|
|
97
|
+
### Fixed
|
|
98
|
+
|
|
99
|
+
- The publish workflow waits for npm before publishing to the MCP Registry
|
|
100
|
+
|
|
101
|
+
## [1.6.1] - 2026-09-17
|
|
102
|
+
|
|
103
|
+
### Added
|
|
104
|
+
|
|
105
|
+
- `save_content` and `unsave_content`
|
|
106
|
+
|
|
107
|
+
### Fixed
|
|
108
|
+
|
|
109
|
+
- `search_reddit` with `type=sr` or `type=user` always returned no results
|
|
110
|
+
- The publish workflow tolerates an npm version that is already published
|
|
111
|
+
|
|
112
|
+
## [1.6.0] - 2026-09-17
|
|
113
|
+
|
|
114
|
+
### Added
|
|
115
|
+
|
|
116
|
+
- RSS fallback: `browse_subreddit` and `get_top_posts` work without OAuth credentials
|
|
117
|
+
|
|
118
|
+
### Deprecated
|
|
119
|
+
|
|
120
|
+
- `REDDIT_AUTH_MODE=anonymous`, because Reddit blocks unauthenticated API requests; it is now an alias for `auto` without credentials
|
|
121
|
+
|
|
122
|
+
## [1.5.3] - 2026-08-08
|
|
123
|
+
|
|
124
|
+
### Changed
|
|
125
|
+
|
|
126
|
+
- The README documents Reddit's IP block on unauthenticated requests
|
|
127
|
+
|
|
128
|
+
## [1.5.2] - 2026-08-08
|
|
129
|
+
|
|
130
|
+
### Security
|
|
131
|
+
|
|
132
|
+
- Subreddit names, usernames and thing ids are validated before they reach a request URL. A crafted value such as `../../api/v1/me` could previously steer the OAuth token to a different Reddit endpoint
|
|
133
|
+
- SECURITY.md and private vulnerability reporting
|
|
134
|
+
|
|
135
|
+
### Fixed
|
|
136
|
+
|
|
137
|
+
- When Reddit IP-blocks unauthenticated requests, the error says so and points to OAuth credentials, instead of reading as a private subreddit
|
|
138
|
+
|
|
139
|
+
## [1.5.1] - 2026-07-01
|
|
140
|
+
|
|
141
|
+
### Changed
|
|
142
|
+
|
|
143
|
+
- Richer tool descriptions and parameter docs
|
|
144
|
+
|
|
33
145
|
## [1.5.0] - 2026-06-22
|
|
34
146
|
|
|
35
147
|
### Added
|
package/README.md
CHANGED
|
@@ -11,6 +11,36 @@ A Model Context Protocol (MCP) server for interacting with Reddit - fetch posts,
|
|
|
11
11
|
<img width="380" height="200" src="https://glama.ai/mcp/servers/@jordanburke/reddit-mcp-server/badge" alt="reddit-mcp-server MCP server" />
|
|
12
12
|
</a>
|
|
13
13
|
|
|
14
|
+
## Reddit is closing its public API
|
|
15
|
+
|
|
16
|
+
Reddit announced on 2026-09-30 that it is ending RSS feeds and its public Data API, and moving apps to its Developer Platform ([r/redditdev post](https://www.reddit.com/r/redditdev/comments/1wubcvf/), [r/modnews post](https://www.reddit.com/r/modnews/comments/1wubgvt/)):
|
|
17
|
+
|
|
18
|
+
| Date | What Reddit does |
|
|
19
|
+
| ---------- | ------------------------------------------------------------------------------------------------------- |
|
|
20
|
+
| 2026-10-31 | Stops accepting new requests for public API access |
|
|
21
|
+
| 2026-11-13 | Stops supporting RSS feeds |
|
|
22
|
+
| 2027-01-12 | Starts removing API access for apps and users that haven't registered or responded to Reddit's outreach |
|
|
23
|
+
| March 2027 | Closes public API access for all remaining apps and users |
|
|
24
|
+
|
|
25
|
+
### What this server uses to keep working
|
|
26
|
+
|
|
27
|
+
The server reads from three sources and uses the best one you have:
|
|
28
|
+
|
|
29
|
+
| Source | Needs | Used for | Lasts until |
|
|
30
|
+
| ---------------------------------------------------------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| Reddit's API (OAuth) | `REDDIT_CLIENT_ID` and `REDDIT_CLIENT_SECRET` | Every tool, with live data (writes also need username and password) | March 2027, per Reddit |
|
|
32
|
+
| Reddit's RSS feeds | Nothing | Ranked listings (hot, top, rising, controversial) and the home feed, without credentials | 2026-11-13 |
|
|
33
|
+
| [Arctic Shift](https://github.com/ArthurHeitmann/arctic_shift) archive | Nothing | Most read tools without credentials | No announced end. It's free, run by one volunteer, has no uptime guarantee, and gets its data from Reddit's API |
|
|
34
|
+
|
|
35
|
+
Arctic Shift is a third-party copy of Reddit, not Reddit's API, though it [collects its data through Reddit's API](https://github.com/ArthurHeitmann/arctic_shift/blob/master/file_content_explanations.md). Its scores and comment counts lag, and every result from it says so. See [Keyless Mode](#keyless-mode) for what each tool can do without credentials.
|
|
36
|
+
|
|
37
|
+
### What it means for you
|
|
38
|
+
|
|
39
|
+
- **You have OAuth credentials:** every read tool works. Write tools also need `REDDIT_USERNAME` and `REDDIT_PASSWORD`. Register your app at [developers.reddit.com/app-registration](https://developers.reddit.com/app-registration) before 2027-01-12, or Reddit may remove its access early.
|
|
40
|
+
- **You don't have credentials:** most read tools work with no setup. Reddit no longer accepts new API access requests, so new users run in keyless mode.
|
|
41
|
+
- **After 2026-11-13:** without credentials, ranked listings for a single subreddit fall back to the archive's newest posts, because RSS is gone. The home feed and multireddits have no keyless source after that date.
|
|
42
|
+
- **After March 2027:** Reddit says public API access closes, and that is the path the OAuth tools use, so the write tools and the OAuth-only reads stop working. Arctic Shift says it collects all its data through Reddit's API, so the archive may stop getting new posts then. Keyless reads would still return what it already holds.
|
|
43
|
+
|
|
14
44
|
## Features at a Glance
|
|
15
45
|
|
|
16
46
|
| Feature | reddit-mcp-server | Other Reddit MCPs |
|
|
@@ -39,7 +69,7 @@ Download and open the extension file - Claude Desktop will install it automatica
|
|
|
39
69
|
|
|
40
70
|
### Option 2: NPX (No install required)
|
|
41
71
|
|
|
42
|
-
Add to your MCP config (Claude Desktop, Cursor, etc.) with
|
|
72
|
+
Add to your MCP config (Claude Desktop, Cursor, etc.). Credentials are optional: without them the server runs in [keyless mode](#keyless-mode), and with them you get live data and every tool.
|
|
43
73
|
|
|
44
74
|
```json
|
|
45
75
|
{
|
|
@@ -63,6 +93,8 @@ REDDIT_CLIENT_ID=your_client_id REDDIT_CLIENT_SECRET=your_client_secret \
|
|
|
63
93
|
claude mcp add --transport stdio reddit -- npx reddit-mcp-server
|
|
64
94
|
```
|
|
65
95
|
|
|
96
|
+
Leave out the two variables to run keyless.
|
|
97
|
+
|
|
66
98
|
## Features
|
|
67
99
|
|
|
68
100
|
### Read-only Tools
|
|
@@ -72,16 +104,27 @@ REDDIT_CLIENT_ID=your_client_id REDDIT_CLIENT_SECRET=your_client_secret \
|
|
|
72
104
|
| `get_reddit_post` | Get a specific Reddit post with engagement analysis |
|
|
73
105
|
| `get_top_posts` | Get top posts from a subreddit or home feed |
|
|
74
106
|
| `browse_subreddit` | Browse a subreddit/home feed by sort (hot, new, top, rising, controversial) |
|
|
107
|
+
| `get_post_comments` | Get comments from a specific post with threading |
|
|
108
|
+
| `get_more_comments` | Expand collapsed comments in a thread |
|
|
75
109
|
| `get_user_info` | Get detailed information about a Reddit user |
|
|
76
110
|
| `get_user_posts` | Get posts submitted by a specific user |
|
|
77
111
|
| `get_user_comments` | Get comments made by a specific user |
|
|
78
112
|
| `get_subreddit_info` | Get subreddit details and statistics |
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
113
|
+
| `get_subreddit_rules` | Get a subreddit's posting rules |
|
|
114
|
+
| `search_reddit` | Search for posts, subreddits, or users |
|
|
115
|
+
| `get_trending_subreddits` | Get currently trending subreddits (needs OAuth) |
|
|
116
|
+
| `get_post_flairs` | List a subreddit's available post flairs (needs OAuth) |
|
|
117
|
+
| `get_me` | Get your own account info (needs OAuth and user credentials) |
|
|
118
|
+
| `get_my_overview` | Get your own recent posts and comments (needs OAuth and user credentials) |
|
|
119
|
+
| `get_my_saved` | Get your saved posts and comments (needs OAuth and user credentials) |
|
|
120
|
+
| `test_reddit_mcp_server` | Check server status and configuration |
|
|
121
|
+
|
|
122
|
+
Most read tools also work without credentials. See [Keyless Mode](#keyless-mode) for each tool's limits.
|
|
82
123
|
|
|
83
124
|
### Write Tools (Require User Credentials)
|
|
84
125
|
|
|
126
|
+
Write tools need Reddit's API, so they need OAuth credentials plus `REDDIT_USERNAME` and `REDDIT_PASSWORD`. Reddit closes its public API in March 2027 ([details](#reddit-is-closing-its-public-api)).
|
|
127
|
+
|
|
85
128
|
| Tool | Description |
|
|
86
129
|
| ---------------- | ---------------------------------------------- |
|
|
87
130
|
| `create_post` | Create a new post in a subreddit |
|
|
@@ -99,8 +142,8 @@ REDDIT_CLIENT_ID=your_client_id REDDIT_CLIENT_SECRET=your_client_secret \
|
|
|
99
142
|
|
|
100
143
|
| Variable | Required | Default | Description |
|
|
101
144
|
| ----------------------- | -------- | -------------- | --------------------------------------------------------------------- |
|
|
102
|
-
| `REDDIT_CLIENT_ID` |
|
|
103
|
-
| `REDDIT_CLIENT_SECRET` |
|
|
145
|
+
| `REDDIT_CLIENT_ID` | No | - | Reddit app client ID (omit for keyless mode) |
|
|
146
|
+
| `REDDIT_CLIENT_SECRET` | No | - | Reddit app client secret |
|
|
104
147
|
| `REDDIT_USERNAME` | No | - | Reddit username (for write operations) |
|
|
105
148
|
| `REDDIT_PASSWORD` | No | - | Reddit password (for write operations) |
|
|
106
149
|
| `REDDIT_USER_AGENT` | No | Auto-generated | Custom User-Agent string |
|
|
@@ -112,7 +155,7 @@ REDDIT_CLIENT_ID=your_client_id REDDIT_CLIENT_SECRET=your_client_secret \
|
|
|
112
155
|
| `REDDIT_CACHE_MAX_MB` | No | `50` | Cache size cap in MB (LRU eviction beyond this) |
|
|
113
156
|
| `REDDIT_MAX_RETRIES` | No | `3` | Retries on HTTP 429 with Retry-After backoff (`0` to disable) |
|
|
114
157
|
|
|
115
|
-
|
|
158
|
+
Credentials are optional. See [Keyless Mode](#keyless-mode) for what works without them.
|
|
116
159
|
|
|
117
160
|
### Full MCP Config Example
|
|
118
161
|
|
|
@@ -200,17 +243,17 @@ export REDDIT_BOT_FOOTER=$'\n\n---\n^(🤖 Custom bot footer text)'
|
|
|
200
243
|
|
|
201
244
|
### ⚠️ Reddit API Changes (2026)
|
|
202
245
|
|
|
203
|
-
**
|
|
246
|
+
**Reddit's unauthenticated API no longer works.** As of mid-2026, Reddit blocks unauthenticated API requests with HTTP 403, so reading Reddit's API needs OAuth credentials. `REDDIT_AUTH_MODE=anonymous` still exists, but it is now an alias for [keyless mode](#keyless-mode).
|
|
204
247
|
|
|
205
|
-
**Reddit is
|
|
248
|
+
**Reddit is closing its public API.** See [Reddit is closing its public API](#reddit-is-closing-its-public-api) for the dates and what this server does about them.
|
|
206
249
|
|
|
207
|
-
|
|
250
|
+
Reddit closed self-service OAuth app creation in November 2025, and as of 2026-10-31 it accepts no new requests for public API access. Existing OAuth credentials keep working until March 2027 if the app is registered by 2027-01-12. Reddit starts removing access for unregistered apps on that date.
|
|
208
251
|
|
|
209
252
|
### Getting Credentials
|
|
210
253
|
|
|
211
|
-
**If you already have a Reddit app** (created at `/prefs/apps` before November 2025): use your existing client ID and secret
|
|
254
|
+
**If you already have a Reddit app** (created at `/prefs/apps` before November 2025, or approved through Reddit's Developer Support): use your existing client ID and secret. They still work at 60-100 req/min. Register the app at [developers.reddit.com/app-registration](https://developers.reddit.com/app-registration) before 2027-01-12.
|
|
212
255
|
|
|
213
|
-
**If you
|
|
256
|
+
**If you don't have credentials**: Reddit no longer accepts new requests for public API access, so use [keyless mode](#keyless-mode).
|
|
214
257
|
|
|
215
258
|
### Mode Comparison
|
|
216
259
|
|
|
@@ -218,7 +261,7 @@ Additionally, Reddit closed self-service OAuth app creation in November 2025. Ne
|
|
|
218
261
|
| ----------------- | -------------- | ----------------- | ----------------------------------------------- | ------------- |
|
|
219
262
|
| `auto` (default) | 60-100 req/min | OAuth credentials | All tools | Most users |
|
|
220
263
|
| `authenticated` | 60-100 req/min | OAuth credentials | All tools | Explicit mode |
|
|
221
|
-
| `auto` (no creds) | Shared, free | None | Most read tools ([Keyless Mode](#keyless-mode)) |
|
|
264
|
+
| `auto` (no creds) | Shared, free | None | Most read tools ([Keyless Mode](#keyless-mode)) | New users |
|
|
222
265
|
| `anonymous` | Shared, free | None | Same as `auto` without credentials | Legacy alias |
|
|
223
266
|
|
|
224
267
|
### Keyless Mode
|
|
@@ -242,7 +285,7 @@ Without OAuth credentials, reads come from two free sources:
|
|
|
242
285
|
|
|
243
286
|
**Archive caveats:** scores and comment counts lag, and are often 0 or 1 on recent posts. Keyword search on large subreddits is slow, and the archive throttles it. The server waits up to 10 seconds and retries once. If that fails too, the error says when to retry. Every archive result ends with a note naming the source.
|
|
244
287
|
|
|
245
|
-
**Still needs OAuth:** `get_trending_subreddits`, `get_post_flairs`, `get_me`, `get_my_overview`, `get_my_saved`, and all write tools.
|
|
288
|
+
**Still needs OAuth:** `get_trending_subreddits`, `get_post_flairs`, `get_me`, `get_my_overview`, `get_my_saved`, `search_reddit` with `type=user`, and all write tools.
|
|
246
289
|
|
|
247
290
|
### Read-Only Access (OAuth)
|
|
248
291
|
|
|
@@ -278,7 +321,9 @@ To create posts, reply, edit, or delete content, add your Reddit username and pa
|
|
|
278
321
|
```bash
|
|
279
322
|
pnpm install # Install dependencies
|
|
280
323
|
pnpm build # Build TypeScript
|
|
281
|
-
pnpm dev #
|
|
324
|
+
pnpm dev # Rebuild on every change
|
|
325
|
+
pnpm inspect # Build and open the MCP inspector
|
|
326
|
+
pnpm validate # Format, lint, typecheck, test and build
|
|
282
327
|
pnpm test # Run tests
|
|
283
328
|
pnpm lint # Lint code
|
|
284
329
|
pnpm format # Format code
|
|
@@ -289,7 +334,6 @@ pnpm format # Format code
|
|
|
289
334
|
```bash
|
|
290
335
|
npx reddit-mcp-server --version # Show version
|
|
291
336
|
npx reddit-mcp-server --help # Show help
|
|
292
|
-
npx reddit-mcp-server --generate-token # Generate OAuth token for HTTP mode
|
|
293
337
|
```
|
|
294
338
|
|
|
295
339
|
## HTTP Server Mode
|
|
@@ -300,23 +344,30 @@ For Docker deployments or web-based clients, use HTTP transport:
|
|
|
300
344
|
TRANSPORT_TYPE=httpStream PORT=3000 node dist/index.js
|
|
301
345
|
```
|
|
302
346
|
|
|
347
|
+
- The MCP endpoint is Streamable HTTP at `/mcp`. Version 2.0 removed the legacy SSE endpoint (`/sse`) and `/ready`.
|
|
348
|
+
- The server binds `127.0.0.1` unless you set `HOST`. The Docker image sets `HOST=0.0.0.0`.
|
|
349
|
+
- `/health` answers `{"name":"reddit-mcp-server","status":"running"}` and needs no token.
|
|
350
|
+
|
|
303
351
|
### With OAuth Protection
|
|
304
352
|
|
|
305
353
|
```bash
|
|
306
354
|
export OAUTH_ENABLED=true
|
|
307
|
-
export OAUTH_TOKEN=$(
|
|
355
|
+
export OAUTH_TOKEN=$(openssl rand -hex 32)
|
|
308
356
|
TRANSPORT_TYPE=httpStream node dist/index.js
|
|
309
357
|
```
|
|
310
358
|
|
|
311
|
-
Make authenticated requests:
|
|
359
|
+
If `OAUTH_TOKEN` is unset or empty, the server generates one and prints it at startup. Make authenticated requests:
|
|
312
360
|
|
|
313
361
|
```bash
|
|
314
362
|
curl -H "Authorization: Bearer $OAUTH_TOKEN" \
|
|
315
363
|
-H "Content-Type: application/json" \
|
|
316
|
-
-
|
|
364
|
+
-H "Accept: application/json, text/event-stream" \
|
|
365
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' \
|
|
317
366
|
http://localhost:3000/mcp
|
|
318
367
|
```
|
|
319
368
|
|
|
369
|
+
A request with no token gets 401, and a wrong token gets 403.
|
|
370
|
+
|
|
320
371
|
## Docker
|
|
321
372
|
|
|
322
373
|
### Quick Start
|
|
@@ -334,6 +385,8 @@ docker run -d \
|
|
|
334
385
|
ghcr.io/jordanburke/reddit-mcp-server:latest
|
|
335
386
|
```
|
|
336
387
|
|
|
388
|
+
Leave out the two credential variables to run the container keyless.
|
|
389
|
+
|
|
337
390
|
### Docker Compose
|
|
338
391
|
|
|
339
392
|
```yaml
|
|
@@ -349,6 +402,7 @@ services:
|
|
|
349
402
|
- REDDIT_PASSWORD=${REDDIT_PASSWORD}
|
|
350
403
|
- REDDIT_SAFE_MODE=standard
|
|
351
404
|
- OAUTH_ENABLED=${OAUTH_ENABLED:-false}
|
|
405
|
+
# Unset or empty: the server generates a token and prints it at startup
|
|
352
406
|
- OAUTH_TOKEN=${OAUTH_TOKEN}
|
|
353
407
|
restart: unless-stopped
|
|
354
408
|
```
|
package/dist/bin.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// src/bin.ts
|
|
3
|
-
process.env.TRANSPORT_TYPE
|
|
3
|
+
if ((process.env.TRANSPORT_TYPE ?? "").trim() === "") process.env.TRANSPORT_TYPE = "stdio";
|
|
4
4
|
const args = process.argv.slice(2);
|
|
5
5
|
if (args.includes("--version") || args.includes("-v")) {
|
|
6
|
-
console.log("2.0.
|
|
6
|
+
console.log("2.0.1");
|
|
7
7
|
process.exit(0);
|
|
8
8
|
}
|
|
9
9
|
if (args.includes("--help") || args.includes("-h")) {
|
|
10
10
|
console.log(`
|
|
11
|
-
Reddit MCP Server v2.0.
|
|
11
|
+
Reddit MCP Server v2.0.1
|
|
12
12
|
|
|
13
13
|
Usage: reddit-mcp-server [options]
|
|
14
14
|
|
|
@@ -22,15 +22,21 @@ expects an MCP client such as Claude Desktop or Claude Code on stdin/stdout.
|
|
|
22
22
|
Run as HTTP: TRANSPORT_TYPE=httpStream npx reddit-mcp-server
|
|
23
23
|
|
|
24
24
|
Environment Variables:
|
|
25
|
-
REDDIT_CLIENT_ID Reddit API client ID (optional,
|
|
26
|
-
REDDIT_CLIENT_SECRET Reddit API client secret (optional,
|
|
25
|
+
REDDIT_CLIENT_ID Reddit API client ID (optional; without it, reads are keyless)
|
|
26
|
+
REDDIT_CLIENT_SECRET Reddit API client secret (optional, used with the client ID)
|
|
27
27
|
REDDIT_USERNAME Reddit username (optional, for write operations)
|
|
28
28
|
REDDIT_PASSWORD Reddit password (optional, for write operations)
|
|
29
29
|
REDDIT_USER_AGENT Custom user agent (optional)
|
|
30
|
-
REDDIT_AUTH_MODE Authentication mode: auto, authenticated
|
|
30
|
+
REDDIT_AUTH_MODE Authentication mode: auto, authenticated (default: auto; anonymous is deprecated)
|
|
31
31
|
REDDIT_SAFE_MODE Spam protection: off, standard, strict (default: standard)
|
|
32
32
|
REDDIT_BOT_DISCLOSURE Bot disclosure footer: auto, off (default: off)
|
|
33
33
|
REDDIT_BOT_FOOTER Custom bot footer text (optional, used with REDDIT_BOT_DISCLOSURE=auto)
|
|
34
|
+
TRANSPORT_TYPE Set to httpStream to serve Streamable HTTP at /mcp (default: stdio)
|
|
35
|
+
PORT, HOST HTTP port and bind address (defaults: 3000, 127.0.0.1)
|
|
36
|
+
OAUTH_ENABLED Set to true to require a bearer token on HTTP (token from OAUTH_TOKEN)
|
|
37
|
+
|
|
38
|
+
Without OAuth credentials, reads come from Reddit's RSS feeds (until 2026-11-13) and the
|
|
39
|
+
Arctic Shift archive. Reddit closes its public API in March 2027.
|
|
34
40
|
|
|
35
41
|
For more information, visit: https://github.com/jordanburke/reddit-mcp-server
|
|
36
42
|
`);
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\ndeclare const __VERSION__: string\n\n// Force stdio mode for CLI/npx usage (unless explicitly overridden)\
|
|
1
|
+
{"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\ndeclare const __VERSION__: string\n\n// Force stdio mode for CLI/npx usage (unless explicitly overridden)\n// A blank value (TRANSPORT_TYPE=) counts as unset, as it does in index.ts.\nif ((process.env.TRANSPORT_TYPE ?? \"\").trim() === \"\") process.env.TRANSPORT_TYPE = \"stdio\"\n\n// Handle command line arguments BEFORE any other imports\nconst args = process.argv.slice(2)\n\nif (args.includes(\"--version\") || args.includes(\"-v\")) {\n console.log(__VERSION__)\n process.exit(0)\n}\n\nif (args.includes(\"--help\") || args.includes(\"-h\")) {\n console.log(`\nReddit MCP Server v${__VERSION__}\n\nUsage: reddit-mcp-server [options]\n\nOptions:\n -v, --version Show version number\n -h, --help Show help\n\nThis is an MCP server, not an interactive CLI. In stdio mode (the default here) it\nexpects an MCP client such as Claude Desktop or Claude Code on stdin/stdout.\n Test interactively: npx @modelcontextprotocol/inspector npx reddit-mcp-server\n Run as HTTP: TRANSPORT_TYPE=httpStream npx reddit-mcp-server\n\nEnvironment Variables:\n REDDIT_CLIENT_ID Reddit API client ID (optional; without it, reads are keyless)\n REDDIT_CLIENT_SECRET Reddit API client secret (optional, used with the client ID)\n REDDIT_USERNAME Reddit username (optional, for write operations)\n REDDIT_PASSWORD Reddit password (optional, for write operations)\n REDDIT_USER_AGENT Custom user agent (optional)\n REDDIT_AUTH_MODE Authentication mode: auto, authenticated (default: auto; anonymous is deprecated)\n REDDIT_SAFE_MODE Spam protection: off, standard, strict (default: standard)\n REDDIT_BOT_DISCLOSURE Bot disclosure footer: auto, off (default: off)\n REDDIT_BOT_FOOTER Custom bot footer text (optional, used with REDDIT_BOT_DISCLOSURE=auto)\n TRANSPORT_TYPE Set to httpStream to serve Streamable HTTP at /mcp (default: stdio)\n PORT, HOST HTTP port and bind address (defaults: 3000, 127.0.0.1)\n OAUTH_ENABLED Set to true to require a bearer token on HTTP (token from OAUTH_TOKEN)\n\nWithout OAuth credentials, reads come from Reddit's RSS feeds (until 2026-11-13) and the\nArctic Shift archive. Reddit closes its public API in March 2027.\n\nFor more information, visit: https://github.com/jordanburke/reddit-mcp-server\n`)\n process.exit(0)\n}\n\n// Import and start server if not showing version/help\nasync function main() {\n await import(\"./index.js\")\n}\n\nvoid main().catch(console.error)\n"],"mappings":";;AAMA,KAAK,QAAQ,IAAI,kBAAkB,GAAA,CAAI,KAAK,MAAM,IAAI,QAAQ,IAAI,iBAAiB;AAGnF,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,IAAI,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,IAAI,GAAG;CACrD,QAAQ,IAAA,OAAe;CACvB,QAAQ,KAAK,CAAC;AAChB;AAEA,IAAI,KAAK,SAAS,QAAQ,KAAK,KAAK,SAAS,IAAI,GAAG;CAClD,QAAQ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCb;CACC,QAAQ,KAAK,CAAC;AAChB;AAGA,eAAe,OAAO;CACpB,MAAM,OAAO;AACf;AAEK,KAAK,CAAC,CAAC,MAAM,QAAQ,KAAK"}
|
package/dist/index.js
CHANGED
|
@@ -1363,6 +1363,22 @@ function initializeRedditClient(config) {
|
|
|
1363
1363
|
function getRedditClient() {
|
|
1364
1364
|
return clientHolder.instance;
|
|
1365
1365
|
}
|
|
1366
|
+
// src/utils/env.ts
|
|
1367
|
+
/**
|
|
1368
|
+
* Read an environment variable, treating an empty or whitespace-only value as unset.
|
|
1369
|
+
*
|
|
1370
|
+
* dotenv turns a `KEY=` line into an empty string, so a copied `.env.example` would
|
|
1371
|
+
* otherwise read as configured: `OAUTH_TOKEN=` locked out every HTTP client, and
|
|
1372
|
+
* `REDDIT_AUTH_MODE=authenticated` with blank credentials started keyless instead of failing.
|
|
1373
|
+
* The value is returned as written; it is not trimmed, so a password may contain spaces.
|
|
1374
|
+
*/
|
|
1375
|
+
function readEnv(name, env = process.env) {
|
|
1376
|
+
return Option(env[name]).filter((value) => value.trim() !== "");
|
|
1377
|
+
}
|
|
1378
|
+
/** True when both `REDDIT_USERNAME` and `REDDIT_PASSWORD` are set to non-blank values. */
|
|
1379
|
+
function hasUserCredentials(env = process.env) {
|
|
1380
|
+
return readEnv("REDDIT_USERNAME", env).isSome() && readEnv("REDDIT_PASSWORD", env).isSome();
|
|
1381
|
+
}
|
|
1366
1382
|
// src/utils/formatters.ts
|
|
1367
1383
|
function formatTimestamp(timestamp) {
|
|
1368
1384
|
return Try(() => {
|
|
@@ -1532,7 +1548,7 @@ function formatCommentInfo(comment, maxLength = COMMENT_CONTENT_MAX_LENGTH) {
|
|
|
1532
1548
|
}
|
|
1533
1549
|
// src/index.ts
|
|
1534
1550
|
dotenv.config({ quiet: true });
|
|
1535
|
-
const VERSION = "2.0.
|
|
1551
|
+
const VERSION = "2.0.1";
|
|
1536
1552
|
function validateUserAgent(userAgent, username) {
|
|
1537
1553
|
if (!/^[\w-]+:[\w-]+:[\d.]+ \(by \/u\/\w+\)$/.test(userAgent)) {
|
|
1538
1554
|
console.error("[Warning] User-Agent does not follow Reddit's recommended format");
|
|
@@ -1652,13 +1668,13 @@ function formatUserContent(heading, content) {
|
|
|
1652
1668
|
}).join("\n")}\n\n`}${content.posts.length === 0 && content.comments.length === 0 ? "No items found.\n\n" : ""}`.trimEnd() + nextPageHint(content.after);
|
|
1653
1669
|
}
|
|
1654
1670
|
async function setupRedditClient() {
|
|
1655
|
-
const clientId =
|
|
1656
|
-
const clientSecret =
|
|
1657
|
-
const customUserAgent =
|
|
1658
|
-
const username =
|
|
1659
|
-
const password =
|
|
1660
|
-
const authMode =
|
|
1661
|
-
const safeMode =
|
|
1671
|
+
const clientId = readEnv("REDDIT_CLIENT_ID").orUndefined();
|
|
1672
|
+
const clientSecret = readEnv("REDDIT_CLIENT_SECRET").orUndefined();
|
|
1673
|
+
const customUserAgent = readEnv("REDDIT_USER_AGENT").orUndefined();
|
|
1674
|
+
const username = readEnv("REDDIT_USERNAME").orUndefined();
|
|
1675
|
+
const password = readEnv("REDDIT_PASSWORD").orUndefined();
|
|
1676
|
+
const authMode = readEnv("REDDIT_AUTH_MODE").orElse("auto");
|
|
1677
|
+
const safeMode = readEnv("REDDIT_SAFE_MODE").orElse("standard");
|
|
1662
1678
|
if (") : ""
|
|
1691
1707
|
};
|
|
1692
|
-
const cacheEnabled = (
|
|
1693
|
-
const cacheMaxMb = Number(
|
|
1708
|
+
const cacheEnabled = readEnv("REDDIT_CACHE").orElse("on") !== "off";
|
|
1709
|
+
const cacheMaxMb = Number(readEnv("REDDIT_CACHE_MAX_MB").orElse("50"));
|
|
1694
1710
|
const cacheConfig = {
|
|
1695
1711
|
enabled: cacheEnabled,
|
|
1696
1712
|
maxBytes: (Number.isFinite(cacheMaxMb) && cacheMaxMb > 0 ? cacheMaxMb : 50) * 1024 * 1024
|
|
1697
1713
|
};
|
|
1698
|
-
const maxRetriesRaw = Number(
|
|
1714
|
+
const maxRetriesRaw = Number(readEnv("REDDIT_MAX_RETRIES").orElse("3"));
|
|
1699
1715
|
const client = initializeRedditClient({
|
|
1700
1716
|
clientId: clientId ?? "",
|
|
1701
1717
|
clientSecret: clientSecret ?? "",
|
|
@@ -1719,8 +1735,9 @@ async function setupRedditClient() {
|
|
|
1719
1735
|
console.error("[Setup] Keyless mode — no OAuth credentials detected.");
|
|
1720
1736
|
console.error("[Setup] Reads come from RSS feeds (ranked listings, until Reddit retires them 2026-11-13)");
|
|
1721
1737
|
console.error("[Setup] and the Arctic Shift archive (a free third-party Reddit archive; scores lag).");
|
|
1722
|
-
console.error("[Setup]
|
|
1723
|
-
console.error("[Setup]
|
|
1738
|
+
console.error("[Setup] Existing REDDIT_CLIENT_ID and REDDIT_CLIENT_SECRET still give live data (60-100 req/min).");
|
|
1739
|
+
console.error("[Setup] Reddit takes no new API access requests and closes its public API in March 2027.");
|
|
1740
|
+
console.error("[Setup] See: https://github.com/jordanburke/reddit-mcp-server#reddit-is-closing-its-public-api");
|
|
1724
1741
|
} else {
|
|
1725
1742
|
console.error("[Setup] Testing Reddit API connection...");
|
|
1726
1743
|
if (!await client.checkAuthentication()) {
|
|
@@ -1749,8 +1766,9 @@ async function setupRedditClient() {
|
|
|
1749
1766
|
console.error("[Setup] For Reddit policy compliance, consider REDDIT_BOT_DISCLOSURE=auto");
|
|
1750
1767
|
}
|
|
1751
1768
|
}
|
|
1752
|
-
const
|
|
1753
|
-
|
|
1769
|
+
const configuredOauthToken = readEnv("OAUTH_TOKEN");
|
|
1770
|
+
const oauthToken = configuredOauthToken.orElse(crypto.randomBytes(32).toString("hex"));
|
|
1771
|
+
if (readEnv("OAUTH_ENABLED").orElse("false") === "true" && configuredOauthToken.isNone()) console.error(`[Auth] Generated OAuth token: ${oauthToken}`);
|
|
1754
1772
|
function authenticateBearer(request) {
|
|
1755
1773
|
const authHeader = getRequestHeader(request, "authorization");
|
|
1756
1774
|
if (!(authHeader === null || authHeader === void 0 ? void 0 : authHeader.startsWith("Bearer "))) return Promise.reject(new Response(null, { status: 401 }));
|
|
@@ -1759,7 +1777,8 @@ function authenticateBearer(request) {
|
|
|
1759
1777
|
if (!crypto.timingSafeEqual(tokenHash, expectedHash)) return Promise.reject(new Response(null, { status: 403 }));
|
|
1760
1778
|
return Promise.resolve({ authenticated: true });
|
|
1761
1779
|
}
|
|
1762
|
-
const
|
|
1780
|
+
const transportType = readEnv("TRANSPORT_TYPE").orElse("stdio");
|
|
1781
|
+
const useHttp = transportType === "httpStream" || transportType === "http";
|
|
1763
1782
|
const server = createServer({
|
|
1764
1783
|
name: "reddit-mcp-server",
|
|
1765
1784
|
version: VERSION,
|
|
@@ -1786,7 +1805,7 @@ IMPORTANT - Reddit Responsible Builder Policy compliance:
|
|
|
1786
1805
|
- All bot-generated content must clearly disclose its automated nature
|
|
1787
1806
|
- Bots must NOT send private/direct messages without explicit user consent
|
|
1788
1807
|
For details: https://support.reddithelp.com/hc/en-us/articles/42728983564564-Responsible-Builder-Policy`,
|
|
1789
|
-
...useHttp &&
|
|
1808
|
+
...useHttp && readEnv("OAUTH_ENABLED").orElse("false") === "true" ? { authenticate: authenticateBearer } : {},
|
|
1790
1809
|
enableIntrospection: false,
|
|
1791
1810
|
enableInfoEndpoint: false,
|
|
1792
1811
|
enableDashboard: false,
|
|
@@ -1804,7 +1823,7 @@ server.addTool({
|
|
|
1804
1823
|
execute: () => {
|
|
1805
1824
|
const client = getRedditClient();
|
|
1806
1825
|
const hasAuth = client.fold(() => "✗", () => "✓");
|
|
1807
|
-
const hasWriteAccess =
|
|
1826
|
+
const hasWriteAccess = hasUserCredentials() ? "✓" : "✗";
|
|
1808
1827
|
return Promise.resolve(`Reddit MCP Server Status:
|
|
1809
1828
|
- Server: ✓ Running
|
|
1810
1829
|
- Reddit Client: ${hasAuth} ${client.fold(() => "Not initialized", () => "Initialized")}
|
|
@@ -2320,7 +2339,7 @@ server.addTool({
|
|
|
2320
2339
|
}),
|
|
2321
2340
|
execute: async (args) => {
|
|
2322
2341
|
const client = unwrapClient();
|
|
2323
|
-
if (
|
|
2342
|
+
if (!hasUserCredentials()) return toolError("User authentication required. Please set REDDIT_USERNAME and REDDIT_PASSWORD environment variables.");
|
|
2324
2343
|
return (await client.createPost(args.subreddit, args.title, args.content, args.is_self, args.flair_id, args.flair_text)).fold((err) => toolError(`Failed to create post: ${err.message}`), (post) => {
|
|
2325
2344
|
const formattedPost = formatPostInfo(post);
|
|
2326
2345
|
return `# Post Created Successfully
|
|
@@ -2351,12 +2370,12 @@ server.addTool({
|
|
|
2351
2370
|
}),
|
|
2352
2371
|
execute: async (args) => {
|
|
2353
2372
|
const client = unwrapClient();
|
|
2354
|
-
if (
|
|
2373
|
+
if (!hasUserCredentials()) return toolError("User authentication required. Please set REDDIT_USERNAME and REDDIT_PASSWORD environment variables.");
|
|
2355
2374
|
return (await client.replyToPost(args.post_id, args.content)).fold((err) => toolError(`Failed to reply: ${err.message}`), (comment) => `# Reply Posted Successfully
|
|
2356
2375
|
|
|
2357
2376
|
## Comment Details
|
|
2358
2377
|
- Posted to: ${args.post_id}
|
|
2359
|
-
- Author: u/${
|
|
2378
|
+
- Author: u/${readEnv("REDDIT_USERNAME").orElse("")}
|
|
2360
2379
|
- Comment ID: ${comment.id}
|
|
2361
2380
|
|
|
2362
2381
|
Your reply has been successfully posted.`);
|
|
@@ -2375,7 +2394,7 @@ server.addTool({
|
|
|
2375
2394
|
parameters: z.object({ thing_id: z.string().describe("The post to delete: a full thing id 't3_<id>' or just the base36 post id '<id>' (the 't3_' prefix is added automatically). Must be a post you authored.") }),
|
|
2376
2395
|
execute: async (args) => {
|
|
2377
2396
|
const client = unwrapClient();
|
|
2378
|
-
if (
|
|
2397
|
+
if (!hasUserCredentials()) return toolError("User authentication required. Please set REDDIT_USERNAME and REDDIT_PASSWORD environment variables.");
|
|
2379
2398
|
return (await client.deletePost(args.thing_id)).fold((err) => toolError(`Failed to delete post: ${err.message}`), () => `# Post Deleted Successfully
|
|
2380
2399
|
|
|
2381
2400
|
The post ${args.thing_id} has been permanently deleted from Reddit.
|
|
@@ -2396,7 +2415,7 @@ server.addTool({
|
|
|
2396
2415
|
parameters: z.object({ thing_id: z.string().describe("The comment to delete: a full thing id 't1_<id>' or just the base36 comment id '<id>' (the 't1_' prefix is added automatically). Must be a comment you authored.") }),
|
|
2397
2416
|
execute: async (args) => {
|
|
2398
2417
|
const client = unwrapClient();
|
|
2399
|
-
if (
|
|
2418
|
+
if (!hasUserCredentials()) return toolError("User authentication required. Please set REDDIT_USERNAME and REDDIT_PASSWORD environment variables.");
|
|
2400
2419
|
return (await client.deleteComment(args.thing_id)).fold((err) => toolError(`Failed to delete comment: ${err.message}`), () => `# Comment Deleted Successfully
|
|
2401
2420
|
|
|
2402
2421
|
The comment ${args.thing_id} has been permanently deleted from Reddit.
|
|
@@ -2420,7 +2439,7 @@ server.addTool({
|
|
|
2420
2439
|
}),
|
|
2421
2440
|
execute: async (args) => {
|
|
2422
2441
|
const client = unwrapClient();
|
|
2423
|
-
if (
|
|
2442
|
+
if (!hasUserCredentials()) return toolError("User authentication required. Please set REDDIT_USERNAME and REDDIT_PASSWORD environment variables.");
|
|
2424
2443
|
return (await client.editPost(args.thing_id, args.new_text)).fold((err) => toolError(`Failed to edit post: ${err.message}`), () => `# Post Edited Successfully
|
|
2425
2444
|
|
|
2426
2445
|
The post ${args.thing_id} has been updated with your new content.
|
|
@@ -2448,7 +2467,7 @@ server.addTool({
|
|
|
2448
2467
|
}),
|
|
2449
2468
|
execute: async (args) => {
|
|
2450
2469
|
const client = unwrapClient();
|
|
2451
|
-
if (
|
|
2470
|
+
if (!hasUserCredentials()) return toolError("User authentication required. Please set REDDIT_USERNAME and REDDIT_PASSWORD environment variables.");
|
|
2452
2471
|
return (await client.editComment(args.thing_id, args.new_text)).fold((err) => toolError(`Failed to edit comment: ${err.message}`), () => `# Comment Edited Successfully
|
|
2453
2472
|
|
|
2454
2473
|
The comment ${args.thing_id} has been updated with your new content.
|
|
@@ -2472,7 +2491,7 @@ server.addTool({
|
|
|
2472
2491
|
}),
|
|
2473
2492
|
execute: async (args) => {
|
|
2474
2493
|
const client = unwrapClient();
|
|
2475
|
-
if (
|
|
2494
|
+
if (!hasUserCredentials()) return toolError("User authentication required. Please set REDDIT_USERNAME and REDDIT_PASSWORD environment variables.");
|
|
2476
2495
|
return (await client.saveContent(args.thing_id, args.category)).fold((err) => toolError(`Failed to save content: ${err.message}`), () => `# Content Saved Successfully
|
|
2477
2496
|
|
|
2478
2497
|
${args.thing_id} has been saved to your account. Use get_my_saved to view your saved items.`);
|
|
@@ -2491,7 +2510,7 @@ server.addTool({
|
|
|
2491
2510
|
parameters: z.object({ thing_id: z.string().describe("The post or comment to unsave: a full thing id 't3_<id>' (post) or 't1_<id>' (comment). A bare id is treated as a post.") }),
|
|
2492
2511
|
execute: async (args) => {
|
|
2493
2512
|
const client = unwrapClient();
|
|
2494
|
-
if (
|
|
2513
|
+
if (!hasUserCredentials()) return toolError("User authentication required. Please set REDDIT_USERNAME and REDDIT_PASSWORD environment variables.");
|
|
2495
2514
|
return (await client.unsaveContent(args.thing_id)).fold((err) => toolError(`Failed to unsave content: ${err.message}`), () => `# Content Unsaved Successfully
|
|
2496
2515
|
|
|
2497
2516
|
${args.thing_id} has been removed from your saved items.`);
|
|
@@ -2584,8 +2603,8 @@ ${commentList}${archiveDisclaimer(client)}`;
|
|
|
2584
2603
|
});
|
|
2585
2604
|
async function main() {
|
|
2586
2605
|
await setupRedditClient();
|
|
2587
|
-
const port = parseInt(
|
|
2588
|
-
const host =
|
|
2606
|
+
const port = parseInt(readEnv("PORT").orElse("3000"));
|
|
2607
|
+
const host = readEnv("HOST").orElse("127.0.0.1");
|
|
2589
2608
|
if (useHttp) {
|
|
2590
2609
|
console.error(`[Setup] Starting HTTP server on ${host}:${port}`);
|
|
2591
2610
|
await server.start({
|