MCP Google Search Console

io.github.crunchtools由 GitHub 帳號 crunchtools 發布v0.1.0更新於 Nov 3, 2026

Secure MCP server for Google Search Console analytics, sitemaps, and URL inspection

概覽

AI 產生的概覽

本機 MCP 伺服器,讓助理查詢 Google Search Console 搜尋分析資料、管理網站地圖、檢查網址索引狀態並管理資源。

可以做什麼
  • 查詢搜尋分析資料,例如點擊、曝光、點擊率和平均排名
  • 列出、取得、新增和刪除 Search Console 資源
  • 列出、取得、提交和刪除網站地圖
  • 檢查指定網址的索引狀態
適用情境
適合需要讓助理取得 Search Console 成效數據、排查頁面是否被索引,或維護網站地圖與已驗證資源、而不必手動開啟 Google 後台的場合。
執行需求
以本機 Python 程序(uvx 或 pip)或容器方式執行。需要啟用 Search Console API 與 webmasters 權限範圍的 Google Cloud OAuth 用戶端,並透過 GSC_CLIENT_ID、GSC_CLIENT_SECRET 以及瀏覽器 OAuth 流程或 GSC_REFRESH_TOKEN 提供憑證;可選 GSC_CREDENTIALS_DIR 與 GSC_OAUTH_REDIRECT_URI。需能連線至 Google API。
安裝前請注意
需要 Google OAuth 密鑰(GSC_CLIENT_ID、GSC_CLIENT_SECRET、GSC_REFRESH_TOKEN),可存取你的 Search Console 資源,請以受限權限保存環境變數檔案。部分工具會變更狀態:add_site、delete_site、submit_sitemap 和 delete_sitemap 會修改 Search Console 設定。瀏覽器 OAuth 流程需要可連線的回呼網址,並會將權杖寫入憑證檔案。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

mcp-google-search-console-crunchtools

Secure MCP server for Google Search Console. Query search analytics (clicks, impressions, CTR, position), manage sitemaps, inspect URL indexing status, and manage site properties.

[CI] [PyPI] [License: AGPL v3]

Installation

uvx (recommended, zero-install)

bash
claude mcp add mcp-google-search-console-crunchtools \    --env GSC_CLIENT_ID=your_client_id \    --env GSC_CLIENT_SECRET=your_client_secret \    --env GSC_REFRESH_TOKEN=your_refresh_token \    -- uvx mcp-google-search-console-crunchtools

pip

bash
pip install mcp-google-search-console-crunchtools

Container (Podman/Docker)

bash
podman run -d -p 8017:8017 \    --env-file ~/.config/mcp-env/mcp-google-search-console.env \    quay.io/crunchtools/mcp-google-search-console \    --transport streamable-http --host 0.0.0.0

OAuth Setup

This server supports two authentication methods: browser-based OAuth (recommended) and environment variable (fallback).

Option A: Browser-Based OAuth (Recommended)

Browser-based OAuth handles token exchange automatically. When credentials expire, visit the /auth URL and click through Google's consent screen — no manual code exchange needed.

Step 1: Create a Google Cloud OAuth App
  1. Go to Google Cloud Console
  2. Create a new project (or select an existing one)
  3. Navigate to APIs & Services > Library
  4. Search for Google Search Console API and click Enable
  5. Navigate to APIs & Services > Credentials
  6. Click + CREATE CREDENTIALS > OAuth client ID
  7. If prompted, configure the OAuth consent screen first:
    • User type: External (or Internal if using Google Workspace)
    • App name: anything (e.g., "MCP Search Console")
    • Scopes: add https://www.googleapis.com/auth/webmasters
    • Test users: add your Google account email
  8. Back on Create OAuth client ID:
    • Application type: Web application
    • Name: anything (e.g., "MCP Search Console")
    • Authorized redirect URIs: add your server's callback URL (e.g., https://mcp-gsc.example.com/oauth2callback)
  9. Click Create — copy the Client ID and Client Secret
Step 2: Configure and Start

Create an env file:

bash
cat > ~/.config/mcp-env/mcp-google-search-console.env << 'EOF'GSC_CLIENT_ID=your_client_idGSC_CLIENT_SECRET=your_client_secretGSC_CREDENTIALS_DIR=/dataGSC_OAUTH_REDIRECT_URI=https://mcp-gsc.example.com/oauth2callbackEOFchmod 600 ~/.config/mcp-env/mcp-google-search-console.env

Start the server with a persistent volume for credentials:

bash
podman run -d -p 8017:8017 \    --env-file ~/.config/mcp-env/mcp-google-search-console.env \    -v mcp-gsc-data:/data:Z \    quay.io/crunchtools/mcp-google-search-console \    --transport streamable-http --host 0.0.0.0
Step 3: Authenticate

Visit https://mcp-gsc.example.com/auth in your browser. You'll be redirected to Google's consent screen. Grant access and the server will save credentials automatically.

When tokens expire, any tool call will return the /auth URL. Click it to re-authenticate — no container restart needed.

Option B: Environment Variable (Fallback)

If you prefer static credentials or can't expose a callback URL, set GSC_REFRESH_TOKEN in your env file. See the manual OAuth flow below.

Manual OAuth flow
bash
export GSC_CLIENT_ID="your_client_id_here"export GSC_CLIENT_SECRET="your_client_secret_here"
echo "https://accounts.google.com/o/oauth2/v2/auth?client_id=${GSC_CLIENT_ID}&redirect_uri=http://127.0.0.1&response_type=code&scope=https://www.googleapis.com/auth/webmasters&access_type=offline&prompt=consent"
  1. Open the URL in your browser, sign in, and click Allow
  2. Copy the code= value from the redirect URL
  3. Exchange the code:
bash
curl -s -X POST https://oauth2.googleapis.com/token \    -d "client_id=${GSC_CLIENT_ID}" \    -d "client_secret=${GSC_CLIENT_SECRET}" \    -d "code=PASTE_CODE_HERE" \    -d "grant_type=authorization_code" \    -d "redirect_uri=http://127.0.0.1" | python3 -m json.tool
  1. Copy the refresh_token from the response and add GSC_REFRESH_TOKEN=... to your env file.

How it works at runtime

The server checks for credentials in this order:

  1. File-based credentials from GSC_CREDENTIALS_DIR/credentials.json (written by the browser-based flow)
  2. Environment variable GSC_REFRESH_TOKEN (fallback)

On each API call, the server exchanges the refresh token for a short-lived access token (~1 hour), cached in memory and refreshed automatically. Updated tokens are persisted to the credentials file for reuse across container restarts.

Available Tools (10)

CategoryCountTools
Sites4list_sites, get_site, add_site, delete_site
Search Analytics1query_search_analytics
Sitemaps4list_sitemaps, get_sitemap, submit_sitemap, delete_sitemap
URL Inspection1inspect_url

Security

  • OAuth2 credentials stored as SecretStr (never logged)
  • File-based credentials written with 0o600 permissions (atomic writes)
  • Automatic token scrubbing from error messages
  • Pydantic input validation with extra="forbid"
  • No filesystem access, shell execution, or code evaluation
  • TLS certificate validation (httpx default)
  • Request timeouts and response size limits
  • Built on Hummingbird container images

See SECURITY.md for the full security design document.

Development

bash
uv sync --all-extrasuv run ruff check src testsuv run mypy srcuv run pytest -vgourmand --full .podman build -f Containerfile .

License

AGPL-3.0-or-later

來源:README.md,提交 dde91a8

工具

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

版本歷史

1
  1. v0.1.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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