Google Gsc

io.github.mharnett由 GitHub 帳號 mharnett 發布v1.0.1更新於 Oct 25, 2026

Google Search Console MCP: search analytics, URL inspection, site management.

概覽

AI 產生的概覽

在本機執行的 Google Search Console MCP 伺服器,讓助理查詢搜尋分析資料、檢查網址並列出已驗證的資源。

可以做什麼
列出已驗證的 Search Console 資源,並依設定從工作目錄辨識對應資源。依查詢字詞、頁面、裝置、國家或日期查詢點擊、曝光、點擊率和排名等搜尋成效資料,支援篩選,預設為最近 28 天。檢查指定網址的索引狀態、檢索狀態、行動裝置可用性與複合式搜尋結果。
適用情境
適合在 SEO 或內容工作中,讓助理讀取自家網站的 Search Console 成效資料,或檢查頁面的索引與行動裝置可用性,而不必開啟 Search Console 介面。
執行需求
以 npm 套件 mcp-google-gsc 在本機 Node.js 上執行。需要 Google Cloud 的 Search Console API 存取權,並提供由 GOOGLE_APPLICATION_CREDENTIALS 指向的服務帳戶 JSON 金鑰檔,或在 GOOGLE_GSC_CLIENT_ID、GOOGLE_GSC_CLIENT_SECRET 和 GOOGLE_GSC_REFRESH_TOKEN 中設定 OAuth 用戶端憑證。帳戶或服務帳戶電子郵件必須在每個要查詢的資源上取得授權。
安裝前請注意
需要 Google 憑證:服務帳戶金鑰檔路徑,或 OAuth 用戶端 ID、密鑰和更新權杖。README 提醒不要分享或提交 .mcp.json 設定檔,也不要將更新權杖輔助指令的輸出重新導向到共用日誌。權限為唯讀(webmasters.readonly 範圍),所有工具僅讀取資料;查詢結果會傳送給助理,並在 200KB 處截斷。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Google Gsc,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcp-google-gsc

MCP server for Google Search Console -- search analytics, URL inspection, and site management via Claude.

Features

  • Search Analytics -- Query clicks, impressions, CTR, and position with flexible dimension filters (query, page, device, country, date)
  • URL Inspection -- Check indexing status, mobile usability, and rich results for any URL
  • Site Listing -- List all verified Search Console properties accessible to your authenticated account (OAuth user or service account)
  • Multi-Client Support -- Manage multiple GSC properties with per-directory config mapping

Installation

From npm

bash
npm install mcp-google-gsc

From source

bash
git clone https://github.com/mharnett/mcp-search-console.gitcd mcp-google-gscnpm installnpm run build

Configuration

Security: Never share your .mcp.json file or commit it to git -- it may contain API credentials. Add .mcp.json to your .gitignore.

mcp-gsc supports two authentication modes. Pick whichever fits your setup. Neither requires any file living at a hardcoded machine-local path -- credentials come from environment variables (or a config.json you create).

Which mode to use:

  • Service Account (Mode B) -- recommended for unattended / server / headless use. A service account has no interactive login to expire or re-consent, so it is the right fit for always-on deployments. The one setup requirement is that the service account's email must be granted access on each Search Console property you want to query (see Mode B).
  • User OAuth (Mode A) -- for personal / interactive use, where you want to authorize with your own Google login.

Precedence when both are configured: if a service-account keyfile is explicitly set (GOOGLE_APPLICATION_CREDENTIALS, or credentials_file in config.json), it wins over any OAuth refresh token or stored OAuth credentials. If neither is configured, the server fails loudly at startup with an onboarding message rather than silently guessing -- there is no machine-local default and no silent runtime failover between modes.

Mode A: User OAuth (bring your own Google account)

Use this if you want to authorize with your own Google login (the account that has Search Console access). Best for personal / interactive use.

  1. In the Google Cloud Console, create an OAuth 2.0 Client ID of type Desktop app and enable the Search Console API. (For a Desktop-app client, Google accepts any http://localhost loopback redirect -- you do not need to pre-register a port.)
  2. Export your client credentials:
    bash
    export GOOGLE_GSC_CLIENT_ID=...apps.googleusercontent.comexport GOOGLE_GSC_CLIENT_SECRET=...
  3. Mint a refresh token (opens your browser, uses PKCE + access_type=offline):
    bash
    node get-refresh-token.cjs

    Do not redirect this command's stdout to a shared log -- it prints the refresh token to stdout by design.

  4. Copy the printed line into your environment:
    bash
    export GOOGLE_GSC_REFRESH_TOKEN=...

The server reads GOOGLE_GSC_CLIENT_ID, GOOGLE_GSC_CLIENT_SECRET, and GOOGLE_GSC_REFRESH_TOKEN from the environment at runtime.

Alternatively, run the guided helper npx mcp-gsc-auth, which performs the same PKCE OAuth flow, lets you pick a default Search Console property, and writes the result to a per-user credentials file.

Mode B: Service Account (recommended for unattended / server use)

Use this for server / headless / always-on contexts -- it is the recommended path when no human is present to complete or refresh an interactive login.

  1. Create a Google Cloud service account with Search Console API access and download its JSON key file.
  2. Grant the service account's email access on each Search Console property you want to query (add it as a user in Search Console). Without this grant on the property, the service account can authenticate but will see no sites.
  3. Point the server at the key file via an environment variable (no hardcoded path):
    bash
    export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json

OAuth scope

Both modes request a single, read-only scope: https://www.googleapis.com/auth/webmasters.readonly. All four tools are reads -- nothing writes -- so the server never asks for read/write access.

The scope is defined once in config.json under oauth.scope (see config.example.json). The OAuth helper and the runtime read the same value, so they never drift. If config.json is absent (e.g. a fresh install), the committed read-only default is used.

Multi-client config (optional)

To map working directories to Search Console properties, create a config.json in the project root (see config.example.json):

json
{  "oauth": {    "scope": "https://www.googleapis.com/auth/webmasters.readonly"  },  "clients": {    "my-project": {      "name": "My Project",      "folder": "/path/to/project",      "site_url": "https://example.com/"    }  }}

Usage

Add to your Claude Code .mcp.json:

json
{  "mcpServers": {    "gsc": {      "command": "node",      "args": ["/path/to/mcp-gsc/dist/index.js"]    }  }}

Or if installed globally:

json
{  "mcpServers": {    "gsc": {      "command": "npx",      "args": ["mcp-google-gsc"]    }  }}

Claude Desktop: Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).

Tools

ToolDescription
gsc_get_client_contextDetect the GSC property from your working directory based on config mapping
gsc_list_sitesList all verified Search Console properties accessible to the authenticated account
gsc_search_analyticsQuery search performance data (clicks, impressions, CTR, position) with dimension and filter support
gsc_inspectionInspect a URL for indexing status, mobile usability, and rich results

gsc_search_analytics

Supports dimensions: query, page, device, country, date. Filter by any dimension with operators like equals, contains, notContains. Date range defaults to the last 28 days.

gsc_inspection

Returns index coverage, crawl status, mobile usability verdict, and rich result details for a specific URL within a property.

Architecture

  • Resilience -- Uses cockatiel for retry with exponential backoff and circuit breaker patterns on all Google API calls
  • Logging -- Structured logging via pino with configurable log levels
  • Response Handling -- Responses truncated at 200KB to stay within MCP transport limits

License

MIT -- see LICENSE.


Built by Mark Harnett / drak-marketing

來源:README.md,提交 d73fd1c

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分