mcp-ga4 2.0.4 → 2.0.5

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":"9b66c73","builtAt":"2026-04-09T21:19:01.910Z"}
1
+ {"sha":"29cbd4f","builtAt":"2026-04-09T21:28:40.127Z"}
package/dist/index.js CHANGED
@@ -11,6 +11,8 @@ import { GoogleAuth } from "google-auth-library";
11
11
  import { Ga4AuthError, Ga4RateLimitError, Ga4ServiceError, classifyError, } from "./errors.js";
12
12
  import { tools } from "./tools.js";
13
13
  import { withResilience, safeResponse, logger } from "./resilience.js";
14
+ // CLI package info
15
+ const __cliPkg = JSON.parse(readFileSync(join(dirname(new URL(import.meta.url).pathname), "..", "package.json"), "utf-8"));
14
16
  // Log build fingerprint at startup
15
17
  try {
16
18
  const __buildInfoDir = dirname(new URL(import.meta.url).pathname);
@@ -18,22 +20,21 @@ try {
18
20
  console.error(`[build] SHA: ${buildInfo.sha} (${buildInfo.builtAt})`);
19
21
  }
20
22
  catch {
21
- // dev mode
23
+ console.error(`[build] ${__cliPkg.name}@${__cliPkg.version} (dev mode)`);
22
24
  }
23
25
  // CLI flags
24
- const __cliPkg = JSON.parse(readFileSync(join(dirname(new URL(import.meta.url).pathname), "..", "package.json"), "utf-8"));
25
26
  if (process.argv.includes("--help") || process.argv.includes("-h")) {
26
- console.log(`${__cliPkg.name} v${__cliPkg.version}\n`);
27
- console.log(`Usage: ${__cliPkg.name} [options]\n`);
28
- console.log("MCP server communicating via stdio. Configure in your .mcp.json.\n");
29
- console.log("Options:");
30
- console.log(" --help, -h Show this help message");
31
- console.log(" --version, -v Show version number");
32
- console.log(`\nDocumentation: https://github.com/mharnett/mcp-ga4`);
27
+ console.error(`${__cliPkg.name} v${__cliPkg.version}\n`);
28
+ console.error(`Usage: ${__cliPkg.name} [options]\n`);
29
+ console.error("MCP server communicating via stdio. Configure in your .mcp.json.\n");
30
+ console.error("Options:");
31
+ console.error(" --help, -h Show this help message");
32
+ console.error(" --version, -v Show version number");
33
+ console.error(`\nDocumentation: https://github.com/mharnett/mcp-ga4`);
33
34
  process.exit(0);
34
35
  }
35
36
  if (process.argv.includes("--version") || process.argv.includes("-v")) {
36
- console.log(__cliPkg.version);
37
+ console.error(__cliPkg.version);
37
38
  process.exit(0);
38
39
  }
39
40
  function loadConfig() {
@@ -451,4 +452,7 @@ process.on("SIGINT", () => {
451
452
  console.error("[shutdown] SIGINT received, exiting");
452
453
  process.exit(0);
453
454
  });
455
+ process.on("SIGPIPE", () => {
456
+ // Client disconnected -- expected during shutdown
457
+ });
454
458
  main().catch(console.error);
@@ -9,10 +9,13 @@ export const logger = pino({
9
9
  colorize: true,
10
10
  singleLine: true,
11
11
  translateTime: "SYS:standard",
12
+ destination: 2, // stderr -- stdout is reserved for MCP JSON-RPC
12
13
  },
13
14
  },
14
15
  }),
15
- });
16
+ },
17
+ // When no transport (test mode), write to stderr directly
18
+ process.env.NODE_ENV === "test" ? pino.destination(2) : undefined);
16
19
  const MAX_RESPONSE_SIZE = 200_000;
17
20
  export function safeResponse(data, context) {
18
21
  let current = data;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcp-ga4",
3
3
  "mcpName": "io.github.mharnett/ga4",
4
- "version": "2.0.4",
4
+ "version": "2.0.5",
5
5
  "description": "MCP server for Google Analytics 4 - query GA4 data with natural language via Claude.",
6
6
  "main": "dist/index.js",
7
7
  "bin": {