mcp-bing-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.
- package/dist/build-info.json +1 -1
- package/dist/index.js +27 -18
- package/dist/resilience.js +4 -1
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"sha":"
|
|
1
|
+
{"sha":"26e5811","builtAt":"2026-04-09T21:28:13.723Z"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,8 @@ import { join, dirname } from "path";
|
|
|
7
7
|
import { BingAdsAuthError, BingAdsRateLimitError, BingAdsServiceError, classifyError, validateCredentials, } from "./errors.js";
|
|
8
8
|
import { tools } from "./tools.js";
|
|
9
9
|
import { withResilience, safeResponse, logger } from "./resilience.js";
|
|
10
|
+
// CLI package info
|
|
11
|
+
const __cliPkg = JSON.parse(readFileSync(join(dirname(new URL(import.meta.url).pathname), "..", "package.json"), "utf-8"));
|
|
10
12
|
// Log build fingerprint at startup
|
|
11
13
|
try {
|
|
12
14
|
const __buildInfoDir = dirname(new URL(import.meta.url).pathname);
|
|
@@ -14,22 +16,21 @@ try {
|
|
|
14
16
|
console.error(`[build] SHA: ${buildInfo.sha} (${buildInfo.builtAt})`);
|
|
15
17
|
}
|
|
16
18
|
catch {
|
|
17
|
-
|
|
19
|
+
console.error(`[build] ${__cliPkg.name}@${__cliPkg.version} (dev mode)`);
|
|
18
20
|
}
|
|
19
21
|
// CLI flags
|
|
20
|
-
const __cliPkg = JSON.parse(readFileSync(join(dirname(new URL(import.meta.url).pathname), "..", "package.json"), "utf-8"));
|
|
21
22
|
if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
22
|
-
console.
|
|
23
|
-
console.
|
|
24
|
-
console.
|
|
25
|
-
console.
|
|
26
|
-
console.
|
|
27
|
-
console.
|
|
28
|
-
console.
|
|
23
|
+
console.error(`${__cliPkg.name} v${__cliPkg.version}\n`);
|
|
24
|
+
console.error(`Usage: ${__cliPkg.name} [options]\n`);
|
|
25
|
+
console.error("MCP server communicating via stdio. Configure in your .mcp.json.\n");
|
|
26
|
+
console.error("Options:");
|
|
27
|
+
console.error(" --help, -h Show this help message");
|
|
28
|
+
console.error(" --version, -v Show version number");
|
|
29
|
+
console.error(`\nDocumentation: https://github.com/mharnett/mcp-bing-ads`);
|
|
29
30
|
process.exit(0);
|
|
30
31
|
}
|
|
31
32
|
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
32
|
-
console.
|
|
33
|
+
console.error(__cliPkg.version);
|
|
33
34
|
process.exit(0);
|
|
34
35
|
}
|
|
35
36
|
function loadConfig() {
|
|
@@ -108,17 +109,22 @@ class BingAdsManager {
|
|
|
108
109
|
// Persist rotated refresh token to Keychain so restarts use the latest
|
|
109
110
|
if (data.refresh_token && data.refresh_token !== this.refreshToken) {
|
|
110
111
|
this.refreshToken = data.refresh_token;
|
|
111
|
-
|
|
112
|
-
const { execFileSync } = await import("child_process");
|
|
112
|
+
if (process.platform === "darwin") {
|
|
113
113
|
try {
|
|
114
|
-
|
|
114
|
+
const { execFileSync } = await import("child_process");
|
|
115
|
+
try {
|
|
116
|
+
execFileSync("security", ["delete-generic-password", "-a", "bing-ads-mcp", "-s", "BING_ADS_REFRESH_TOKEN"], { stdio: "ignore" });
|
|
117
|
+
}
|
|
118
|
+
catch { /* may not exist yet */ }
|
|
119
|
+
execFileSync("security", ["add-generic-password", "-a", "bing-ads-mcp", "-s", "BING_ADS_REFRESH_TOKEN", "-w", data.refresh_token]);
|
|
120
|
+
console.error("[token] Rotated refresh token persisted to Keychain");
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
console.error("[token] WARNING: Failed to persist rotated refresh token to Keychain:", err);
|
|
115
124
|
}
|
|
116
|
-
catch { /* may not exist yet */ }
|
|
117
|
-
execFileSync("security", ["add-generic-password", "-a", "bing-ads-mcp", "-s", "BING_ADS_REFRESH_TOKEN", "-w", data.refresh_token]);
|
|
118
|
-
console.error("[token] Rotated refresh token persisted to Keychain");
|
|
119
125
|
}
|
|
120
|
-
|
|
121
|
-
console.error("[token]
|
|
126
|
+
else {
|
|
127
|
+
console.error("[token] Rotated refresh token received but Keychain not available (non-macOS). Token will be used for this session only.");
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
130
|
return this.accessToken;
|
|
@@ -779,4 +785,7 @@ process.on("SIGINT", () => {
|
|
|
779
785
|
console.error("[shutdown] SIGINT received, exiting");
|
|
780
786
|
process.exit(0);
|
|
781
787
|
});
|
|
788
|
+
process.on("SIGPIPE", () => {
|
|
789
|
+
// Client disconnected -- expected during shutdown
|
|
790
|
+
});
|
|
782
791
|
main().catch(console.error);
|
package/dist/resilience.js
CHANGED
|
@@ -12,10 +12,13 @@ export const logger = pino({
|
|
|
12
12
|
colorize: true,
|
|
13
13
|
singleLine: true,
|
|
14
14
|
translateTime: "SYS:standard",
|
|
15
|
+
destination: 2, // stderr -- stdout is reserved for MCP JSON-RPC
|
|
15
16
|
},
|
|
16
17
|
},
|
|
17
18
|
}),
|
|
18
|
-
}
|
|
19
|
+
},
|
|
20
|
+
// When no transport (test mode), write to stderr directly
|
|
21
|
+
process.env.NODE_ENV === "test" ? pino.destination(2) : undefined);
|
|
19
22
|
// ============================================
|
|
20
23
|
// SAFE RESPONSE (Response Size Limiting)
|
|
21
24
|
// ============================================
|
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.
|
|
4
|
+
"version": "1.0.7",
|
|
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": {
|