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.
Installation
uvx (recommended, zero-install)
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
pip install mcp-google-search-console-crunchtools
Container (Podman/Docker)
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 authenticates to Google using OAuth2 with a refresh token. This is a one-time setup — once you have the three credentials, you store them as environment variables and never need to touch OAuth again.
What you need
| Credential | What it is | Where it comes from |
|---|---|---|
GSC_CLIENT_ID | Identifies your OAuth app to Google | Google Cloud Console |
GSC_CLIENT_SECRET | Secret key for your OAuth app | Google Cloud Console |
GSC_REFRESH_TOKEN | Long-lived token that lets the server get access tokens | One-time browser consent flow |
Step 1: Create a Google Cloud OAuth App
- Go to Google Cloud Console
- Create a new project (or select an existing one)
- Navigate to APIs & Services > Library
- Search for Google Search Console API and click Enable
- Navigate to APIs & Services > Credentials
- Click + CREATE CREDENTIALS > OAuth client ID
- 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
- Back on Create OAuth client ID:
- Application type: Desktop app
- Name: anything (e.g., "MCP Search Console Desktop")
- Click Create — copy the Client ID and Client Secret
Step 2: Get a Refresh Token
Run this in your terminal to start the consent flow:
# Set your credentials from Step 1
export GSC_CLIENT_ID="your_client_id_here"
export GSC_CLIENT_SECRET="your_client_secret_here"
# Generate the authorization URL
echo "Open this URL in your browser:"
echo ""
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"
- Open the printed URL in your browser
- Sign in with the Google account that owns your Search Console properties
- Click Allow to grant Search Console access
- The browser will redirect to
http://127.0.0.1/?code=XXXX&scope=... - This page will fail to load — that's expected. Copy the
code=value from the URL bar (everything betweencode=and&scope)
Now exchange the authorization code for a refresh token:
# Paste the code value from the URL bar (the part between code= and &scope)
AUTH_CODE="paste_your_code_here"
curl -s -X POST https://oauth2.googleapis.com/token \
-d "client_id=${GSC_CLIENT_ID}" \
-d "client_secret=${GSC_CLIENT_SECRET}" \
-d "code=${AUTH_CODE}" \
-d "grant_type=authorization_code" \
-d "redirect_uri=http://127.0.0.1" | python3 -m json.tool
The response will include a refresh_token field — copy it. This is the long-lived credential that lets the server authenticate without a browser.
Note: If you don't see
refresh_tokenin the response, add&prompt=consentto the authorization URL and try again. Google only returns the refresh token on the first consent or when explicitly prompted.
Step 3: Store the Credentials
Create an env file:
cat > ~/.config/mcp-env/mcp-google-search-console.env << 'EOF'
GSC_CLIENT_ID=your_client_id
GSC_CLIENT_SECRET=your_client_secret
GSC_REFRESH_TOKEN=your_refresh_token
EOF
chmod 600 ~/.config/mcp-env/mcp-google-search-console.env
How it works at runtime
The server never stores or manages tokens on disk. On each API call:
- Server sends the refresh token to Google's token endpoint
- Google returns a short-lived access token (valid ~1 hour)
- Server uses the access token for the Search Console API call
- Access tokens are cached in memory and refreshed automatically when they expire
The refresh token itself never expires unless you explicitly revoke it in your Google Account permissions.
Available Tools (10)
| Category | Count | Tools |
|---|---|---|
| Sites | 4 | list_sites, get_site, add_site, delete_site |
| Search Analytics | 1 | query_search_analytics |
| Sitemaps | 4 | list_sitemaps, get_sitemap, submit_sitemap, delete_sitemap |
| URL Inspection | 1 | inspect_url |
Security
- OAuth2 credentials stored as
SecretStr(never logged) - Environment-variable-only credential storage
- 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
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
常见问题
MCP Google Search Console 是什么?
面向 Google Search Console 的安全 MCP 服务器,支持 analytics、sitemaps 与 URL inspection。
相关 Skills
股票投研框架
by alondai
股票投研9点分析框架,覆盖基本面/财务/竞品/估值/宏观/情绪等维度
SEO审计工具
by amdf01-debug
智能浏览器
by ayakolin
A fast Rust-based headless browser automation CLI with Node.js fallback that enables AI agents to navigate, click, type, and snapshot pages via structured commands. (Chinese localized version)
相关 MCP Server
网页抓取
编辑精选by Anthropic
Fetch 是 MCP 官方参考服务器,让 AI 能抓取网页并转为 Markdown 格式。
✎ 这个服务器解决了 AI 直接处理网页内容时格式混乱的问题,适合需要让 Claude 分析在线文档或新闻的开发者。不过作为参考实现,它缺乏生产级的安全配置,你得自己处理反爬虫和隐私风险。
Brave 搜索
编辑精选by Anthropic
Brave Search 是让 Claude 直接调用 Brave 搜索 API 获取实时网络信息的 MCP 服务器。
✎ 如果你想让 AI 助手帮你搜索最新资讯或技术文档,这个工具能绕过传统搜索的限制,直接返回结构化数据。特别适合需要实时信息的开发者,比如查 API 更新或竞品动态。不过它依赖 Brave 的 API 配额,高频使用可能受限。
Puppeteer 浏览器控制
编辑精选by Anthropic
Puppeteer 是让 Claude 自动操作浏览器进行网页抓取和测试的 MCP 服务器。
✎ 这个服务器解决了手动编写 Puppeteer 脚本的繁琐问题,适合需要自动化网页交互的开发者,比如抓取动态内容或做端到端测试。不过,作为参考实现,它可能缺少生产级的安全防护,建议在可控环境中使用。