MCP Google Search Console

搜索与获取

by crunchtools

面向 Google Search Console 的安全 MCP 服务器,支持 analytics、sitemaps 与 URL inspection。

什么是 MCP Google Search Console

面向 Google Search Console 的安全 MCP 服务器,支持 analytics、sitemaps 与 URL inspection。

README

mcp-google-search-console-crunchtools

<!-- mcp-name: io.github.crunchtools/google-search-console -->

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_id
GSC_CLIENT_SECRET=your_client_secret
GSC_CREDENTIALS_DIR=/data
GSC_OAUTH_REDIRECT_URI=https://mcp-gsc.example.com/oauth2callback
EOF
chmod 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.

<details> <summary><strong>Manual OAuth flow</strong></summary>
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.
</details>

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-extras
uv run ruff check src tests
uv run mypy src
uv run pytest -v
gourmand --full .
podman build -f Containerfile .

License

AGPL-3.0-or-later

常见问题

MCP Google Search Console 是什么?

面向 Google Search Console 的安全 MCP 服务器,支持 analytics、sitemaps 与 URL inspection。

相关 Skills

技能搜索

by daymade

Universal
热门

通过CCPM直接搜索、查看、安装、更新和卸载Claude Code Skill,适合查找PDF、代码审查等场景插件,也能列出已装Skill并自动执行命令返回结果。

想给Claude Code找对技能时,用它能一站式搜索、安装和管理CCPM注册表里的能力,省去到处翻找的时间。

搜索与获取
未扫描1.4k

深度研究

by daymade

Universal
热门

围绕既定模板拆题、多轮检索、整理证据表并交叉校验引用,产出格式严格、可追溯的研究报告,适合市场调研、竞品分析、政策追踪等高要求写作任务

把网页搜索、信息检索和研究分析串成一条链路,适合需要快速汇总线索、做深度判断的开发与研究工作。

搜索与获取
未扫描1.4k

标准研究员

by levnikolaevich

Universal

基于项目技术栈和 Epic/Story 需求,用 MCP Ref 检索相关 RFC、行业标准与架构模式,整理成可直接写入 Story Technical Notes 的研究结论与参考链接。

做技术方案时先让标准研究员帮你查标准与设计模式,基于 MCP Ref 产出可复用的技术注释研究,省下大量检索整理时间。

搜索与获取
未扫描554

相关 MCP Server

网页抓取

编辑精选

by Anthropic

热门

Fetch 是 MCP 官方参考服务器,让 AI 能抓取网页并转为 Markdown 格式。

这个服务器解决了 AI 直接处理网页内容时格式混乱的问题,适合需要让 Claude 分析在线文档或新闻的开发者。不过作为参考实现,它缺乏生产级的安全配置,你得自己处理反爬虫和隐私风险。

搜索与获取
89.8k

Brave 搜索

编辑精选

by Anthropic

热门

Brave Search 是让 Claude 直接调用 Brave 搜索 API 获取实时网络信息的 MCP 服务器。

如果你想让 AI 助手帮你搜索最新资讯或技术文档,这个工具能绕过传统搜索的限制,直接返回结构化数据。特别适合需要实时信息的开发者,比如查 API 更新或竞品动态。不过它依赖 Brave 的 API 配额,高频使用可能受限。

搜索与获取
89.7k

by Anthropic

热门

Puppeteer 是让 Claude 自动操作浏览器进行网页抓取和测试的 MCP 服务器。

这个服务器解决了手动编写 Puppeteer 脚本的繁琐问题,适合需要自动化网页交互的开发者,比如抓取动态内容或做端到端测试。不过,作为参考实现,它可能缺少生产级的安全防护,建议在可控环境中使用。

搜索与获取
89.2k

评论