Skip to main content
Glama
google-search-console-mcp

google-search-console-mcp

by lionkiii

Google Search Console MCP 服务器

npm version License: MIT google-searchconsole-mcp MCP server

这是一个 Model Context Protocol (MCP) 服务器,用于将 Google Search Console 连接到 Claude Desktop、Cursor、Windsurf 等 AI 助手以及任何兼容 MCP 的客户端。通过自然语言分析您的 SEO 数据、检查 URL、寻找关键词机会并跟踪搜索表现。

无需设置 Google Cloud。 安装并使用您的 Google 账号进行身份验证,即可在 2 分钟内开始查询您的 Search Console 数据。

您可以做什么?

向 Claude 询问如下问题:

  • “我本月表现最好的页面有哪些?”

  • “找出那些展示次数高但点击率 (CTR) 低的关键词”

  • “对比我本月与上个月的搜索表现”

  • “这个 URL 被索引了吗?有什么问题吗?”

  • “向我展示品牌流量与非品牌流量的占比”

Related MCP server: Google Search Console + GA4 MCP Server

快速入门

1. 安装

npm install -g google-searchconsole-mcp

2. 身份验证(仅需一次)

gsc-mcp-auth

这将打开您的浏览器 — 使用您的 Google 账号登录并授予 Search Console 读取权限。您的令牌将保存在本地的 ~/.gsc-mcp/tokens/ 目录下。您的数据保留在您的机器上。

多个账号:

gsc-mcp-auth --alias work
gsc-mcp-auth --alias personal
gsc-mcp-auth --list

3. 添加到 Claude Desktop

添加到您的 Claude Desktop 配置文件中(macOS 上位于 ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "google-search-console": {
      "command": "npx",
      "args": ["-y", "google-searchconsole-mcp"]
    }
  }
}

重启 Claude Desktop。完成 — 您的 Search Console 数据现在可以在 Claude 中使用了。

与其他 MCP 客户端配合使用

适用于任何兼容 MCP 的客户端,包括 Cursor、Windsurf、VS Code + Cline 等。只需将 MCP 客户端指向:

npx google-searchconsole-mcp

可用工具(13 个 SEO 工具)

工具

描述

list_accounts

列出所有已验证的 Google 账号及其 Search Console 站点

list_sites

列出您有权访问的所有 Search Console 资源

query_search_analytics

按任何维度(查询、页面、国家/地区、设备、日期)查询点击次数、展示次数、CTR 和排名

inspect_url

检查 URL 索引状态、移动设备易用性和富媒体搜索结果资格

list_sitemaps

列出所有已提交的站点地图及其状态

find_keyword_opportunities

发现高展示次数、低 CTR 的关键词 — 快速提升 SEO 效果

get_top_pages

获取按点击次数、展示次数、CTR 或排名排序的顶级页面

compare_performance

对比两个时间段(周环比、月环比)的搜索表现

analyze_brand_queries

分析品牌与非品牌自然流量的占比

get_keyword_trend

获取特定关键词的每日趋势数据

export_analytics

将搜索分析数据导出为 CSV 或 JSON

query_by_search_appearance

按搜索外观过滤结果:AMP、FAQ、HowTo、富媒体搜索结果、视频等

query_by_search_type

按搜索类型过滤:网页、图片、视频、新闻或 Discover

示例

示例 1:查找表现最好的页面

用户提示: “向我展示过去 30 天内按点击次数排名前 10 的页面”

预期行为:

  • 使用您的站点 URL、过去 30 天的日期范围、sortBy: "clicks" 和 limit: 10 调用 get_top_pages

  • 返回一个包含前 10 个页面的排名列表,以及每个页面的点击次数、展示次数、CTR 和平均排名

  • 帮助识别您最强的内容和高流量着陆页

示例 2:发现关键词优化机会

用户提示: “在 example.com 上找出展示次数高但点击率低的关键词”

预期行为:

  • 使用您的站点 URL 和 28 天的日期范围调用 find_keyword_opportunities

  • 筛选出展示次数超过 100 次且在排名前 20 位中 CTR 低于 3% 的查询

  • 返回一个关键词列表,通过优化标题、元描述或内容,这些关键词的点击量可能会显著增加

示例 3:检查 URL 是否被 Google 索引

用户提示: “检查 https://example.com/blog/my-new-post 是否已被索引”

预期行为:

  • 使用站点资源和完整的 URL 调用 inspect_url

  • 返回索引状态(已索引、已抓取但未索引、未找到等)、上次抓取日期、移动设备易用性状态以及检测到的任何富媒体搜索结果

  • 识别阻止索引的问题,例如 robots.txt 屏蔽、noindex 标签或抓取错误

示例 4:对比本月与上月表现

用户提示: “对比 example.com 本月与上月的搜索表现”

预期行为:

  • 使用当前月和上个月的日期范围调用 compare_performance

  • 返回点击次数增减幅度最大的查询,并提供点击次数、展示次数、CTR 和排名的增量值

  • 突出显示趋势关键词和下滑页面,以便优先进行优化

使用场景

  • SEO 表现监控 — 跟踪点击次数、展示次数、CTR 和平均排名的变化趋势

  • 关键词研究与机会 — 查找您已获得排名但展示次数高、CTR 低的关键词

  • 内容优化 — 根据搜索数据识别哪些页面需要改进

  • 技术 SEO 审计 — 检查 URL 索引状态、站点地图健康状况和移动设备易用性

  • 竞争分析 — 对比不同时期的表现以发现趋势和下滑点

  • 报告 — 导出数据用于 SEO 报告和仪表板

  • 品牌监控 — 跟踪品牌与非品牌搜索流量

身份验证的工作原理

此软件包内置了 OAuth 凭据 — 您无需创建 Google Cloud 项目。当您运行 gsc-mcp-auth 时:

  1. 您的浏览器会打开 Google 登录页面

  2. 您使用您的 Google 账号登录

  3. 您授予对您的 Search Console 数据的只读访问权限

  4. 令牌保存在您机器的本地 (~/.gsc-mcp/tokens/)

您的数据永远不会离开您的机器。 OAuth 凭据仅用于标识应用程序 — 每个用户单独进行身份验证,并且只能访问其自己的 Search Console 数据。

进阶:使用您自己的 OAuth 凭据

如果您更喜欢使用自己的 Google Cloud 项目:

选项 A:环境变量

export GSC_CLIENT_ID="your-client-id"
export GSC_CLIENT_SECRET="your-client-secret"

选项 B:凭据文件 将您的 OAuth 凭据 JSON 保存到 ~/.gsc-mcp/credentials.json

  1. 前往 Google Cloud Console

  2. 创建一个项目(或选择现有项目)

  3. 启用 Google Search Console API

  4. 前往 凭据 > 创建凭据 > OAuth 2.0 客户端 ID

  5. 选择 桌面应用 作为应用程序类型

  6. 下载凭据 JSON 文件

要求

  • Node.js >= 18

  • 拥有访问 Google Search Console 的 Google 账号

相关资源

隐私政策

请参阅 PRIVACY.md 获取完整的隐私政策。

简而言之: 此扩展程序在您的机器上本地运行。OAuth 令牌存储在本地的 ~/.gsc-mcp/ 中,所有 Search Console 数据均直接从 Google 的 API 查询,不经过任何中介。此 MCP 服务器不会收集、存储或向任何第三方传输任何数据。

许可证

MIT

Available Tools

13 tools
analyze_brand_queriesB
Read-onlyIdempotent

Analyze branded vs non-branded search queries. Shows what percentage of traffic comes from brand searches.

Inputs: siteUrl (required), startDate (required), endDate (required), brandTerms (required), +1 more.

compare_performanceB
Read-onlyIdempotent

Compare search performance between two time periods. Shows which queries/pages gained or lost traffic.

Inputs: siteUrl (required), currentStartDate (required), currentEndDate (required), previousStartDate (required), +4 more.

export_analyticsB
Read-onlyIdempotent

Export search analytics data as CSV or JSON format for external analysis or reporting.

Inputs: siteUrl (required), startDate (required), endDate (required), dimensions (required), +4 more.

find_keyword_opportunitiesA
Read-onlyIdempotent

Find keyword optimization opportunities - queries with high impressions but low CTR that could be improved.

Inputs: siteUrl (required), startDate (required), endDate (required), account, +3 more.

get_keyword_trendB
Read-onlyIdempotent

Get the performance trend of a specific keyword over time. Shows daily clicks, impressions, and position changes.

Inputs: siteUrl (required), keyword (required), startDate (required), endDate (required), +1 more.

get_top_pagesB
Read-onlyIdempotent

Get top performing pages sorted by clicks, impressions, CTR, or position.

Inputs: siteUrl (required), startDate (required), endDate (required), account, +2 more.

inspect_urlA
Read-onlyIdempotent

Inspect a URL to check its indexing status, mobile usability, and rich results. Shows if Google can crawl and index the page.

Inputs: siteUrl (required), inspectionUrl (required), account.

list_accountsA
Read-onlyIdempotent

List all authenticated Google accounts and their associated GSC sites.

Inputs: no named parameters.

list_sitemapsA
Read-onlyIdempotent

List all sitemaps submitted for a site in Google Search Console.

Inputs: siteUrl (required), account.

list_sitesA
Read-onlyIdempotent

List all sites you have access to in Google Search Console. When multiple accounts exist and no account is specified, shows all accounts' sites grouped by account.

Inputs: account.

query_by_search_appearanceA
Read-onlyIdempotent

Query analytics filtered by search appearance type (AMP, Rich Results, Video, FAQ, etc.).

Inputs: siteUrl (required), startDate (required), endDate (required), searchAppearance (required), +2 more.

query_by_search_typeB
Read-onlyIdempotent

Query analytics filtered by search type: web, image, video, news, or discover.

Inputs: siteUrl (required), startDate (required), endDate (required), searchType (required), +3 more.

query_search_analyticsB
Read-onlyIdempotent

Query Google Search Console search analytics data. Returns search queries, clicks, impressions, CTR, and average position.

Inputs: siteUrl (required), startDate (required), endDate (required), account, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 13 tools

    Disambiguation4/5

    Tools are well-differentiated by function, though the three 'query_' prefixed tools (query_search_analytics, query_by_search_type, query_by_search_appearance) serve related purposes and require careful reading to select the appropriate filter. All other tools have distinct, non-overlapping domains such as URL inspection, sitemap listing, and brand analysis.

    Naming Consistency4/5

    Consistent snake_case format throughout with descriptive verb_noun patterns (e.g., analyze_brand_queries, export_analytics, inspect_url). Minor deviation with 'query_by_' prepositional structure for two tools, but this remains predictable and readable.

    Tool Count5/5

    Thirteen tools is ideal for Google Search Console analytics coverage—sufficient to handle diverse querying needs (time comparisons, keyword trends, search appearances) without becoming overwhelming. Each tool addresses a specific analytical use case.

    Completeness4/5

    Excellent coverage of GSC analytics workflows including performance comparison, keyword opportunity detection, and multi-dimensional querying. Minor gaps in site management operations (no submit_sitemap or request_indexing tools), but core data retrieval and URL inspection capabilities are fully represented.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides access to Google Search Console to retrieve and analyze search performance data including queries, pages, and rankings. It enables users to perform rich data analysis through customizable reporting periods and dimensions using the Search Console API.
      MIT
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables querying Google Search Console and Google Analytics 4 data to retrieve search performance and site analytics. It provides tools for listing web properties and running detailed reports using secure Google OAuth authentication.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables querying Google Search Console data including rankings, clicks, and impressions for websites. Provides tools for analyzing search performance, top queries, page metrics, and ranking changes.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Google Search Console for agents: search analytics by query, page, country, and device, plus a striking-distance report for queries ranking just off page one. Also lists, submits, and removes sitemaps and inspects URLs for index status, last crawl, and canonical.
      7
      54 npm
      MIT