Skip to main content
Glama
bwengr

Google Search Console MCP Server

by bwengr

Google Search Console MCP 服务器

从任何支持 MCP 协议的 AI 助手查询 Google Search Console 数据——包括排名、点击量、展示次数和页面级表现。

前置要求

  • Node.js 18+

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

Related MCP server: Google Search Console + GA4 MCP Server

设置

1. 安装依赖

npm install

2. 创建 Google Cloud 项目

  1. 前往 Google Cloud Console

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

  3. 启用 Search Console API:

    • 前往 APIs & Services > Library

    • 搜索 "Search Console API"

    • 点击启用

3. 创建 OAuth2 凭据

  1. 前往 APIs & Services > Credentials

  2. 点击 Create Credentials > OAuth client ID

  3. 应用类型:Desktop app(或 Web application)

  4. 随意命名

  5. 复制 Client ID 和 Client Secret

4. 配置你的 .env 文件

cp .env.example .env

填入以下值:

变量

获取位置

GSC_SITE_URL

GSC 设置 > 关联 > Sc-domain (例如 sc-domain:bwengr.com)

GOOGLE_CLIENT_ID

Google Cloud Console > 凭据 (来自第 3 步)

GOOGLE_CLIENT_SECRET

Google Cloud Console > 凭据 (来自第 3 步)

5. 运行服务器

npm start

首次运行时,浏览器窗口会自动打开以完成 OAuth 认证。之后,令牌将存储在本地的 .tokens.json 中,你将不会再次被提示。

连接到你的 AI 助手

此服务器通过 stdio(标准输入/输出)进行通信,这是将 MCP 服务器连接到 AI 助手的标准方式。配置你的 AI 助手使用:

node /path/to/src/index.js

将 /path/to 替换为你机器上此项目的实际路径。

可用工具

getTopQueries

返回按点击量排名的热门搜索查询。

  • 参数: startDate (YYYY-MM-DD), endDate (YYYY-MM-DD), rowLimit (可选,默认 10)

  • 返回: 每行的查询词、点击量、展示次数、点击率 (CTR)、排名

getSiteSummary

返回网站整体搜索表现汇总。

  • 参数: startDate (YYYY-MM-DD), endDate (YYYY-MM-DD)

  • 返回: 总点击量、展示次数、点击率 (CTR)、平均排名

getPagePerformance

返回筛选至特定页面的表现数据。

  • 参数: pageUrl (GSC 中显示的精确 URL), startDate (YYYY-MM-DD), endDate (YYYY-MM-DD)

  • 返回: 该页面的点击量、展示次数、点击率 (CTR)、排名

getRankingChanges

查找两个时间段之间排名变化最大的页面。

  • 参数: days (要比较的天数,默认 28)

  • 返回: 页面 URL、排名变化、当前排名、之前排名

重要提示

切勿将 .env 或 .tokens.json 提交到版本控制系统。这些文件已通过 .gitignore 排除。

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.
    4,242 npm
    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
    A
    quality
    A
    maintenance
    Provides AI agents with read-only access to Google Search Console data, including search analytics, index coverage, and sitemap status. It enables users to query clicks, impressions, and ranking performance or check URL indexing status through natural language.
    4
    124 npm
    10
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Query Google Search Console search analytics, inspect URL indexing status, manage sitemaps, and analyze keyword performance. 13 tools covering search queries, page performance, sitemap management, and index coverage.
    13
    527 npm
    7
    MIT