reddit-mcp-server 1.0.10 → 1.1.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 CHANGED
@@ -5,30 +5,36 @@ All notable changes to this project will be documented in this file.
5
5
  ## [1.0.7] - 2025-06-27
6
6
 
7
7
  ### Fixed
8
+
8
9
  - Fixed server crash issue caused by stdout pollution in bin.js
9
10
  - Cleaned up published package to only include necessary files (reduced from 112KB to 24KB)
10
11
 
11
12
  ### Added
13
+
12
14
  - Search Reddit functionality (`search_reddit` tool)
13
- - Get post comments with threaded display (`get_post_comments` tool)
15
+ - Get post comments with threaded display (`get_post_comments` tool)
14
16
  - Get user posts (`get_user_posts` tool)
15
17
  - Get user comments (`get_user_comments` tool)
16
18
  - Comprehensive test suite for all new functionality
17
19
 
18
20
  ### Changed
21
+
19
22
  - Migrated from axios to native fetch API
20
23
  - Improved error handling and removed console output that violated MCP protocol
21
24
 
22
25
  ## [1.0.6] - 2025-06-27
23
26
 
24
27
  ### Added
28
+
25
29
  - New Reddit API endpoints (had packaging issues, use 1.0.7 instead)
26
30
 
27
31
  ## [1.0.5] - 2025-06-27
28
32
 
29
33
  ### Changed
34
+
30
35
  - Migrated from axios to fetch for HTTP requests
31
36
  - Fixed linting errors and improved code formatting
32
37
 
33
38
  ## [1.0.4] and earlier
34
- - Previous versions with axios-based implementation
39
+
40
+ - Previous versions with axios-based implementation
package/README.md CHANGED
@@ -4,8 +4,6 @@ A Model Context Protocol (MCP) that provides tools for fetching and creating Red
4
4
 
5
5
  > **Note**: This is a fork of the original [reddit-mcp-server](https://github.com/alexandros-lekkas/reddit-mcp-server) by Alexandros Lekkas, updated with pnpm, tsup build system, and npx execution support.
6
6
 
7
- https://github.com/user-attachments/assets/caa37704-7c92-4bf8-b7e8-56d02ccb4983
8
-
9
7
  ## 🔧 Available Tools (Features)
10
8
 
11
9
  **Read-only Tools (Client Credentials):**
@@ -29,13 +27,14 @@ https://github.com/user-attachments/assets/caa37704-7c92-4bf8-b7e8-56d02ccb4983
29
27
 
30
28
  ### Installing via Smithery
31
29
 
32
- To install Reddit Content Integration Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@alexandros-lekkas/reddit-mcp-server):
30
+ To install Reddit Content Integration Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@jordanburke/reddit-mcp-server):
33
31
 
34
32
  ```bash
35
33
  npx -y @smithery/cli install reddit-mcp-server --client claude
36
34
  ```
37
35
 
38
36
  ### Manual Installation
37
+
39
38
  1. `git clone https://github.com/jordanburke/reddit-mcp-server`
40
39
 
41
40
  2. Create a Reddit app [here](https://www.reddit.com/prefs/apps)
@@ -50,7 +49,7 @@ Make sure to select "script"!
50
49
 
51
50
  Do this with your `REDDIT_CLIENT_ID` and `REDDIT_CLIENT_SECRET`
52
51
 
53
- If you want to write posts you need to include your `REDDIT_USERNAME` and `REDDIT_PASSWORD` (don't worry, I won't steal them 😜)
52
+ If you want to write posts you need to include your `REDDIT_USERNAME` and `REDDIT_PASSWORD`
54
53
 
55
54
  5. Install dependencies with `pnpm install`
56
55
 
@@ -92,8 +91,6 @@ If you want to write posts you need to include your `REDDIT_USERNAME` and `REDDI
92
91
  }
93
92
  ```
94
93
 
95
- (Make sure to replace the environmental variables with your actual keys, not the 😜 emoji)
96
-
97
94
  ## 🛠️ Development
98
95
 
99
96
  ### Commands
@@ -129,6 +126,349 @@ npx reddit-mcp-server --version
129
126
 
130
127
  # Show help
131
128
  npx reddit-mcp-server --help
129
+
130
+ # Generate OAuth token for HTTP server
131
+ npx reddit-mcp-server --generate-token
132
+ ```
133
+
134
+ ### Streamable MCP Endpoint (Hono Server)
135
+
136
+ In addition to the standard npx execution, this server also supports a Streamable MCP endpoint via Hono for direct HTTP integration:
137
+
138
+ ```bash
139
+ # Start the Hono server on port 3000 (default)
140
+ pnpm serve
141
+
142
+ # Start with custom port
143
+ PORT=8080 pnpm serve
144
+
145
+ # Development mode with auto-reload
146
+ pnpm serve:dev
147
+ ```
148
+
149
+ The server will be available at `http://localhost:3000` with the MCP endpoint at `http://localhost:3000/mcp`.
150
+
151
+ #### OAuth Security (Optional)
152
+
153
+ The HTTP server supports optional OAuth protection to secure your endpoints:
154
+
155
+ **Generate a secure token:**
156
+
157
+ ```bash
158
+ npx reddit-mcp-server --generate-token
159
+ # Output: Generated OAuth token: A8f2Kp9x3NmQ7vR4tL6eZ1sW5yB8hC2j
160
+ ```
161
+
162
+ **Enable OAuth with generated token:**
163
+
164
+ ```bash
165
+ export OAUTH_ENABLED=true
166
+ export OAUTH_TOKEN="A8f2Kp9x3NmQ7vR4tL6eZ1sW5yB8hC2j"
167
+ pnpm serve
168
+ ```
169
+
170
+ **Make authenticated requests:**
171
+
172
+ ```bash
173
+ curl -H "Authorization: Bearer A8f2Kp9x3NmQ7vR4tL6eZ1sW5yB8hC2j" \
174
+ -H "Content-Type: application/json" \
175
+ -d '{"method":"tools/list","params":{}}' \
176
+ http://localhost:3000/mcp
177
+ ```
178
+
179
+ **OAuth Configuration:**
180
+
181
+ - `OAUTH_ENABLED=true` - Enables OAuth protection (disabled by default)
182
+ - `OAUTH_TOKEN=your-token` - Your custom token (or use `--generate-token`)
183
+ - Without OAuth, the server is accessible without authentication
184
+ - Health check (`/`) is always unprotected; only `/mcp` requires authentication
185
+
186
+ #### MCP Client Configuration
187
+
188
+ For MCP clients connecting to an OAuth-protected server, configure according to the [MCP Authorization specification](https://modelcontextprotocol.io/specification/draft/basic/authorization):
189
+
190
+ **HTTP-based MCP Clients (e.g., web applications):**
191
+
192
+ ```javascript
193
+ // Example using fetch API
194
+ const response = await fetch("http://localhost:3000/mcp", {
195
+ method: "POST",
196
+ headers: {
197
+ Authorization: "Bearer YOUR_TOKEN",
198
+ "Content-Type": "application/json",
199
+ },
200
+ body: JSON.stringify({
201
+ jsonrpc: "2.0",
202
+ id: 1,
203
+ method: "tools/list",
204
+ params: {},
205
+ }),
206
+ })
207
+
208
+ const result = await response.json()
209
+ ```
210
+
211
+ **Direct HTTP MCP Client:**
212
+
213
+ ```javascript
214
+ const client = new MCP.Client({
215
+ transport: new MCP.HTTPTransport({
216
+ url: "http://localhost:3000/mcp",
217
+ headers: {
218
+ Authorization: "Bearer YOUR_TOKEN",
219
+ },
220
+ }),
221
+ })
222
+ ```
223
+
224
+ **Custom MCP Client Implementation:**
225
+
226
+ ```typescript
227
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js"
228
+ import { HTTPTransport } from "@modelcontextprotocol/sdk/client/http.js"
229
+
230
+ const transport = new HTTPTransport({
231
+ url: "http://localhost:3000/mcp",
232
+ headers: {
233
+ Authorization: "Bearer YOUR_TOKEN",
234
+ "Content-Type": "application/json",
235
+ },
236
+ })
237
+
238
+ const client = new Client(
239
+ {
240
+ name: "reddit-client",
241
+ version: "1.0.0",
242
+ },
243
+ {
244
+ capabilities: {},
245
+ },
246
+ )
247
+
248
+ await client.connect(transport)
249
+ ```
250
+
251
+ **Important Notes:**
252
+
253
+ - Replace `YOUR_TOKEN` with your generated OAuth token
254
+ - Authorization header MUST be included in every request to `/mcp`
255
+ - Tokens MUST NOT be included in URI query strings per MCP specification
256
+ - Use HTTPS in production for secure token transmission
257
+
258
+ **For Remote/Deployed Servers:**
259
+ When connecting to a remote Reddit MCP server (e.g., deployed on your infrastructure):
260
+
261
+ ```javascript
262
+ // Production server with OAuth
263
+ const response = await fetch("https://your-server.com/mcp", {
264
+ method: "POST",
265
+ headers: {
266
+ Authorization: "Bearer YOUR_TOKEN",
267
+ "Content-Type": "application/json",
268
+ },
269
+ body: JSON.stringify({
270
+ jsonrpc: "2.0",
271
+ id: 1,
272
+ method: "tools/list",
273
+ params: {},
274
+ }),
275
+ })
276
+ ```
277
+
278
+ **MCP Client Configuration for Remote Server:**
279
+
280
+ ```typescript
281
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js"
282
+ import { HTTPTransport } from "@modelcontextprotocol/sdk/client/http.js"
283
+
284
+ // For your deployed server
285
+ const transport = new HTTPTransport({
286
+ url: "https://your-reddit-mcp.company.com/mcp",
287
+ headers: {
288
+ Authorization: "Bearer YOUR_GENERATED_TOKEN",
289
+ "Content-Type": "application/json",
290
+ },
291
+ })
292
+
293
+ const client = new Client(
294
+ {
295
+ name: "reddit-client",
296
+ version: "1.0.0",
297
+ },
298
+ {
299
+ capabilities: {},
300
+ },
301
+ )
302
+
303
+ await client.connect(transport)
304
+ ```
305
+
306
+ **Claude Desktop/Cursor with Remote Server (HTTP):**
307
+ For remote servers, you can use a proxy approach:
308
+
309
+ ```json
310
+ {
311
+ "mcpServers": {
312
+ "reddit-remote": {
313
+ "command": "node",
314
+ "args": [
315
+ "-e",
316
+ "const http = require('https'); const req = http.request('https://your-server.com/mcp', {method:'POST',headers:{'Authorization':'Bearer YOUR_TOKEN','Content-Type':'application/json'}}, res => res.pipe(process.stdout)); process.stdin.pipe(req);"
317
+ ],
318
+ "env": {}
319
+ }
320
+ }
321
+ }
322
+ ```
323
+
324
+ **For Claude Desktop/Cursor (stdio transport):**
325
+ OAuth is not applicable when using the traditional npx execution method. Use the stdio configuration instead:
326
+
327
+ ```json
328
+ {
329
+ "mcpServers": {
330
+ "reddit": {
331
+ "command": "npx",
332
+ "args": ["reddit-mcp-server"],
333
+ "env": {
334
+ "REDDIT_CLIENT_ID": "your_client_id",
335
+ "REDDIT_CLIENT_SECRET": "your_client_secret"
336
+ }
337
+ }
338
+ }
339
+ }
340
+ ```
341
+
342
+ #### Remote Deployment Examples
343
+
344
+ **Deploy to your infrastructure and share the URL:**
345
+
346
+ 1. **Generate secure token:**
347
+
348
+ ```bash
349
+ npx reddit-mcp-server --generate-token
350
+ # Output: Generated OAuth token: xyz123abc456def789
351
+ ```
352
+
353
+ 2. **Deploy with Docker on your server:**
354
+
355
+ ```bash
356
+ docker run -d \
357
+ --name reddit-mcp \
358
+ -p 3000:3000 \
359
+ -e REDDIT_CLIENT_ID=your_reddit_client_id \
360
+ -e REDDIT_CLIENT_SECRET=your_reddit_client_secret \
361
+ -e OAUTH_ENABLED=true \
362
+ -e OAUTH_TOKEN=xyz123abc456def789 \
363
+ ghcr.io/jordanburke/reddit-mcp-server:latest
364
+ ```
365
+
366
+ 3. **Share with your team:**
367
+
368
+ ```
369
+ Server URL: https://your-server.com/mcp
370
+ OAuth Token: xyz123abc456def789
371
+ ```
372
+
373
+ 4. **Team members connect:**
374
+ ```typescript
375
+ const client = new Client(...);
376
+ const transport = new HTTPTransport({
377
+ url: 'https://your-server.com/mcp',
378
+ headers: { 'Authorization': 'Bearer xyz123abc456def789' }
379
+ });
380
+ await client.connect(transport);
381
+ ```
382
+
383
+ This allows integration with systems that support HTTP-based MCP communication, similar to the cq-api and agent-todo implementations.
384
+
385
+ ## 🐳 Docker Usage
386
+
387
+ ### Pull from GitHub Container Registry
388
+
389
+ ```bash
390
+ # Pull the latest image
391
+ docker pull ghcr.io/jordanburke/reddit-mcp-server:latest
392
+
393
+ # Pull a specific version
394
+ docker pull ghcr.io/jordanburke/reddit-mcp-server:v1.0.10
395
+ ```
396
+
397
+ ### Run with Docker
398
+
399
+ ```bash
400
+ # Run the HTTP server (recommended)
401
+ docker run -d \
402
+ --name reddit-mcp \
403
+ -p 3000:3000 \
404
+ -e REDDIT_CLIENT_ID=your_client_id \
405
+ -e REDDIT_CLIENT_SECRET=your_client_secret \
406
+ -e REDDIT_USERNAME=your_username \
407
+ -e REDDIT_PASSWORD=your_password \
408
+ ghcr.io/jordanburke/reddit-mcp-server:latest
409
+
410
+ # Run with OAuth enabled (secure)
411
+ docker run -d \
412
+ --name reddit-mcp \
413
+ -p 3000:3000 \
414
+ -e REDDIT_CLIENT_ID=your_client_id \
415
+ -e REDDIT_CLIENT_SECRET=your_client_secret \
416
+ -e OAUTH_ENABLED=true \
417
+ -e OAUTH_TOKEN=your_generated_token \
418
+ ghcr.io/jordanburke/reddit-mcp-server:latest
419
+
420
+ # Run with custom port
421
+ docker run -d \
422
+ --name reddit-mcp \
423
+ -p 8080:3000 \
424
+ --env-file .env \
425
+ ghcr.io/jordanburke/reddit-mcp-server:latest
426
+
427
+ # Generate token using Docker
428
+ docker run --rm \
429
+ ghcr.io/jordanburke/reddit-mcp-server:latest \
430
+ node dist/bin.js --generate-token
431
+
432
+ # Run as stdio MCP server (for direct integration)
433
+ docker run -it \
434
+ --env-file .env \
435
+ ghcr.io/jordanburke/reddit-mcp-server:latest \
436
+ node dist/index.js
437
+ ```
438
+
439
+ ### Build Locally
440
+
441
+ ```bash
442
+ # Build the image
443
+ docker build -t reddit-mcp-server .
444
+
445
+ # Run the locally built image
446
+ docker run -d \
447
+ --name reddit-mcp \
448
+ -p 3000:3000 \
449
+ --env-file .env \
450
+ reddit-mcp-server
451
+ ```
452
+
453
+ ### Docker Compose Example
454
+
455
+ ```yaml
456
+ version: "3.8"
457
+
458
+ services:
459
+ reddit-mcp:
460
+ image: ghcr.io/jordanburke/reddit-mcp-server:latest
461
+ ports:
462
+ - "3000:3000"
463
+ environment:
464
+ - REDDIT_CLIENT_ID=${REDDIT_CLIENT_ID}
465
+ - REDDIT_CLIENT_SECRET=${REDDIT_CLIENT_SECRET}
466
+ - REDDIT_USERNAME=${REDDIT_USERNAME}
467
+ - REDDIT_PASSWORD=${REDDIT_PASSWORD}
468
+ # Optional OAuth settings
469
+ - OAUTH_ENABLED=${OAUTH_ENABLED:-false}
470
+ - OAUTH_TOKEN=${OAUTH_TOKEN}
471
+ restart: unless-stopped
132
472
  ```
133
473
 
134
474
  ## 📚 Credits