mcp-ga4 2.0.8 → 2.0.9
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 +9 -2
- package/dist/tools.js +1 -1
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"sha":"
|
|
1
|
+
{"sha":"2bb300b","builtAt":"2026-04-09T22:09:46.643Z"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import { readFileSync, existsSync, appendFileSync, mkdirSync } from "fs";
|
|
6
|
-
import { join, dirname } from "path";
|
|
6
|
+
import { join, dirname, resolve, isAbsolute } from "path";
|
|
7
7
|
import { homedir } from "os";
|
|
8
8
|
import { BetaAnalyticsDataClient } from "@google-analytics/data";
|
|
9
9
|
import { AnalyticsAdminServiceClient } from "@google-analytics/admin";
|
|
@@ -22,6 +22,11 @@ try {
|
|
|
22
22
|
catch {
|
|
23
23
|
console.error(`[build] ${__cliPkg.name}@${__cliPkg.version} (dev mode)`);
|
|
24
24
|
}
|
|
25
|
+
// Version safety: warn if running a deprecated or dangerously old version
|
|
26
|
+
const __minimumSafeVersion = "2.0.1"; // minimum version with input sanitization
|
|
27
|
+
if (__cliPkg.version < __minimumSafeVersion) {
|
|
28
|
+
console.error(`[WARNING] Running deprecated version ${__cliPkg.version}. Minimum safe version is ${__minimumSafeVersion}. Please upgrade.`);
|
|
29
|
+
}
|
|
25
30
|
// CLI flags
|
|
26
31
|
if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
27
32
|
console.error(`${__cliPkg.name} v${__cliPkg.version}\n`);
|
|
@@ -44,7 +49,9 @@ const envTrimmed = (key) => (process.env[key] || "").trim().replace(/^["']|["']$
|
|
|
44
49
|
function loadConfig() {
|
|
45
50
|
// Single-property mode via env vars
|
|
46
51
|
const propertyId = envTrimmed("GA4_PROPERTY_ID");
|
|
47
|
-
const
|
|
52
|
+
const rawCredsFile = envTrimmed("GOOGLE_APPLICATION_CREDENTIALS");
|
|
53
|
+
// Resolve relative credential paths to absolute (CWD is unpredictable in MCP hosts)
|
|
54
|
+
const credsFile = rawCredsFile && !isAbsolute(rawCredsFile) ? resolve(rawCredsFile) : rawCredsFile;
|
|
48
55
|
if (propertyId) {
|
|
49
56
|
return {
|
|
50
57
|
credentials_file: credsFile,
|
package/dist/tools.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const tools = [
|
|
2
2
|
{
|
|
3
3
|
name: "ga4_get_client_context",
|
|
4
|
-
description: "Get the current GA4 client context based on working directory. Call this first to confirm which GA4 property you're working with.",
|
|
4
|
+
description: "Get the current GA4 client context and health status based on working directory. Call this first to confirm which GA4 property you're working with.",
|
|
5
5
|
inputSchema: {
|
|
6
6
|
type: "object",
|
|
7
7
|
properties: {
|
package/package.json
CHANGED