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 分