reddit-mcp-server 1.1.0 → 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 +8 -2
- package/README.md +72 -51
- package/dist/bin.js +382 -1010
- package/dist/index.d.ts +1 -8
- package/dist/index.js +357 -852
- package/package.json +31 -26
- package/dist/server.d.ts +0 -5
- package/dist/server.js +0 -1754
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
|
-
|
|
39
|
+
|
|
40
|
+
- Previous versions with axios-based implementation
|
package/README.md
CHANGED
|
@@ -27,13 +27,14 @@ A Model Context Protocol (MCP) that provides tools for fetching and creating Red
|
|
|
27
27
|
|
|
28
28
|
### Installing via Smithery
|
|
29
29
|
|
|
30
|
-
To install Reddit Content Integration Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@
|
|
30
|
+
To install Reddit Content Integration Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@jordanburke/reddit-mcp-server):
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
npx -y @smithery/cli install reddit-mcp-server --client claude
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
### Manual Installation
|
|
37
|
+
|
|
37
38
|
1. `git clone https://github.com/jordanburke/reddit-mcp-server`
|
|
38
39
|
|
|
39
40
|
2. Create a Reddit app [here](https://www.reddit.com/prefs/apps)
|
|
@@ -152,12 +153,14 @@ The server will be available at `http://localhost:3000` with the MCP endpoint at
|
|
|
152
153
|
The HTTP server supports optional OAuth protection to secure your endpoints:
|
|
153
154
|
|
|
154
155
|
**Generate a secure token:**
|
|
156
|
+
|
|
155
157
|
```bash
|
|
156
158
|
npx reddit-mcp-server --generate-token
|
|
157
159
|
# Output: Generated OAuth token: A8f2Kp9x3NmQ7vR4tL6eZ1sW5yB8hC2j
|
|
158
160
|
```
|
|
159
161
|
|
|
160
162
|
**Enable OAuth with generated token:**
|
|
163
|
+
|
|
161
164
|
```bash
|
|
162
165
|
export OAUTH_ENABLED=true
|
|
163
166
|
export OAUTH_TOKEN="A8f2Kp9x3NmQ7vR4tL6eZ1sW5yB8hC2j"
|
|
@@ -165,6 +168,7 @@ pnpm serve
|
|
|
165
168
|
```
|
|
166
169
|
|
|
167
170
|
**Make authenticated requests:**
|
|
171
|
+
|
|
168
172
|
```bash
|
|
169
173
|
curl -H "Authorization: Bearer A8f2Kp9x3NmQ7vR4tL6eZ1sW5yB8hC2j" \
|
|
170
174
|
-H "Content-Type: application/json" \
|
|
@@ -173,6 +177,7 @@ curl -H "Authorization: Bearer A8f2Kp9x3NmQ7vR4tL6eZ1sW5yB8hC2j" \
|
|
|
173
177
|
```
|
|
174
178
|
|
|
175
179
|
**OAuth Configuration:**
|
|
180
|
+
|
|
176
181
|
- `OAUTH_ENABLED=true` - Enables OAuth protection (disabled by default)
|
|
177
182
|
- `OAUTH_TOKEN=your-token` - Your custom token (or use `--generate-token`)
|
|
178
183
|
- Without OAuth, the server is accessible without authentication
|
|
@@ -183,61 +188,68 @@ curl -H "Authorization: Bearer A8f2Kp9x3NmQ7vR4tL6eZ1sW5yB8hC2j" \
|
|
|
183
188
|
For MCP clients connecting to an OAuth-protected server, configure according to the [MCP Authorization specification](https://modelcontextprotocol.io/specification/draft/basic/authorization):
|
|
184
189
|
|
|
185
190
|
**HTTP-based MCP Clients (e.g., web applications):**
|
|
191
|
+
|
|
186
192
|
```javascript
|
|
187
193
|
// Example using fetch API
|
|
188
|
-
const response = await fetch(
|
|
189
|
-
method:
|
|
194
|
+
const response = await fetch("http://localhost:3000/mcp", {
|
|
195
|
+
method: "POST",
|
|
190
196
|
headers: {
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
Authorization: "Bearer YOUR_TOKEN",
|
|
198
|
+
"Content-Type": "application/json",
|
|
193
199
|
},
|
|
194
200
|
body: JSON.stringify({
|
|
195
201
|
jsonrpc: "2.0",
|
|
196
202
|
id: 1,
|
|
197
203
|
method: "tools/list",
|
|
198
|
-
params: {}
|
|
199
|
-
})
|
|
200
|
-
})
|
|
204
|
+
params: {},
|
|
205
|
+
}),
|
|
206
|
+
})
|
|
201
207
|
|
|
202
|
-
const result = await response.json()
|
|
208
|
+
const result = await response.json()
|
|
203
209
|
```
|
|
204
210
|
|
|
205
211
|
**Direct HTTP MCP Client:**
|
|
212
|
+
|
|
206
213
|
```javascript
|
|
207
214
|
const client = new MCP.Client({
|
|
208
215
|
transport: new MCP.HTTPTransport({
|
|
209
|
-
url:
|
|
216
|
+
url: "http://localhost:3000/mcp",
|
|
210
217
|
headers: {
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
})
|
|
214
|
-
})
|
|
218
|
+
Authorization: "Bearer YOUR_TOKEN",
|
|
219
|
+
},
|
|
220
|
+
}),
|
|
221
|
+
})
|
|
215
222
|
```
|
|
216
223
|
|
|
217
224
|
**Custom MCP Client Implementation:**
|
|
225
|
+
|
|
218
226
|
```typescript
|
|
219
|
-
import { Client } from
|
|
220
|
-
import { HTTPTransport } from
|
|
227
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
|
|
228
|
+
import { HTTPTransport } from "@modelcontextprotocol/sdk/client/http.js"
|
|
221
229
|
|
|
222
230
|
const transport = new HTTPTransport({
|
|
223
|
-
url:
|
|
231
|
+
url: "http://localhost:3000/mcp",
|
|
224
232
|
headers: {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
})
|
|
233
|
+
Authorization: "Bearer YOUR_TOKEN",
|
|
234
|
+
"Content-Type": "application/json",
|
|
235
|
+
},
|
|
236
|
+
})
|
|
229
237
|
|
|
230
|
-
const client = new Client(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
const client = new Client(
|
|
239
|
+
{
|
|
240
|
+
name: "reddit-client",
|
|
241
|
+
version: "1.0.0",
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
capabilities: {},
|
|
245
|
+
},
|
|
246
|
+
)
|
|
236
247
|
|
|
237
|
-
await client.connect(transport)
|
|
248
|
+
await client.connect(transport)
|
|
238
249
|
```
|
|
239
250
|
|
|
240
251
|
**Important Notes:**
|
|
252
|
+
|
|
241
253
|
- Replace `YOUR_TOKEN` with your generated OAuth token
|
|
242
254
|
- Authorization header MUST be included in every request to `/mcp`
|
|
243
255
|
- Tokens MUST NOT be included in URI query strings per MCP specification
|
|
@@ -248,54 +260,59 @@ When connecting to a remote Reddit MCP server (e.g., deployed on your infrastruc
|
|
|
248
260
|
|
|
249
261
|
```javascript
|
|
250
262
|
// Production server with OAuth
|
|
251
|
-
const response = await fetch(
|
|
252
|
-
method:
|
|
263
|
+
const response = await fetch("https://your-server.com/mcp", {
|
|
264
|
+
method: "POST",
|
|
253
265
|
headers: {
|
|
254
|
-
|
|
255
|
-
|
|
266
|
+
Authorization: "Bearer YOUR_TOKEN",
|
|
267
|
+
"Content-Type": "application/json",
|
|
256
268
|
},
|
|
257
269
|
body: JSON.stringify({
|
|
258
270
|
jsonrpc: "2.0",
|
|
259
271
|
id: 1,
|
|
260
272
|
method: "tools/list",
|
|
261
|
-
params: {}
|
|
262
|
-
})
|
|
263
|
-
})
|
|
273
|
+
params: {},
|
|
274
|
+
}),
|
|
275
|
+
})
|
|
264
276
|
```
|
|
265
277
|
|
|
266
278
|
**MCP Client Configuration for Remote Server:**
|
|
279
|
+
|
|
267
280
|
```typescript
|
|
268
|
-
import { Client } from
|
|
269
|
-
import { HTTPTransport } from
|
|
281
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
|
|
282
|
+
import { HTTPTransport } from "@modelcontextprotocol/sdk/client/http.js"
|
|
270
283
|
|
|
271
284
|
// For your deployed server
|
|
272
285
|
const transport = new HTTPTransport({
|
|
273
|
-
url:
|
|
286
|
+
url: "https://your-reddit-mcp.company.com/mcp",
|
|
274
287
|
headers: {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
})
|
|
288
|
+
Authorization: "Bearer YOUR_GENERATED_TOKEN",
|
|
289
|
+
"Content-Type": "application/json",
|
|
290
|
+
},
|
|
291
|
+
})
|
|
279
292
|
|
|
280
|
-
const client = new Client(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
293
|
+
const client = new Client(
|
|
294
|
+
{
|
|
295
|
+
name: "reddit-client",
|
|
296
|
+
version: "1.0.0",
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
capabilities: {},
|
|
300
|
+
},
|
|
301
|
+
)
|
|
286
302
|
|
|
287
|
-
await client.connect(transport)
|
|
303
|
+
await client.connect(transport)
|
|
288
304
|
```
|
|
289
305
|
|
|
290
306
|
**Claude Desktop/Cursor with Remote Server (HTTP):**
|
|
291
307
|
For remote servers, you can use a proxy approach:
|
|
308
|
+
|
|
292
309
|
```json
|
|
293
310
|
{
|
|
294
311
|
"mcpServers": {
|
|
295
312
|
"reddit-remote": {
|
|
296
313
|
"command": "node",
|
|
297
314
|
"args": [
|
|
298
|
-
"-e",
|
|
315
|
+
"-e",
|
|
299
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);"
|
|
300
317
|
],
|
|
301
318
|
"env": {}
|
|
@@ -306,6 +323,7 @@ For remote servers, you can use a proxy approach:
|
|
|
306
323
|
|
|
307
324
|
**For Claude Desktop/Cursor (stdio transport):**
|
|
308
325
|
OAuth is not applicable when using the traditional npx execution method. Use the stdio configuration instead:
|
|
326
|
+
|
|
309
327
|
```json
|
|
310
328
|
{
|
|
311
329
|
"mcpServers": {
|
|
@@ -326,12 +344,14 @@ OAuth is not applicable when using the traditional npx execution method. Use the
|
|
|
326
344
|
**Deploy to your infrastructure and share the URL:**
|
|
327
345
|
|
|
328
346
|
1. **Generate secure token:**
|
|
347
|
+
|
|
329
348
|
```bash
|
|
330
349
|
npx reddit-mcp-server --generate-token
|
|
331
350
|
# Output: Generated OAuth token: xyz123abc456def789
|
|
332
351
|
```
|
|
333
352
|
|
|
334
353
|
2. **Deploy with Docker on your server:**
|
|
354
|
+
|
|
335
355
|
```bash
|
|
336
356
|
docker run -d \
|
|
337
357
|
--name reddit-mcp \
|
|
@@ -344,6 +364,7 @@ OAuth is not applicable when using the traditional npx execution method. Use the
|
|
|
344
364
|
```
|
|
345
365
|
|
|
346
366
|
3. **Share with your team:**
|
|
367
|
+
|
|
347
368
|
```
|
|
348
369
|
Server URL: https://your-server.com/mcp
|
|
349
370
|
OAuth Token: xyz123abc456def789
|
|
@@ -432,7 +453,7 @@ docker run -d \
|
|
|
432
453
|
### Docker Compose Example
|
|
433
454
|
|
|
434
455
|
```yaml
|
|
435
|
-
version:
|
|
456
|
+
version: "3.8"
|
|
436
457
|
|
|
437
458
|
services:
|
|
438
459
|
reddit-mcp:
|