search-console-mcp 1.14.0 โ†’ 1.14.1

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/README.md CHANGED
@@ -1,270 +1,176 @@
1
+ <div align="center">
1
2
 
2
- # Search Console MCP
3
+ # ๐Ÿ” Search Console MCP
3
4
 
4
- A Model Context Protocol (MCP) server that transforms how you interact with **Google Search Console**, **Bing Webmaster Tools**, and **Google Analytics 4**. Stop exporting CSVs and start asking questions.
5
+ **Google Search Console + Bing Webmaster Tools + GA4 โ€” in one context window.**
5
6
 
6
- [๐Ÿ“š View Documentation](https://searchconsolemcp.saurabh.app/)
7
-
8
- ---
7
+ Stop exporting CSVs. Start asking your AI agent questions.
9
8
 
10
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
10
  [![Tests](https://github.com/saurabhsharma2u/search-console-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/saurabhsharma2u/search-console-mcp/actions/workflows/ci.yml)
11
+ [![Stars](https://img.shields.io/github/stars/saurabhsharma2u/search-console-mcp?style=social)](https://github.com/saurabhsharma2u/search-console-mcp/stargazers)
12
12
 
13
- ## Why use this?
14
-
15
- ### โŒ The Old, Broken Way
16
- * **Data Silos**: Manually checking Google, then Bing, then GA4.
17
- * **Manual Correlation**: Exporting 3 different CSVs and using VLOOKUPs to see if your #1 ranking page actually converts.
18
- * **Switching Fatigue**: Logging in and out to manage multiple clients or properties.
19
- * **AI Context Limits**: Uploading giant spreadsheets that hit context limits and cause model hallucinations.
13
+ [๐Ÿ“š Docs](https://searchconsolemcp.saurabh.app/) ยท [Quick Start](#-quick-start) ยท [Tools](#-tools) ยท [Security](#-security)
20
14
 
21
- ### โœ… The Search Console MCP Way
22
- * **Platform Synergy**: **GSC + Bing + GA4** in a single context window. Stop exporting, start analyzing.
23
- * **Deterministic Intelligence**: The server performs the complex SEO math (cannibalization, Z-score anomalies, striking distance) so your AI agent gets curated insights, not raw data piles.
24
- * **Cross-Platform ROI**: Use the **Opportunity Matrix** to prioritize keywords that have high search visibility (GSC) but poor on-site engagement (GA4).
25
- * **Zero-Config Multi-Account**: Connect 20+ accounts. The server automatically resolves the correct credentials for every site URL.
26
-
27
- **One Server. Three Platforms. Infinite Accounts. Actionable Intelligence.**
15
+ </div>
28
16
 
29
17
  ---
30
- ## ๐ŸŽฏ Magic Prompts
31
-
32
- Copy and paste these into your MCP client (Claude Desktop, etc.) to see the intelligence engine in action:
33
-
34
- #### ๐Ÿ” The Traffic Detective
35
- > "My traffic dropped this week compared to last. Use the anomaly detection and time-series tools to find exactly when the drop started and which pages are responsible."
36
-
37
- #### ๐ŸŽฏ The "Striking Distance" Hunter
38
- > "Find keywords for https://example.com where I'm ranking in positions 8-15 but have at least 1,000 impressions. These are my best opportunities for a quick traffic boost."
39
-
40
- #### โš”๏ธ The Cannibalization Cleaner
41
- > "Check for keyword cannibalization. Are there any queries where two or more of my pages are competing and splitting the traffic? Suggest which one should be the primary authority."
42
-
43
- #### ๐Ÿ“ˆ The SEO Opportunity Scoreboard
44
- > "Analyze my top 50 keywords for the last 90 days. Rank them by a custom 'Opportunity Score' (Impressions / Position). Give me the top 5 specific pages to focus on."
45
18
 
46
- #### ๐Ÿ“Š The Executive Health Check
47
- > "Run a full SEO health check for my site. Segment the results by Brand vs. Non-Brand and give me 3 high-impact actions for the upcoming week."
19
+ ## Why this exists
48
20
 
49
- #### โšก The Speed vs. Ranking Correlator
50
- > "Fetch the top 5 pages by impressions. For these pages, run a PageSpeed audit. Is there any correlation between low performance scores and recently declining positions?"
21
+ SEO data lives in three different silos. Answering one question โ€” *"did my traffic drop because of a ranking loss or a UX issue?"* โ€” usually means logging into three dashboards, exporting three CSVs, and doing VLOOKUPs by hand.
51
22
 
52
- #### ๐Ÿ”€ Multi-Engine Comparison
53
- > "Compare my performance between Google and Bing for the last 30 days. Which keywords are ranking better on Bing but have lower traffic on Google?"
23
+ Search Console MCP puts **GSC, Bing, and GA4** behind one set of tools your AI agent can call directly, and does the SEO math (cannibalization, anomaly detection, opportunity scoring) *before* the data ever reaches your context window โ€” so your agent gets insights, not spreadsheets.
54
24
 
55
- #### ๐ŸŽฏ Bing Opportunity Finder
56
- > "Show me keywords where I'm in the top 5 on Google but not ranking on Bing. These are my easy Bing wins."
57
-
58
- #### โš ๏ธ Google Dependency Check
59
- > "Am I too dependent on Google? Check my click share across both engines and flag any keywords where over 85% of traffic comes from Google."
60
-
61
- #### ๐Ÿ’ฐ The ROI Prioritizer (GSC + GA4)
62
- > "Run an `opportunity_matrix` for my top 20 pages. Which high-visibility pages have the lowest engagement or conversion rates? These are my conversion optimization priorities."
25
+ | | Before | After |
26
+ |---|---|---|
27
+ | **Data** | 3 dashboards, manual exports | 1 unified context |
28
+ | **Analysis** | Manual VLOOKUPs & pivot tables | Deterministic SEO math, done server-side |
29
+ | **Accounts** | Constant re-login | 20+ accounts, auto-resolved per site |
30
+ | **Insight** | Raw rows, agent guesses | Curated signals (opportunity scores, anomalies) |
63
31
 
64
32
  ---
65
33
 
66
- ## ๐Ÿ” Authentication (Desktop Flow)
67
-
68
- Search Console MCP uses a **Secure Desktop Flow**. This provides high-security, professional grade authentication for your Google account:
69
- - **Multi-Account Support**: Connect multiple Google and Bing accounts. The server automatically picks the right one for each site.
70
- - **System Keychain Primary**: Tokens are stored in your OS's native credential manager (macOS Keychain, Windows Credential Manager, or Linux Secret Service).
71
- - **AES-256-GCM Hardware-Bound Encryption**: Fallback storage is encrypted with AES-256-GCM using a key derived from your unique hardware machine ID. Tokens stolen from your machine cannot be decrypted on another computer.
72
- - **Silent Background Refresh**: Tokens auto-refresh silently when they expire.
34
+ ## โšก Quick Start
73
35
 
74
- ### ๐Ÿš€ Step 1 โ€” Initiate Login
75
- Run the following command to start the authorization process:
76
36
  ```bash
77
37
  npx search-console-mcp setup
78
38
  ```
79
39
 
80
- The CLI will:
81
- 1. Briefly start a secure local server to handle the redirect.
82
- 2. Open your default web browser to the Google Authorization page.
83
- 3. Automatically fetch your email after authorization to label your credentials securely.
84
-
85
- ### ๐Ÿ”‘ Step 2 โ€” Logout & Management
86
- To wipe your credentials from both the keychain and the disk:
87
- ```bash
88
- # Logout of the default account
89
- npx search-console-mcp logout
90
-
91
- # Logout of a specific account
92
- npx search-console-mcp logout user@gmail.com
40
+ This opens your browser, authorizes your Google account, and stores your credentials securely (see [Security](#-security)). Then add it to your MCP client config (Claude Desktop, Cursor, etc.):
41
+
42
+ ```json
43
+ {
44
+ "mcpServers": {
45
+ "search-console": {
46
+ "command": "npx",
47
+ "args": ["search-console-mcp"]
48
+ }
49
+ }
50
+ }
93
51
  ```
94
52
 
95
- ---
96
-
97
- ## ๐Ÿ”‘ Alternative: Service Account (Advanced)
53
+ Restart your client โ€” and try one of the prompts below.
98
54
 
99
- For server-side environments or automated tasks where interactive login isn't possible, you can use a Google Cloud Service Account.
55
+ ---
100
56
 
101
- ### Setup:
102
- 1. **Create Service Account**: Go to the [Google Cloud Console](https://console.cloud.google.com/iam-admin/serviceaccounts) and create a service account.
103
- 2. **Generate Key**: Click "Keys" > "Add Key" > "Create new key" (JSON). Download this file.
104
- 3. **Share Access**: In Google Search Console, add the service account's email address (e.g., `account@project.iam.gserviceaccount.com`) as a user with at least "Full" or "Restricted" permissions.
105
- 4. **Configure**: Point the server to your key file:
106
- ```bash
107
- export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/key.json"
108
- ```
57
+ ## ๐Ÿ’ฌ Try it
109
58
 
110
- ---
59
+ Paste these straight into your agent:
111
60
 
112
- ## ๐Ÿ”‘ Bing Webmaster Tools (API Key)
61
+ > **"My traffic dropped this week vs. last. Find exactly when it started and which pages are responsible."**
113
62
 
114
- To access Bing data, you simply need an API Key.
63
+ > **"Find keywords for example.com ranking positions 8โ€“15 with 1,000+ impressions โ€” my best quick wins."**
115
64
 
116
- ### Setup:
117
- 1. **Get Your API Key**: Go to [Bing Webmaster Tools Settings](https://www.bing.com/webmasters/settings/api).
118
- 2. **Configure**: Set the API key in your environment:
119
- ```bash
120
- export BING_API_KEY="your-api-key-here"
121
- ```
122
- 3. **IndexNow**: Bing tools also support **IndexNow** for instant URL submission.
65
+ > **"Check for keyword cannibalization โ€” are two of my pages competing for the same query?"**
123
66
 
124
- ---
67
+ > **"Run `opportunity_matrix` on my top 20 pages: which have high search visibility but poor on-site engagement?"**
125
68
 
126
- ## ๐Ÿ“Š Google Analytics 4 (GA4)
69
+ <details>
70
+ <summary>More example prompts</summary>
127
71
 
128
- Connect your GA4 properties to correlate ranking data with user behavior.
72
+ - *"Run a full SEO health check, segmented by Brand vs Non-Brand, with 3 high-impact actions."*
73
+ - *"Fetch my top 5 pages by impressions and run a PageSpeed audit โ€” any correlation with declining rankings?"*
74
+ - *"Compare Google vs Bing performance for the last 30 days โ€” where is Bing winning?"*
75
+ - *"Am I too dependent on Google? Flag keywords where 85%+ of clicks come from one engine."*
129
76
 
130
- ### Setup:
131
- 1. **Run Setup**: `npx search-console-mcp setup --engine=ga4`
132
- 2. **Auth Method**: Choose **Service Account** (JSON Key). This is the recommended method for server-side integrations.
133
- * **Service Account**: You must add the service account email as a user in **GA4 Admin > Property Settings > Property Access Management**.
134
- 3. **Property Selection**: The tool will automatically fetch all available GA4 properties for your account and let you select one from a list. You can also enter a Property ID manually if needed.
77
+ </details>
135
78
 
136
79
  ---
137
80
 
138
- ## ๐Ÿ‘ฅ Multi-Account Management
81
+ ## ๐Ÿ”Œ Connect your accounts
82
+
83
+ | Platform | Method | Setup |
84
+ |---|---|---|
85
+ | **Google Search Console** | OAuth (recommended) | `npx search-console-mcp setup` |
86
+ | **Google Search Console** | Service Account | Set `GOOGLE_APPLICATION_CREDENTIALS` โ€” [details](#service-account-advanced) |
87
+ | **Bing Webmaster Tools** | API Key | `export BING_API_KEY="..."` โ€” [get a key](https://www.bing.com/webmasters/settings/api) |
88
+ | **Google Analytics 4** | Service Account | `npx search-console-mcp setup --engine=ga4` |
139
89
 
140
- Manage multiple Google and Bing accounts from the CLI:
90
+ Manage everything from the CLI:
141
91
 
142
92
  ```bash
143
- # List all connected accounts
144
93
  npx search-console-mcp accounts list
94
+ npx search-console-mcp accounts add-site --account=you@company.com --site=example.com
95
+ npx search-console-mcp accounts remove --account=you@company.com
96
+ ```
145
97
 
146
- # Remove an account
147
- npx search-console-mcp accounts remove --account=marketing@company.com
98
+ When your agent queries a site, the server auto-resolves which account owns it โ€” no manual switching. [Multi-account docs โ†’](https://searchconsolemcp.mintlify.app/getting-started/multi-account)
148
99
 
149
- # Add a site boundary to an account
150
- npx search-console-mcp accounts add-site --account=marketing@company.com --site=example.com
151
- ```
100
+ <details>
101
+ <summary id="service-account-advanced">Service Account setup (for servers/automation)</summary>
152
102
 
153
- When your AI agent queries a site, the server automatically resolves which account to use. [Learn more โ†’](https://searchconsolemcp.mintlify.app/getting-started/multi-account)
103
+ 1. Create a service account in the [Google Cloud Console](https://console.cloud.google.com/iam-admin/serviceaccounts)
104
+ 2. Generate a JSON key
105
+ 3. Add the service account email as a user in Search Console with "Full" or "Restricted" access
106
+ 4. `export GOOGLE_APPLICATION_CREDENTIALS="/path/to/key.json"`
107
+
108
+ </details>
154
109
 
155
110
  ---
156
111
 
112
+ ## ๐Ÿ›  Tools
157
113
 
158
- ## ๐Ÿ›ก๏ธ Fort Knox Security
114
+ 40+ tools across five categories. A few flagship ones:
159
115
 
160
- This MCP server implements a multi-layered security architecture:
116
+ | Tool | What it does |
117
+ |---|---|
118
+ | `opportunity_matrix` | Ranks pages by combining GSC visibility with GA4 engagement โ€” where's the ROI? |
119
+ | `seo_striking_distance` | Keywords ranking 8โ€“15 โ€” your fastest wins |
120
+ | `seo_cannibalization` | Pages competing for the same query, with a recommended primary |
121
+ | `analytics_anomalies` | Statistical traffic drop/spike detection |
122
+ | `sites_health_check` | One-shot WoW performance + sitemap + anomaly check |
123
+ | `compare_engines` | Google vs Bing performance, side by side |
161
124
 
162
- * **Keychain Integration**: Primarily uses the **macOS Keychain**, **Windows Credential Manager**, or **libsecret (Linux)** to store tokens.
163
- * **Encrypted Config**: Account configuration is stored in `~/.search-console-mcp-config.enc` using **AES-256-GCM** encryption.
164
- * **Machine Fingerprinting**: The encryption key is derived from your unique hardware UUID and OS user. The encrypted file is useless if moved to another machine.
165
- * **Minimalist Storage**: Only the `refresh_token` and `expiry_date` are stored.
166
- * **Legacy Support**: Automatically detects credentials from older versions (tokens files, environment variables).
167
- * **Strict Unix Permissions**: Config files are created with `mode 600` (read/write only by your user).
125
+ <details>
126
+ <summary><strong>Full tool reference (40+ tools)</strong></summary>
168
127
 
169
- ---
128
+ ### Analytics & Trends
129
+ `analytics_query` ยท `analytics_trends` ยท `analytics_anomalies` ยท `analytics_drop_attribution` ยท `analytics_time_series` ยท `analytics_compare_periods` ยท `seo_brand_vs_nonbrand`
170
130
 
171
- ## Tools Reference
172
-
173
- ### Google Analytics
174
- | Tool | Description |
175
- |------|-------------|
176
- | `analytics_query` | Master tool for raw data. Supports `dimensions`, `filters`, `aggregationType` (byPage/byProperty), `dataState` (final/all), and `type` (web/image/news/discover). |
177
- | `analytics_trends` | Detect trends (rising/falling) for specific queries or pages. |
178
- | `analytics_anomalies` | Detect statistical anomalies in daily traffic. |
179
- | `analytics_drop_attribution` | **[NEW]** Attribute traffic drops to mobile/desktop or correlate with known Google Algorithm Updates. |
180
- | `analytics_time_series` | **[NEW]** Advanced time series with rolling averages, seasonality detection, and forecasting. |
181
- | `analytics_compare_periods` | Compare two date ranges (e.g., WoW, MoM). |
182
- | `seo_brand_vs_nonbrand` | **[NEW]** Analyze performance split between Brand vs Non-Brand traffic. (Supports Google & Bing). |
183
-
184
- ### SEO Opportunities (Opinionated)
185
- | Tool | Description |
186
- |------|-------------|
187
- | `seo_low_hanging_fruit` | Find keywords ranking in pos 5-20 with high impressions. |
188
- | `seo_striking_distance` | **[NEW]** Find keywords ranking 8-15 (Quickest ROI wins). |
189
- | `seo_low_ctr_opportunities` | **[NEW]** Find top ranking queries (pos 1-10) with poor CTR. |
190
- | `seo_cannibalization` | **[Enhanced]** Detect pages competing for the same query with traffic conflict. |
191
- | `seo_lost_queries` | **[NEW]** Identify queries that lost all traffic in the last 28 days. (Supports Google & Bing). |
192
-
193
- ### SEO Primitives (Atoms for Agents)
194
- These are low-level tools designed to be used by other AI agents to build complex logic.
195
- | Tool | Description |
196
- |------|-------------|
197
- | `seo_primitive_ranking_bucket` | Categorize a position (e.g. "Top 3", "Page 1", "Unranked"). |
198
- | `seo_primitive_traffic_delta` | Calculate absolute and % change between two numbers. |
199
- | `seo_primitive_is_brand` | Check if a query matches a brand regex. |
200
- | `seo_primitive_is_cannibalized` | Check if two pages are competing for the same query. |
131
+ ### SEO Opportunities
132
+ `seo_low_hanging_fruit` ยท `seo_striking_distance` ยท `seo_low_ctr_opportunities` ยท `seo_cannibalization` ยท `seo_lost_queries`
133
+
134
+ ### SEO Primitives (building blocks for agent logic)
135
+ `seo_primitive_ranking_bucket` ยท `seo_primitive_traffic_delta` ยท `seo_primitive_is_brand` ยท `seo_primitive_is_cannibalized`
201
136
 
202
137
  ### Sites & Sitemaps
203
- | Tool | Description |
204
- |------|-------------|
205
- | `sites_list` | List all verified sites. |
206
- | `sites_add` / `sites_delete` | Manage properties. |
207
- | `sites_health_check` | **[NEW]** Run a health check on one or all sites. Checks WoW performance, sitemaps, and anomalies. |
208
- | `sitemaps_list` / `sitemaps_submit` | Manage sitemaps. |
138
+ `sites_list` ยท `sites_add` ยท `sites_delete` ยท `sites_health_check` ยท `sitemaps_list` ยท `sitemaps_submit`
209
139
 
210
140
  ### Inspection & Validation
211
- | Tool | Description |
212
- |------|-------------|
213
- | `inspection_inspect` | Google URL Inspection API (Index status, mobile usability). |
214
- | `pagespeed_analyze` | Lighthouse scores & Core Web Vitals. |
215
- | `schema_validate` | Validate Structured Data (JSON-LD). |
216
-
217
- ### URL Indexing (Google & Bing)
218
- | Tool | Description |
219
- |------|-------------|
220
- | `indexing_submit_url` | **[NEW]** Submit a URL for indexing (supports Google Indexing API and Bing URL Submission API). |
221
- | `indexing_remove_url` | **[NEW]** Notify Google that a URL has been removed (Google only). |
222
- | `indexing_status` | **[NEW]** Check notification status for a submitted URL (Google only). |
223
- | `indexing_batch_submit` | **[NEW]** Batch submit multiple URLs for indexing (concurrency-controlled). |
224
- | `bing_url_submission_quota` | Check remaining daily/monthly URL submission quota for Bing. |
141
+ `inspection_inspect` ยท `pagespeed_analyze` ยท `schema_validate`
142
+
143
+ ### URL Indexing
144
+ `indexing_submit_url` ยท `indexing_remove_url` ยท `indexing_status` ยท `indexing_batch_submit` ยท `bing_url_submission_quota`
225
145
 
226
146
  ### Bing Webmaster Tools
227
- | Tool | Description |
228
- |------|-------------|
229
- | `bing_sites_list` | List all verified sites in Bing. |
230
- | `bing_analytics_query` | Query search performance from Bing. |
231
- | `bing_opportunity_finder` | Find low-hanging fruit keywords on Bing. |
232
- | `bing_seo_recommendations` | Get prioritized SEO insights for Bing. |
233
- | `bing_url_info` | Detailed indexing and crawl info for a URL (Bing). |
234
- | `bing_index_now` | **[NEW]** Instantly notify search engines of changes. |
235
- | `bing_crawl_issues` | List crawl issues detected by Bing. |
236
- | `bing_analytics_detect_anomalies` | Detect daily spikes or drops in Bing traffic. |
237
- | `bing_analytics_time_series` | Advanced time series analysis for Bing. |
238
- | `bing_seo_lost_queries` | Identify queries that lost significant traffic on Bing. |
239
- | `bing_brand_analysis` | Analyze performance split between Brand vs Non-Brand traffic on Bing. |
240
- | `bing_sitemaps_list` / `bing_sitemaps_submit` | Manage sitemaps in Bing. |
241
-
242
- ### Google Analytics 4 (GA4)
243
- | Tool | Description |
244
- |------|-------------|
245
- | `analytics_page_performance` | Detailed page metrics (sessions, engagement, views). |
246
- | `analytics_traffic_sources` | Analyze sessions by Channel, Source, and Medium. |
247
- | `analytics_organic_landing_pages` | Focused metrics for organic traffic landing pages. |
248
- | `analytics_content_performance` | Analyze content performance by Content Group in GA4. |
249
- | `analytics_conversion_funnel` | Top converting pages and events. |
250
- | `analytics_user_behavior` | Device, Country, and Engagement breakdown. |
251
- | `analytics_audience_segments` | New vs Returning, Age, and OS analysis. |
252
- | `analytics_realtime` | Live active user data by page and location. |
253
- | `analytics_ecommerce` | Product and revenue performance. |
254
- | `analytics_pagespeed_correlation` | Correlate GA4 metrics with PageSpeed scores. |
147
+ `bing_sites_list` ยท `bing_analytics_query` ยท `bing_opportunity_finder` ยท `bing_seo_recommendations` ยท `bing_url_info` ยท `bing_index_now` ยท `bing_crawl_issues` ยท `bing_analytics_detect_anomalies` ยท `bing_analytics_time_series` ยท `bing_seo_lost_queries` ยท `bing_brand_analysis` ยท `bing_sitemaps_list` ยท `bing_sitemaps_submit`
148
+
149
+ ### Google Analytics 4
150
+ `analytics_page_performance` ยท `analytics_traffic_sources` ยท `analytics_organic_landing_pages` ยท `analytics_content_performance` ยท `analytics_conversion_funnel` ยท `analytics_user_behavior` ยท `analytics_audience_segments` ยท `analytics_realtime` ยท `analytics_ecommerce` ยท `analytics_pagespeed_correlation`
255
151
 
256
152
  ### Cross-Platform Intelligence
257
- | Tool | Description |
258
- |------|-------------|
259
- | `opportunity_matrix` | **[Flagship]** Prioritize SEO tasks by combining signals from GSC, GA4, and Bing. |
260
- | `page_analysis` | Joint analysis of ranking (GSC) vs behavior (GA4) for pages. |
261
- | `traffic_health_check` | Diagnose tracking gaps by comparing GSC clicks to GA4 organic sessions. |
262
- | `brand_analysis` | Brand vs Non-Brand split across GSC, Bing, and GA4. |
263
- | `compare_engines` | Compare keyword performance between Google and Bing. |
153
+ `opportunity_matrix` ยท `page_analysis` ยท `traffic_health_check` ยท `brand_analysis` ยท `compare_engines`
154
+
155
+ </details>
264
156
 
157
+ ---
265
158
 
159
+ ## ๐Ÿ”’ Security
160
+
161
+ - **OS keychain first** โ€” tokens stored in macOS Keychain, Windows Credential Manager, or Linux Secret Service
162
+ - **AES-256-GCM fallback** โ€” encrypted with a key derived from your machine's hardware ID; a stolen file is useless on another device
163
+ - **Minimal storage** โ€” only `refresh_token` and `expiry_date` are persisted, at `mode 600`
164
+ - **Silent refresh** โ€” tokens renew automatically in the background
165
+
166
+ ---
266
167
 
267
168
  ## License
268
169
 
269
- [MIT](LICENSE)
270
- [Contributing](CONTRIBUTING.md)
170
+ [MIT](./LICENSE) ยท [Contributing guide](./CONTRIBUTING.md)
171
+
172
+ <div align="center">
173
+
174
+ If this saves you a spreadsheet, consider โญ starring the repo.
175
+
176
+ </div>
@@ -8,6 +8,10 @@ The \`analytics_drop_attribution\` tool correlates traffic drops with major know
8
8
  | Date | Update Name | Impact Area |
9
9
  |------|-------------|-------------|
10
10
  | 2026-02-05 | February 2026 Discover Core Update | Discover Feed |
11
+ | 2026-03-24 | March 2026 Spam Update | Spam / Content Quality |
12
+ | 2026-03-27 | March 2026 Core Update | General Ranking |
13
+ | 2026-05-21 | May 2026 Core Update | General Ranking |
14
+ | 2026-06-24 | June 2026 Spam Update | Spam / Content Quality |
11
15
 
12
16
  ## 2025
13
17
 
@@ -35,6 +35,10 @@ const ALGORITHM_UPDATES = [
35
35
  { date: '2025-12-11', name: 'December 2025 Core Update' },
36
36
  // 2026
37
37
  { date: '2026-02-05', name: 'February 2026 Discover Core Update' },
38
+ { date: '2026-03-24', name: 'March 2026 Spam Update' },
39
+ { date: '2026-03-27', name: 'March 2026 Core Update' },
40
+ { date: '2026-05-21', name: 'May 2026 Core Update' },
41
+ { date: '2026-06-24', name: 'June 2026 Spam Update' },
38
42
  ];
39
43
  /**
40
44
  * Identify the cause of a significant traffic drop by analyzing device distribution and algorithm updates.
@@ -1,5 +1,12 @@
1
1
  import { google } from 'googleapis';
2
2
  const pagespeed = google.pagespeedonline('v5');
3
+ /**
4
+ * Returns the PageSpeed API key from environment, if configured.
5
+ * When set, this increases the daily quota from ~100 to 25,000 queries/day.
6
+ */
7
+ function getApiKey() {
8
+ return process.env.PAGESPEED_API_KEY || undefined;
9
+ }
3
10
  /**
4
11
  * Run a full PageSpeed Insights analysis on a URL.
5
12
  *
@@ -8,11 +15,25 @@ const pagespeed = google.pagespeedonline('v5');
8
15
  * @returns Performance, accessibility, and SEO scores along with field/lab metrics.
9
16
  */
10
17
  export async function analyzePageSpeed(url, strategy = 'mobile') {
11
- const res = await pagespeed.pagespeedapi.runpagespeed({
12
- url,
13
- strategy,
14
- category: ['performance', 'accessibility', 'best-practices', 'seo']
15
- });
18
+ const key = getApiKey();
19
+ let res;
20
+ try {
21
+ res = await pagespeed.pagespeedapi.runpagespeed({
22
+ url,
23
+ strategy,
24
+ category: ['performance', 'accessibility', 'best-practices', 'seo'],
25
+ ...(key && { key })
26
+ });
27
+ }
28
+ catch (error) {
29
+ const status = error?.code || error?.response?.status;
30
+ if ((status === 429 || status === 500) && !key) {
31
+ throw new Error(`PageSpeed Insights rate limit exceeded. You are using the free tier which is limited to ~100 queries/day. ` +
32
+ `To increase your quota to 25,000/day, set the PAGESPEED_API_KEY environment variable. ` +
33
+ `Get a free key at: https://console.cloud.google.com/apis/credentials`);
34
+ }
35
+ throw error;
36
+ }
16
37
  const data = res.data;
17
38
  const lighthouse = data.lighthouseResult;
18
39
  const categories = lighthouse?.categories;
package/dist/setup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import 'dotenv/config';
3
- import { readFileSync, existsSync, statSync } from 'fs';
3
+ import { readFileSync, existsSync, statSync, writeFileSync } from 'fs';
4
4
  import { resolve, dirname, extname } from 'path';
5
5
  import { createInterface } from 'readline';
6
6
  import { homedir } from 'os';
@@ -93,19 +93,22 @@ async function detectConfig() {
93
93
  googleAccounts: accounts.filter(a => a.engine === 'google'),
94
94
  bingAccounts: accounts.filter(a => a.engine === 'bing'),
95
95
  ga4Accounts: accounts.filter(a => a.engine === 'ga4'),
96
- legacyBing: !!process.env.BING_API_KEY
96
+ legacyBing: !!process.env.BING_API_KEY,
97
+ pagespeedApiKey: !!process.env.PAGESPEED_API_KEY
97
98
  };
98
99
  }
99
100
  function printDetectionSummary(results) {
100
101
  const gCount = results.googleAccounts ? results.googleAccounts.length : 0;
101
102
  const bCount = (results.bingAccounts ? results.bingAccounts.length : 0) + (results.legacyBing ? 1 : 0);
102
103
  const ga4Count = results.ga4Accounts ? results.ga4Accounts.length : 0;
103
- if (gCount === 0 && bCount === 0 && ga4Count === 0)
104
+ const hasPageSpeed = !!results.pagespeedApiKey;
105
+ if (gCount === 0 && bCount === 0 && ga4Count === 0 && !hasPageSpeed)
104
106
  return;
105
107
  console.log(`${colors.bold}${colors.dim}๐Ÿ” Connection Status${colors.reset}\n`);
106
108
  printStatusLine('Google Search Console', gCount > 0);
107
109
  printStatusLine('Google Analytics 4', ga4Count > 0);
108
110
  printStatusLine('Bing Webmaster Tools', bCount > 0);
111
+ printStatusLine('PageSpeed Insights (API Key)', hasPageSpeed);
109
112
  console.log('');
110
113
  }
111
114
  export function validateKeyFile(path) {
@@ -532,6 +535,10 @@ export async function main() {
532
535
  await handleGA4Flow(configStatus);
533
536
  return;
534
537
  }
538
+ else if (engineFlag === 'pagespeed') {
539
+ await setupPageSpeed();
540
+ return;
541
+ }
535
542
  while (true) {
536
543
  printHeader();
537
544
  printDetectionSummary(configStatus);
@@ -539,8 +546,9 @@ export async function main() {
539
546
  console.log(`\n1. Google Search Console`);
540
547
  console.log('2. Google Analytics 4');
541
548
  console.log('3. Bing Webmaster Tools');
542
- console.log('4. Exit');
543
- const choice = await ask(`\n${colors.bold}${colors.cyan}Enter your choice (1-4): ${colors.reset}`);
549
+ console.log('4. PageSpeed Insights (Optional API Key)');
550
+ console.log('5. Exit');
551
+ const choice = await ask(`\n${colors.bold}${colors.cyan}Enter your choice (1-5): ${colors.reset}`);
544
552
  switch (choice) {
545
553
  case '1':
546
554
  await handleGoogleFlow(configStatus, true);
@@ -552,6 +560,11 @@ export async function main() {
552
560
  await handleBingFlow(configStatus);
553
561
  break;
554
562
  case '4':
563
+ await setupPageSpeed();
564
+ // Refresh config status after setting key
565
+ Object.assign(configStatus, await detectConfig());
566
+ break;
567
+ case '5':
555
568
  default:
556
569
  console.log(`\n${colors.dim}See you on the flip side!${colors.reset}`);
557
570
  rl.close();
@@ -726,6 +739,55 @@ async function setupGA4OAuth() {
726
739
  printError(`Failed: ${e.message}`);
727
740
  }
728
741
  }
742
+ async function setupPageSpeed() {
743
+ printBoxHeader('PageSpeed Insights Setup');
744
+ console.log('This key is optional, but raises daily quota from ~100 to 25,000 queries/day.');
745
+ console.log('1. Go to https://console.cloud.google.com/apis/credentials');
746
+ console.log('2. Create an API key and enable the "PageSpeed Insights API" in your project.\n');
747
+ const apiKey = await ask('Enter your PageSpeed API Key (leave empty to skip): ');
748
+ if (!apiKey) {
749
+ printInfo('PageSpeed setup skipped or cleared.');
750
+ return;
751
+ }
752
+ const envPath = resolve('.env');
753
+ let envContent = '';
754
+ if (existsSync(envPath)) {
755
+ envContent = readFileSync(envPath, 'utf8');
756
+ if (envContent.includes('PAGESPEED_API_KEY=')) {
757
+ // Replace existing line
758
+ envContent = envContent.replace(/PAGESPEED_API_KEY=.*/, `PAGESPEED_API_KEY=${apiKey}`);
759
+ }
760
+ else {
761
+ // Append
762
+ envContent += `\nPAGESPEED_API_KEY=${apiKey}\n`;
763
+ }
764
+ }
765
+ else {
766
+ const examplePath = resolve('.env.example');
767
+ if (existsSync(examplePath)) {
768
+ envContent = readFileSync(examplePath, 'utf8');
769
+ if (envContent.includes('PAGESPEED_API_KEY=')) {
770
+ envContent = envContent.replace(/PAGESPEED_API_KEY=.*/, `PAGESPEED_API_KEY=${apiKey}`);
771
+ }
772
+ else {
773
+ envContent += `\nPAGESPEED_API_KEY=${apiKey}\n`;
774
+ }
775
+ }
776
+ else {
777
+ envContent = `PAGESPEED_API_KEY=${apiKey}\n`;
778
+ }
779
+ }
780
+ writeFileSync(envPath, envContent, 'utf8');
781
+ printSuccess('Successfully wrote PAGESPEED_API_KEY to .env file!');
782
+ console.log(`\n${colors.bold}Note for MCP Client integration:${colors.reset}`);
783
+ console.log('If you run this server via an MCP Client (like Cursor, Claude Desktop, VS Code),');
784
+ console.log('you must configure the environment variables in your client\'s config file.');
785
+ console.log('See the documentation for more details:');
786
+ console.log(`${colors.cyan}https://github.com/saurabhsharma2u/search-console-mcp#pagespeed-insights-optional-api-key${colors.reset}\n`);
787
+ // Force reloading of env vars for current process
788
+ process.env.PAGESPEED_API_KEY = apiKey;
789
+ await ask('Press Enter to continue...');
790
+ }
729
791
  const isMain = process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1]);
730
792
  if (isMain) {
731
793
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "search-console-mcp",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "mcpName": "io.github.saurabhsharma2u/search-console-mcp",
5
5
  "description": "MCP server for Google Search Console, Bing Webmaster Tools, and Google Analytics 4",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "google analytics",
23
23
  "ga4"
24
24
  ],
25
- "author": "",
25
+ "author": "Saurabh Sharma",
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
28
  "@adobe/structured-data-validator": "^1.7.0",