mcp-ga4 2.0.11 → 2.0.12

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":"5b5fb2c","builtAt":"2026-04-09T23:02:54.441Z"}
1
+ {"sha":"3bd9339","builtAt":"2026-04-09T23:11:56.896Z"}
package/dist/index.js CHANGED
@@ -184,12 +184,19 @@ class Ga4Manager {
184
184
  const mets = (options.metrics || "eventCount").split(",").map(m => ({ name: m.trim() })).filter(m => m.name);
185
185
  const startDate = options.startDate || "7daysAgo";
186
186
  const endDate = options.endDate || "today";
187
+ // Future date validation (skip relative dates like "7daysAgo")
188
+ const today_ga4 = new Date().toISOString().slice(0, 10);
189
+ if (startDate && !startDate.includes("daysAgo") && !startDate.includes("yesterday") && !startDate.includes("today") && startDate > today_ga4) {
190
+ return { rows: [], row_count: 0, error: `start_date "${startDate}" is in the future. Reports only cover historical data.` };
191
+ }
192
+ // Cap limit at 10,000 for sanity (GA4 API max is 100,000)
193
+ const limit = Math.min(options.limit || 100, 10000);
187
194
  const request = {
188
195
  property: `properties/${propertyId}`,
189
196
  dimensions: dims,
190
197
  metrics: mets,
191
198
  dateRanges: [{ startDate, endDate }],
192
- limit: options.limit || 100,
199
+ limit,
193
200
  };
194
201
  if (options.dimensionFilter && options.dimensionFilter.includes("==")) {
195
202
  const [field, value] = options.dimensionFilter.split("==", 2);
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.11",
4
+ "version": "2.0.12",
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": {