mcp-reddit-ads 1.0.6 → 1.0.7

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.
@@ -1 +1 @@
1
- {"sha":"6453862","builtAt":"2026-04-09T21:28:34.019Z"}
1
+ {"sha":"2aa081f","builtAt":"2026-04-09T21:37:32.922Z"}
package/dist/index.js CHANGED
@@ -33,6 +33,10 @@ if (process.argv.includes("--version") || process.argv.includes("-v")) {
33
33
  console.error(__cliPkg.version);
34
34
  process.exit(0);
35
35
  }
36
+ // ============================================
37
+ // ENV VAR TRIMMING
38
+ // ============================================
39
+ const envTrimmed = (key) => (process.env[key] || "").trim().replace(/^["']|["']$/g, "");
36
40
  function loadConfig() {
37
41
  // Try config.json first
38
42
  const configPath = join(dirname(new URL(import.meta.url).pathname), "..", "config.json");
@@ -62,13 +66,13 @@ function loadConfig() {
62
66
  }
63
67
  // Environment overrides (always applied)
64
68
  if (process.env.REDDIT_CLIENT_ID)
65
- config.reddit_api.auth.client_id = process.env.REDDIT_CLIENT_ID;
69
+ config.reddit_api.auth.client_id = envTrimmed("REDDIT_CLIENT_ID");
66
70
  if (process.env.REDDIT_CLIENT_SECRET)
67
- config.reddit_api.auth.client_secret = process.env.REDDIT_CLIENT_SECRET;
71
+ config.reddit_api.auth.client_secret = envTrimmed("REDDIT_CLIENT_SECRET");
68
72
  if (process.env.REDDIT_REFRESH_TOKEN)
69
- config.reddit_api.auth.refresh_token = process.env.REDDIT_REFRESH_TOKEN;
73
+ config.reddit_api.auth.refresh_token = envTrimmed("REDDIT_REFRESH_TOKEN");
70
74
  if (process.env.REDDIT_ACCOUNT_ID)
71
- config.defaults.account_id = process.env.REDDIT_ACCOUNT_ID;
75
+ config.defaults.account_id = envTrimmed("REDDIT_ACCOUNT_ID");
72
76
  return config;
73
77
  }
74
78
  // ============================================
@@ -545,4 +549,7 @@ process.on("SIGINT", () => {
545
549
  process.on("SIGPIPE", () => {
546
550
  // Client disconnected -- expected during shutdown
547
551
  });
552
+ process.on("unhandledRejection", (reason) => {
553
+ console.error("[error] Unhandled promise rejection:", reason);
554
+ });
548
555
  main().catch(console.error);
@@ -5,7 +5,7 @@ import pino from "pino";
5
5
  // ============================================
6
6
  export const logger = pino({
7
7
  level: process.env.LOG_LEVEL || "info",
8
- ...(process.env.NODE_ENV !== "test" && {
8
+ ...(process.env.NODE_ENV !== "test" && process.stderr.isTTY && {
9
9
  transport: {
10
10
  target: "pino-pretty",
11
11
  options: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcp-reddit-ads",
3
3
  "mcpName": "io.github.mharnett/reddit-ads",
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "description": "MCP server for Reddit Ads API v3 with campaign, ad group, ad management, and performance reporting.",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -30,7 +30,7 @@
30
30
  "author": "drak-marketing",
31
31
  "license": "MIT",
32
32
  "engines": {
33
- "node": ">=18.0.0"
33
+ "node": ">=18.18.0"
34
34
  },
35
35
  "dependencies": {
36
36
  "@modelcontextprotocol/sdk": "^0.5.0",