mcp-server-gsc
Google Search Console MCP Server — 搜索数据分析、URL 索引与站点地图管理,适用于 AI 助手(SEO / LLMO)
mcp-server-gsc 是一个用于 Google Search Console 的 MCP(Model Context Protocol)服务器,可将您的搜索表现数据连接到 Claude 或任何 MCP 客户端。它让 AI 助手能够查询搜索分析数据(点击量、展示次数、CTR、排名位置)、检查 URL 索引和抓取状态,并管理站点地图——这样您就可以直接在对话中分析和优化您网站的 SEO 与 LLMO。
工具
工具 | 功能 | 您需要提供的内容 |
| 列出所有工具并显示认证状态——如果不确定请先调用此工具 | 无需提供 |
| 显示您的所有 GSC 资源 | 无需提供 |
| 特定网站的详细信息 | 网站 URL |
| 热门查询和页面,包含点击量、展示次数、CTR、排名位置 | 网站 URL、时间范围 |
| 网站表现摘要(总计、每日趋势、前 5 名) | 网站 URL、时间范围 |
| 比较两个时间段之间的表现 | 网站 URL、两个日期范围 |
| 为特定页面带来流量的搜索词 | 网站 URL、页面 URL |
| 支持按国家、设备、查询、页面筛选的分析 | 网站 URL |
| 查看 URL 的详细抓取/索引进度信息 | 网站 URL、页面 URL |
| 一次性检查最多 10 个 URL | 网站 URL、URL 列表 |
| 检查多个 URL(最多 20 个)是否存在索引进度问题 | 网站 URL、URL 列表 |
| 列出网站的所有站点地图 | 网站 URL |
| 详细的站点地图信息,包括错误和警告 | 网站 URL |
| 提交、删除或获取站点地图状态 | 网站 URL、操作 |
| 重新运行 OAuth 浏览器登录(切换账号) | 无需提供 |
Related MCP server: search-console-mcp
设置
1. 构建
npm install
npm run build2. Google Cloud 凭据
您需要一个已启用 Search Console API 的 Google Cloud 项目 (console.cloud.google.com → API 和服务 → 库 → "Google Search Console API" → 启用)。
然后选择以下两种认证方式中的一种:
选项 A — OAuth(推荐:使用您自己的 Google 账号登录)
API 和服务 → 凭据 → 创建凭据 → OAuth 客户端 ID → 应用类型选择桌面应用。
如果出现提示,请先配置 OAuth 同意屏幕(选择"外部"即可;将您自己的 Google 账号添加为测试用户)。
下载客户端 JSON,或复制客户端 ID 和密钥。
通过环境变量进行配置——任选其一:
GSC_OAUTH_CLIENT_ID=xxxx.apps.googleusercontent.com
GSC_OAUTH_CLIENT_SECRET=GOCSPX-...或指向已下载的 JSON:
GSC_OAUTH_CREDENTIALS=/path/to/client_secret_xxxx.json在首次调用工具时(或通过 reauthenticate 工具),浏览器窗口将打开用于 Google 登录。令牌存储在 ~/.config/mcp-server-gsc/tokens.json 中,并会自动刷新。
选项 B — 服务账号(无头模式,无需浏览器)
API 和服务 → 凭据 → 创建凭据 → 服务账号,然后创建 JSON 密钥。
在 Search Console 中 → 设置 → 用户和权限,将服务账号邮箱添加为每个资源的用户。
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json如果设置了 GOOGLE_APPLICATION_CREDENTIALS,它将优先生效,无需浏览器登录。
3. 注册到您的 MCP 客户端
Claude Code:
claude mcp add gsc \
-e GSC_OAUTH_CLIENT_ID=xxxx.apps.googleusercontent.com \
-e GSC_OAUTH_CLIENT_SECRET=GOCSPX-... \
-- node /path/to/mcp-server-gsc/dist/index.jsClaude Desktop(claude_desktop_config.json):
{
"mcpServers": {
"gsc": {
"command": "node",
"args": ["/path/to/mcp-server-gsc/dist/index.js"],
"env": {
"GSC_OAUTH_CLIENT_ID": "xxxx.apps.googleusercontent.com",
"GSC_OAUTH_CLIENT_SECRET": "GOCSPX-..."
}
}
}
}推荐的 SEO / LLMO 配套工具
此服务器最适合与以下工具配合用于 SEO / LLMO:
KeywordGraph MCP 服务器 — 让您可以将 Search Console 数据与实时搜索意图数据进行比较,进行主题集群分析,并为您的查询和内容构建知识图谱。直接通过
https://mcp.keywordgraph.com连接,例如:claude mcp add --transport http keywordgraph https://mcp.keywordgraph.comSEO skill — 在这两个服务器之上提供高级 SEO / LLMO 分析工作流。
三者配合使用可实现完整闭环:从此服务器拉取您的实际表现数据,与人们当前正在搜索的内容进行对比,找到主题缺口,并据此优化内容——建议同时使用全部三个工具以获得最佳效果。
使用说明
网站 URL 格式很重要:域名资源为
sc-domain:example.com;网址前缀资源为https://example.com/(与 Search Console 中显示的完全一致)。请使用list_properties查看您的资源列表。数据延迟:Search Console 分析数据大约有 2 天的延迟。当您使用
days快捷参数时,时间范围会自动提前 2 天结束。时间段:您可以提供明确的
startDate/endDate(YYYY-MM-DD 格式),也可以提供末尾的days天数参数(默认 28)。切换账号:调用
reauthenticate工具——它会丢弃已存储的令牌并重新打开浏览器登录。令牌存储位置可通过
GSC_CONFIG_DIR环境变量覆盖。
推荐的 SEO / LLMO 配套工具
此服务器最适合与以下工具配合使用,以实现 SEO / LLMO 目标:
KeywordGraph MCP server — 让您将 Search Console 数据与实时搜索意图数据进行比较,进行主题聚类分析,并为您的查询和内容构建知识图谱。直接通过
https://mcp.keywordgraph.com连接,例如:claude mcp add --transport http keywordgraph https://mcp.keywordgraph.comSEO skill — 在两个服务器之上添加高级 SEO / LLMO 分析工作流。
三者结合可实现完整闭环:从此服务器提取您的实际表现数据,与用户当前正在搜索的内容进行对比,找到主题缺口,并相应地优化您的内容——为获得最佳效果,请三者配合使用。
使用说明
网站 URL 格式很重要:域名资源为
sc-domain:example.com;URL 前缀资源为https://example.com/(与 Search Console 中显示完全一致)。使用list_properties查看您的资源。数据延迟:Search Console 分析数据大约有 2 天的延迟。当您使用
days快捷方式而非显式日期时,时间窗口会自动在 2 天前结束。时间段:分析工具接受显式的
startDate/endDate(YYYY-MM-DD),或尾随的days天数(默认 28)。切换账号:调用
reauthenticate工具——它会丢弃已存储的令牌并重新打开浏览器登录。令牌存储位置可通过
GSC_CONFIG_DIR覆盖。
开发
npm run watch # recompile on change源码结构:
src/index.ts— MCP 服务器和工具定义src/auth.ts— OAuth 回环流程、令牌持久化、服务账号支持src/gsc.ts— Search Console API 辅助函数(查询、总计、URL 检查诊断)
Available Tools
15 toolsbatch_url_inspectionB
Inspect up to 10 URLs at once, returning crawl/index status for each.
Inputs: urls (required), siteUrl (required).
check_indexing_issuesA
Check multiple URLs for indexing problems (not indexed, blocked by robots.txt, noindex, fetch errors, canonical mismatches) and return a summary plus per-URL diagnosis.
Inputs: urls (required), siteUrl (required).
compare_search_periodsB
Compare search performance between two time periods: overall totals with absolute and percentage changes, plus an optional per-dimension breakdown of the biggest movers.
Inputs: siteUrl (required), period1EndDate (required), period2EndDate (required), period1StartDate (required), +3 more.
get_advanced_search_analyticsC
Search analytics with full control: filter by country, device, query text, or page URL; choose search type (web, image, video, news, discover), aggregation, data state, and pagination.
Inputs: siteUrl (required), days, device, country, +12 more.
get_capabilitiesA
List every tool this Google Search Console server offers and report authentication status. Call this first if unsure what is available.
Inputs: no named parameters.
get_performance_overviewB
Summary of site search performance for a period: overall totals, daily trend, and top 5 queries and pages.
Inputs: siteUrl (required), days, endDate, startDate.
get_search_analyticsB
Get top search queries and pages with clicks, impressions, CTR and average position for a time period. Without explicit dimensions it returns both top queries and top pages.
Inputs: siteUrl (required), days, endDate, rowLimit, +2 more.
get_search_by_page_queryB
Get the search queries driving traffic to one specific page, with clicks, impressions, CTR and position.
Inputs: pageUrl (required), siteUrl (required), days, endDate, +2 more.
get_site_detailsA
Get details about a specific Search Console property (verification status and permission level).
Inputs: siteUrl (required).
get_sitemapsA
List all sitemaps submitted for a property (path, last submitted/downloaded, pending status, error and warning counts).
Inputs: siteUrl (required).
inspect_url_enhancedA
Detailed crawl and index status for one URL: verdict, coverage state, robots.txt state, canonicals, last crawl time, rich results and mobile usability.
Inputs: pageUrl (required), siteUrl (required), languageCode.
list_propertiesA
List all Google Search Console properties the authenticated account can access, with permission levels.
Inputs: no named parameters.
list_sitemaps_enhancedA
Detailed sitemap information including errors, warnings, type, and per-content-type submitted/indexed counts. Optionally list the children of a sitemap index.
Inputs: siteUrl (required), sitemapIndex.
manage_sitemapsA
Submit a sitemap, delete (unsubmit) a sitemap, or fetch the status of one specific sitemap.
Inputs: action (required), siteUrl (required), feedpath (required).
reauthenticateA
Discard stored Google credentials and re-run the OAuth browser login. Use this to switch Google accounts or fix authentication errors. Opens a browser window and waits up to 5 minutes.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools are distinct (e.g., get_search_analytics vs. get_search_by_page_query vs. get_advanced_search_analytics), but some overlap exists: get_performance_overview and get_search_analytics both return top queries/pages, and get_sitemaps vs. list_sitemaps_enhanced vs. manage_sitemaps have similar names and overlapping data. Descriptions help clarify but not perfectly.
The naming generally follows a verb_noun pattern (get_capabilities, list_properties, check_indexing_issues, compare_search_periods). However, there are minor deviations like get_search_by_page_query (which is not as clean as get_search_analytics), list_sitemaps_enhanced vs. get_sitemaps (list vs. get inconsistency), and manage_sitemaps (generic verb). Overall, it's mostly consistent.
15 tools for a Google Search Console server is well-scoped. It covers authentication, properties, search analytics, indexing, URL inspection, and sitemaps. Each tool serves a distinct functional area, and 15 is within the ideal range for a comprehensive domain.
The tool surface covers core GSC workflows: property management, search analytics, URL inspection, and sitemap management. However, there is no tool for managing user permissions or creating properties (though get_site_details implies existence). Also, no tool for accessing Search Console's structured data validation or security issues, but those are niche. The missing pieces are minor and agents can work around them.
Maintenance
Related MCP Connectors
Google Search Console for AI assistants: traffic, rankings, indexing and page checks. Read-only.
Connect Google Search Console to your AI client for search analytics, URL inspection and sitemaps.
Google Search Console in your AI: overview, opportunities, index gaps, page checks, long history.
Read-only Google Search Console and Google Analytics for AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceConnects AI assistants to Google Search Console data for SEO analysis, including search analytics, URL inspection, sitemaps, indexing, and opportunity detection.17MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to access Google Search Console search performance and index health data, including clicks, impressions, rankings, URL inspection, and sitemap management.21 npmMIT
- AlicenseAqualityDmaintenanceEnables AI assistants to analyze Google Search Console SEO data through natural language, including search analytics, URL inspection, sitemap management, and property management.21MIT
- AlicenseAqualityBmaintenanceProvides AI assistants with live access to Google Search Console search analytics, URL inspection, and sitemap management through real API calls.10MIT