mcp-bing-ads 1.0.7 → 1.0.8

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":"26e5811","builtAt":"2026-04-09T21:28:13.723Z"}
1
+ {"sha":"60add35","builtAt":"2026-04-09T21:37:10.078Z"}
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
  const configPath = join(dirname(new URL(import.meta.url).pathname), "..", "config.json");
38
42
  if (!existsSync(configPath)) {
@@ -69,14 +73,14 @@ class BingAdsManager {
69
73
  throw new BingAdsAuthError(msg);
70
74
  }
71
75
  console.error("[startup] Credentials validated: all required env vars present");
72
- this.developerToken = process.env.BING_ADS_DEVELOPER_TOKEN;
73
- this.refreshToken = process.env.BING_ADS_REFRESH_TOKEN;
76
+ this.developerToken = envTrimmed("BING_ADS_DEVELOPER_TOKEN");
77
+ this.refreshToken = envTrimmed("BING_ADS_REFRESH_TOKEN");
74
78
  // Allow env vars to override config for OAuth
75
79
  if (process.env.BING_ADS_CLIENT_ID) {
76
- this.config.oauth.client_id = process.env.BING_ADS_CLIENT_ID;
80
+ this.config.oauth.client_id = envTrimmed("BING_ADS_CLIENT_ID");
77
81
  }
78
82
  if (process.env.BING_ADS_CLIENT_SECRET) {
79
- this.config.oauth.client_secret = process.env.BING_ADS_CLIENT_SECRET;
83
+ this.config.oauth.client_secret = envTrimmed("BING_ADS_CLIENT_SECRET");
80
84
  }
81
85
  }
82
86
  async getAccessToken() {
@@ -788,4 +792,7 @@ process.on("SIGINT", () => {
788
792
  process.on("SIGPIPE", () => {
789
793
  // Client disconnected -- expected during shutdown
790
794
  });
795
+ process.on("unhandledRejection", (reason) => {
796
+ console.error("[error] Unhandled promise rejection:", reason);
797
+ });
791
798
  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-bing-ads",
3
3
  "mcpName": "io.github.mharnett/bing-ads",
4
- "version": "1.0.7",
4
+ "version": "1.0.8",
5
5
  "description": "MCP server for Microsoft Advertising (Bing Ads) API with campaign, ad group, keyword, and performance reporting. First comprehensive open-source Bing Ads MCP.",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "homepage": "https://github.com/mharnett/mcp-bing-ads#readme",
50
50
  "engines": {
51
- "node": ">=18.0.0"
51
+ "node": ">=18.18.0"
52
52
  },
53
53
  "dependencies": {
54
54
  "@modelcontextprotocol/sdk": "^0.5.0",