redditapis-mcp 0.5.2 → 0.5.3
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/package.json +2 -2
- package/src/index.js +30 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redditapis-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"mcpName": "io.github.redditapis/redditapis-mcp",
|
|
5
5
|
"description": "Official MCP server for redditapis.com. Search Reddit posts, comments, communities, users and media; read subreddits, comment trees, top posts and profiles; create and manage monitors and webhooks. Native tools for Claude, Cursor and any MCP client.",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"start": "node src/index.js",
|
|
28
28
|
"check": "node --check src/index.js && node --check src/tools.js && node --check src/feedback.js",
|
|
29
|
-
"test": "node test/tools.test.mjs && node test/feedback.test.mjs && node test/index-lasterror.test.mjs",
|
|
29
|
+
"test": "node test/tools.test.mjs && node test/feedback.test.mjs && node test/index-lasterror.test.mjs && node test/scannable-without-key.test.mjs",
|
|
30
30
|
"prepublishOnly": "node scripts/prepublish-tenant-check.mjs"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
package/src/index.js
CHANGED
|
@@ -39,11 +39,25 @@ const REQUEST_TIMEOUT_MS = Number(process.env.REDDITAPIS_TIMEOUT_MS || 30000);
|
|
|
39
39
|
// User-Agent and MCP server handshake understated its own version for months.
|
|
40
40
|
const { version: VERSION } = createRequire(import.meta.url)("../package.json");
|
|
41
41
|
|
|
42
|
+
// WARN AND CONTINUE, NEVER exit. A registry scanner spawns the server and calls
|
|
43
|
+
// tools/list to enumerate what it offers, and tools/list is the DISCOVERY step
|
|
44
|
+
// in the MCP spec: it comes before tool selection and before any invocation, so
|
|
45
|
+
// it needs no credential. Exiting here answers that scan with nothing.
|
|
46
|
+
//
|
|
47
|
+
// This is not a hypothesis. Measured 2026-09-06 by speaking raw MCP stdio to
|
|
48
|
+
// the published redditapis-mcp@0.5.2 with an empty env: initialize was never
|
|
49
|
+
// answered and tools/list returned nothing, because this line fired first. A
|
|
50
|
+
// scanner that behaves this way reports the server as uninspectable rather than
|
|
51
|
+
// as having no tools, so the listing carries no catalog at all.
|
|
52
|
+
//
|
|
53
|
+
// NOT a security relaxation. This is a stdio server: whoever spawns it already
|
|
54
|
+
// has local execution, so there is no unauthenticated party to expose anything
|
|
55
|
+
// to. A real tool CALL with no key still fails clearly, at the point of the
|
|
56
|
+
// call, exactly as it already does for a WRONG key (see the 401 branch below).
|
|
42
57
|
if (!API_KEY) {
|
|
43
58
|
console.error(
|
|
44
|
-
"[reddit-mcp] Missing REDDITAPIS_KEY. Get a key at https://www.redditapis.com and set it in your MCP client config.",
|
|
59
|
+
"[reddit-mcp] Missing REDDITAPIS_KEY. Get a key at https://www.redditapis.com and set it in your MCP client config. Tools are registered but every call will fail until it is set.",
|
|
45
60
|
);
|
|
46
|
-
process.exit(1);
|
|
47
61
|
}
|
|
48
62
|
|
|
49
63
|
// The last tool call that failed, so a feedback draft can carry the endpoint,
|
|
@@ -90,6 +104,20 @@ export function hintFor(status, path) {
|
|
|
90
104
|
}
|
|
91
105
|
|
|
92
106
|
async function callEndpoint(pathTemplate, args, method = "GET", tool = null) {
|
|
107
|
+
// The credential check MOVED HERE from startup, so listing tools needs no key
|
|
108
|
+
// and calling one still cannot silently proceed without it. Without this the
|
|
109
|
+
// relaxation above would send an Authorization header reading "Bearer
|
|
110
|
+
// undefined" and the caller would read a 401 about an INVALID key when the
|
|
111
|
+
// real answer is that no key was ever set.
|
|
112
|
+
if (!API_KEY) {
|
|
113
|
+
return {
|
|
114
|
+
isError: true,
|
|
115
|
+
content: [{
|
|
116
|
+
type: "text",
|
|
117
|
+
text: "Missing REDDITAPIS_KEY (no API key is set; get one at https://www.redditapis.com and set it in your MCP client config).",
|
|
118
|
+
}],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
93
121
|
const { path, rest: pathRest } = buildPath(pathTemplate, args);
|
|
94
122
|
// A tool that declares `sessionHeaders` has its Reddit session args lifted
|
|
95
123
|
// out of the query and onto headers. For every other tool this is the
|