@digestseo/mcp-gsc 0.4.6 → 0.4.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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.7] - 2026-09-21
9
+
10
+ ### Fixed
11
+ - Weekly-digest query movers no longer treat a query missing from one bounded top-query response as zero traffic; comparisons now require the query to be present in both weekly result sets and explain that Search Analytics does not guarantee every data row.
12
+ - Period comparison and content-decay analysis no longer fabricate zero metrics for dimension keys or pages missing from one non-exhaustive Search Analytics response; they now compare only rows returned in both periods and expose that scope explicitly.
13
+
8
14
  ## [0.4.6] - 2026-09-21
9
15
 
10
16
  ### Fixed
package/README.md CHANGED
@@ -78,9 +78,9 @@ By default (`GSC_ACCESS_MODE=readwrite`), this server exposes 21 tools. Read-onl
78
78
  | **`urls.inspect`** | Read | Google's URL Inspection report for the version of one page currently known in Google's index. It is not a live URL test; mobile-usability output is deprecated. |
79
79
  | **`urls.inspect_many`** | Read | Inspect Google's indexed versions of up to 10 URLs sequentially in one call. Each URL still consumes one Google URL Inspection request and one unit of the server's shared inspection safety budget; this does not run live URL tests. |
80
80
  | **`sitemaps.list`** / **`sitemaps.get`** | Read | List submitted sitemaps or retrieve one sitemap's details. |
81
- | **`insights.quick_wins`** / **`insights.cannibalization`** / **`insights.content_decay`** | Read | Surface average-position opportunity rows, query/page overlap, and evidence-ranked click declines. Quick-win candidates are observed query/page rows selected by aggregate Search Console average position, not proof of a stable current rank, and CTR is context rather than an eligibility filter. Cannibalization candidate totals/shares are scoped to observed query/page rows rather than true query-level property totals; content-decay results distinguish likely decay from weak evidence and improving visibility with click volatility. |
82
- | **`indexing.list_pages`** / **`analytics.compare`** | Read | Analyze pages receiving Search Console impressions and compare two periods, optionally using the same search type and query/page/country/device/search-appearance filters for both periods. `indexing.list_pages` is performance data, not index coverage: a missing URL may still be indexed; use `urls.inspect` / `urls.inspect_many` for URL-level index status. |
83
- | **`reports.weekly_digest`** | Read | Generate a plain-language seven-day performance report with movers, top pages, and one recommended action. |
81
+ | **`insights.quick_wins`** / **`insights.cannibalization`** / **`insights.content_decay`** | Read | Surface average-position opportunity rows, query/page overlap, and evidence-ranked click declines. Quick-win candidates are observed query/page rows selected by aggregate Search Console average position, not proof of a stable current rank, and CTR is context rather than an eligibility filter. Cannibalization candidate totals/shares are scoped to observed query/page rows rather than true query-level property totals; content-decay results compare only pages returned in both periods and do not turn one-sided row absence into zero traffic. |
82
+ | **`indexing.list_pages`** / **`analytics.compare`** | Read | Analyze pages receiving Search Console impressions and compare two periods, optionally using the same search type and query/page/country/device/search-appearance filters for both periods. `analytics.compare` compares only dimension keys returned in both period responses; a key absent from one non-exhaustive Search Analytics response is not assumed to have zero metrics. `indexing.list_pages` is performance data, not index coverage: a missing URL may still be indexed; use `urls.inspect` / `urls.inspect_many` for URL-level index status. |
83
+ | **`reports.weekly_digest`** | Read | Generate a plain-language seven-day performance report with movers, top pages, and one recommended action. Query movers compare only rows returned in both weekly Search Analytics result sets; a query missing from one bounded response is not treated as zero because Google does not guarantee every data row. |
84
84
  | **`sites.add`** / **`sites.delete`** | Write | Add or remove a Search Console property. |
85
85
  | **`sitemaps.submit`** / **`sitemaps.delete`** | Write | Submit or remove a sitemap. |
86
86
  | **`indexing.request`** | Write | Requests indexing through Google's Indexing API. Google currently restricts this API to pages containing `JobPosting` structured data or livestream pages containing `BroadcastEvent` inside `VideoObject`. It is not available for general webpage submission. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digestseo/mcp-gsc",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "private": false,
5
5
  "main": "scripts/glama-start.mjs",
6
6
  "bin": {
package/src/digest.ts CHANGED
@@ -199,25 +199,22 @@ function rowsToPages(rows: SearchAnalyticsRow[]): PageRow[] {
199
199
 
200
200
  function computeMovers(current: QueryRow[], prev: QueryRow[]): Movers {
201
201
  const prevByQuery = new Map(prev.map((q) => [q.query, q]));
202
- const currentByQuery = new Map(current.map((q) => [q.query, q]));
203
- const allQueries = new Set<string>([
204
- ...current.map((q) => q.query),
205
- ...prev.map((q) => q.query),
206
- ]);
207
202
 
208
203
  const rising: Mover[] = [];
209
204
  const falling: Mover[] = [];
210
205
  const newImpressions: Mover[] = [];
211
206
 
212
- for (const query of allQueries) {
213
- const c = currentByQuery.get(query);
207
+ for (const c of current) {
208
+ const query = c.query;
214
209
  const p = prevByQuery.get(query);
215
- const cClicks = c?.clicks ?? 0;
216
- const pClicks = p?.clicks ?? 0;
217
- const cImpr = c?.impressions ?? 0;
218
- const pImpr = p?.impressions ?? 0;
219
- const cPos = c?.position ?? 0;
220
- const pPos = p?.position ?? 0;
210
+ if (!p) continue;
211
+
212
+ const cClicks = c.clicks;
213
+ const pClicks = p.clicks;
214
+ const cImpr = c.impressions;
215
+ const pImpr = p.impressions;
216
+ const cPos = c.position;
217
+ const pPos = p.position;
221
218
 
222
219
  if (cClicks - pClicks >= 5 && cClicks >= 2 * Math.max(pClicks, 1)) {
223
220
  rising.push({
@@ -403,6 +400,10 @@ function renderMarkdown(data: {
403
400
 
404
401
  lines.push('## What changed this week');
405
402
  lines.push('');
403
+ lines.push(
404
+ '> Query movers compare only query rows returned in both weekly Search Console result sets. A query missing from one bounded response is not treated as zero because Search Analytics returns top rows and does not guarantee every data row.',
405
+ );
406
+ lines.push('');
406
407
 
407
408
  const hasAnyMovers =
408
409
  movers.rising.length > 0 ||
package/src/google.ts CHANGED
@@ -925,9 +925,10 @@ export function processContentDecay(
925
925
  const prevPos = row.position;
926
926
 
927
927
  const recent = recentMap.get(page);
928
- const recClicks = recent ? recent.clicks : 0;
929
- const recImps = recent ? recent.impressions : 0;
930
- const recPos = recent ? recent.position : 0;
928
+ if (!recent) continue;
929
+ const recClicks = recent.clicks;
930
+ const recImps = recent.impressions;
931
+ const recPos = recent.position;
931
932
 
932
933
  const clickDiff = recClicks - prevClicks;
933
934
  const impDiff = recImps - prevImps;
@@ -1433,7 +1434,8 @@ export function processPerformanceComparison(
1433
1434
  const ctrA = row.ctr;
1434
1435
  const posA = row.position;
1435
1436
 
1436
- const b = mapB.get(key) || { clicks: 0, impressions: 0, ctr: 0, position: 0 };
1437
+ const b = mapB.get(key);
1438
+ if (!b) continue;
1437
1439
  const clicksB = b.clicks;
1438
1440
  const impsB = b.impressions;
1439
1441
  const ctrB = b.ctr;
@@ -1457,36 +1459,6 @@ export function processPerformanceComparison(
1457
1459
  });
1458
1460
  }
1459
1461
 
1460
- const mapAKeys = new Set(
1461
- rowsA
1462
- .map((r) => r.keys?.[0])
1463
- .filter((key): key is string => key !== undefined),
1464
- );
1465
- for (const row of rowsB) {
1466
- if ((row.keys?.length ?? 0) < 1) continue;
1467
- const key = row.keys![0];
1468
- if (mapAKeys.has(key)) continue;
1469
-
1470
- const clicksB = row.clicks;
1471
- const impsB = row.impressions;
1472
- const ctrB = row.ctr;
1473
- const posB = row.position;
1474
-
1475
- comparison.push({
1476
- key,
1477
- period_a: { clicks: 0, impressions: 0, ctr: 0, position: 0 },
1478
- period_b: { clicks: clicksB, impressions: impsB, ctr: ctrB, position: posB },
1479
- diff: {
1480
- clicks: -clicksB,
1481
- clicks_percentage: calculatePercentageChange(0, clicksB),
1482
- impressions: -impsB,
1483
- impressions_percentage: calculatePercentageChange(0, impsB),
1484
- ctr: -ctrB,
1485
- position: -posB,
1486
- },
1487
- });
1488
- }
1489
-
1490
1462
  return comparison.sort(
1491
1463
  (a, b) =>
1492
1464
  Math.abs(b.diff.clicks) - Math.abs(a.diff.clicks) ||
package/src/index.ts CHANGED
@@ -345,6 +345,8 @@ const CONTENT_DECAY_OUTPUT_SCHEMA = {
345
345
  recent: z.object({ start: z.string(), end: z.string() }),
346
346
  previous: z.object({ start: z.string(), end: z.string() }),
347
347
  }),
348
+ comparison_scope: z.literal('common_returned_rows_only'),
349
+ comparison_note: z.string(),
348
350
  decay_count: z.number().int().nonnegative(),
349
351
  assessment_count: z.number().int().nonnegative(),
350
352
  decay_results: z.array(
@@ -393,7 +395,12 @@ const SEARCH_VISIBLE_PAGES_DESCRIPTION =
393
395
  const SEARCH_VISIBLE_PAGES_NOTE =
394
396
  'These are Search Analytics performance rows for pages with recorded impressions in the requested period, not a complete list of indexed URLs. Absence does not mean a URL is unindexed. Use urls.inspect or urls.inspect_many for URL-level index status.';
395
397
 
398
+ const COMMON_RETURNED_ROWS_COMPARISON_NOTE =
399
+ 'Comparisons use only dimension keys returned in both period responses. A key missing from one Search Analytics response is not treated as zero because Google does not guarantee every data row.';
400
+
396
401
  const PERFORMANCE_COMPARISON_OUTPUT_SCHEMA = {
402
+ comparison_scope: z.literal('common_returned_rows_only'),
403
+ comparison_note: z.string(),
397
404
  comparisons: z.array(
398
405
  z.object({
399
406
  key: z.string(),
@@ -584,7 +591,7 @@ const TOOL_CATALOG = [
584
591
  {
585
592
  name: 'insights.content_decay',
586
593
  description:
587
- 'Assess page-level click declines across two contiguous periods and distinguish likely decay from weak evidence or improving visibility with click volatility.',
594
+ 'Assess page-level click declines across two contiguous periods for pages returned in both Search Analytics responses, without treating one-sided row absence as zero traffic.',
588
595
  },
589
596
  {
590
597
  name: 'indexing.request',
@@ -598,7 +605,7 @@ const TOOL_CATALOG = [
598
605
  {
599
606
  name: 'analytics.compare',
600
607
  description:
601
- 'Compare Search Console performance metrics (clicks, impressions, CTR, average position) between two distinct date ranges (Period A vs Period B) for a selected dimension.',
608
+ 'Compare Search Console performance metrics between two date ranges for dimension keys returned in both Search Analytics responses; one-sided row absence is not treated as zero.',
602
609
  },
603
610
  {
604
611
  name: 'reports.weekly_digest',
@@ -1456,7 +1463,7 @@ class GscMcpRuntime {
1456
1463
  'insights.content_decay',
1457
1464
  {
1458
1465
  title: 'Detect Content Decay',
1459
- description: 'Assess page-level click declines across two contiguous periods without treating every small click change as content decay. Each result is classified as likely_decay, weak_insufficient_evidence, or improving_visibility_with_click_volatility using deterministic click-volume, impression, and average-position signals. This is a heuristic assessment, not statistical proof. Results are bounded with limit/start_row; source pagination is reported separately.',
1466
+ description: 'Assess page-level click declines across two contiguous periods without treating every small click change as content decay. Only pages returned in both Search Analytics period responses are compared; a page missing from one response is not treated as zero because Google does not guarantee every data row. Each result is classified as likely_decay, weak_insufficient_evidence, or improving_visibility_with_click_volatility using deterministic click-volume, impression, and average-position signals. This is a heuristic assessment, not statistical proof. Results are bounded with limit/start_row; source pagination is reported separately.',
1460
1467
  inputSchema: {
1461
1468
  site_url: SEARCH_CONSOLE_PROPERTY_SCHEMA,
1462
1469
  compare_days: CONTENT_DECAY_COMPARE_DAYS_SCHEMA,
@@ -1510,6 +1517,8 @@ class GscMcpRuntime {
1510
1517
  recent: { start: recentStart, end: recentEnd },
1511
1518
  previous: { start: previousStart, end: previousEnd },
1512
1519
  },
1520
+ comparison_scope: 'common_returned_rows_only' as const,
1521
+ comparison_note: COMMON_RETURNED_ROWS_COMPARISON_NOTE,
1513
1522
  decay_count: decayResults.filter(
1514
1523
  (result) => result.classification === 'likely_decay',
1515
1524
  ).length,
@@ -1628,7 +1637,7 @@ class GscMcpRuntime {
1628
1637
  'analytics.compare',
1629
1638
  {
1630
1639
  title: 'Compare Performance Between Periods',
1631
- description: 'Compare Search Console performance metrics (clicks, impressions, CTR, average position) between two distinct date ranges (Period A vs Period B) for a selected dimension (query, page, country, device). Apply the same search type and optional dimension filters to both periods. Results are ranked by largest absolute click change, then impression change, and safely paged with limit/start_row. Percentage change is null when the baseline is zero and the comparison value differs. Discover is intentionally unavailable because this comparison contract includes average position, which the Discover report does not support.',
1640
+ description: 'Compare Search Console performance metrics (clicks, impressions, CTR, average position) between two distinct date ranges (Period A vs Period B) for a selected dimension (query, page, country, device). Only dimension keys returned in both Search Analytics period responses are compared; a key missing from one response is not treated as zero because Google does not guarantee every data row. Apply the same search type and optional dimension filters to both periods. Results are ranked by largest absolute click change, then impression change, and safely paged with limit/start_row. Percentage change is null when an explicitly returned baseline row has zero and the comparison value differs. Discover is intentionally unavailable because this comparison contract includes average position, which the Discover report does not support.',
1632
1641
  inputSchema: {
1633
1642
  site_url: SEARCH_CONSOLE_PROPERTY_SCHEMA,
1634
1643
  start_date_a: SEARCH_CONSOLE_DATE_SCHEMA.describe('Start date of Period A (recent, YYYY-MM-DD)'),
@@ -1718,6 +1727,8 @@ class GscMcpRuntime {
1718
1727
  const comparison = processPerformanceComparison(sourceA.rows, sourceB.rows);
1719
1728
  const bounded = windowKnownResults(comparison, start_row, limit);
1720
1729
  const payload = {
1730
+ comparison_scope: 'common_returned_rows_only' as const,
1731
+ comparison_note: COMMON_RETURNED_ROWS_COMPARISON_NOTE,
1721
1732
  comparisons: bounded.items,
1722
1733
  pagination: {
1723
1734
  period_a: paginationMetadata(sourceA),