gsc-mcp-server

gsc-mcp-server

Enables Claude to access Google Search Console data including search performance, URL indexation, sitemaps, and built-in SEO analysis tools such as trending queries, cannibalization detection, and traffic drop diagnostics.

Category
访问服务器

README

Google Search Console MCP Server

An MCP server that gives Claude direct access to your Google Search Console data — search performance, URL indexation, sitemaps, and built-in SEO analysis tools including trending queries, cannibalization detection, traffic drop diagnostics, and automated query/page grouping.

Prerequisites

  • Node.js >= 18.0.0
  • A C++ compiler (required by the better-sqlite3 dependency):
Platform Install
macOS xcode-select --install
Windows Visual Studio Build Tools — select "Desktop development with C++"
Linux (Debian/Ubuntu) sudo apt-get install build-essential python3
Linux (Fedora/RHEL) sudo dnf groupinstall "Development Tools" && sudo dnf install python3

Quick Start

git clone https://github.com/serpfire/gsc-mcp-server.git
cd gsc-mcp-server
npm install

1. Create Google OAuth credentials

  1. Go to Google Cloud Console
  2. Create an OAuth 2.0 Client ID (type: Desktop app)
  3. Enable the Google Search Console API in your project

2. Authenticate

GSC_OAUTH_CLIENT_ID=your-client-id \
GSC_OAUTH_CLIENT_SECRET=your-client-secret \
npm run setup

This opens your browser to sign in with Google. Tokens are stored at ~/.gsc-mcp/tokens.json and auto-refresh. Run setup again anytime to switch accounts.

3. Add to Claude Code

claude mcp add --transport stdio gsc -s user \
  -e GSC_OAUTH_CLIENT_ID=your-client-id \
  -e GSC_OAUTH_CLIENT_SECRET=your-client-secret \
  -- node /absolute/path/to/gsc-mcp-server/src/index.js

Or manually add to ~/.claude.json:

{
  "mcpServers": {
    "gsc": {
      "type": "stdio",
      "command": "node",
      "args": ["/absolute/path/to/gsc-mcp-server/src/index.js"],
      "env": {
        "GSC_OAUTH_CLIENT_ID": "your-client-id",
        "GSC_OAUTH_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

Service Account Alternative

For automation or server-to-server use:

{
  "env": {
    "GSC_AUTH_MODE": "service_account",
    "GSC_SERVICE_ACCOUNT_KEY_PATH": "/path/to/key.json"
  }
}

Tools

Core GSC Tools

Tool Description
list_sites List all verified GSC properties
get_site Get details for a specific site
query_search_analytics Query clicks, impressions, CTR, position with dimensions/filters/pagination
inspect_url Check URL index/crawl status (2,000/day limit)
list_sitemaps List sitemaps for a site
get_sitemap Get sitemap details
submit_sitemap Submit a new sitemap
delete_sitemap Remove a sitemap from GSC
switch_account Re-authenticate with a different Google account (OAuth only)

Data Sync

Tool Description
sync_search_data Fetch all performance data into local SQLite cache. Incremental by default. Required before analysis tools.

Analysis Tools

Tool Description
find_low_hanging_fruit Find queries ranking 2-20 with high impressions but low CTR, scored by untapped potential
detect_cannibalization Detect queries ranking on 2+ URLs using HHI scoring with action recommendations
find_trending_queries Find queries with biggest growth/decline (period-over-period or year-over-year)
find_trending_pages Find pages with biggest growth/decline with impact scoring
analyze_traffic_drop Diagnose traffic drops across 5 views: site-level, GBP vs organic, groups, segments, brand vs non-brand
get_group_performance Aggregated metrics broken down by named groups with share percentages

Group Management

Tool Description
create_group Create a group with OR/AND/NOT regex rules for URL segments or query groups
list_groups List all groups, optionally filtered by dimension
get_group Get group details including rules
update_group Update group description and/or rules
delete_group Delete a group and its rules
test_group Test a group against cached data — match count, rate, samples

Auto-Discovery

Tool Description
discover_query_groups Auto-cluster queries using word overlap, n-gram similarity, and page co-occurrence
promote_cluster_to_group Convert a discovered cluster into a named group
auto_segment_pages Auto-create URL segment groups from page URL patterns
auto_group_queries Auto-create query groups: brand, topic n-grams, intent modifiers

Resources

URI Description
sites://list All verified sites (auto-discovery)

Prompts

Name Description
seo_performance_analysis Guided full SEO review (queries, pages, devices, trends)
index_coverage_check Systematic URL indexation report

Example Queries

  • "List my Search Console sites"
  • "Show top 20 queries for sc-domain:example.com last 7 days"
  • "Compare mobile vs desktop for https://example.com/"
  • "Check if https://example.com/new-page is indexed"
  • "Show sitemaps for sc-domain:example.com"
  • "Sync data for sc-domain:example.com and find low-hanging fruit"
  • "Detect keyword cannibalization on sc-domain:example.com"
  • "Show trending queries for sc-domain:example.com last 28 days"
  • "Auto-create query groups for sc-domain:example.com"

Architecture

src/
├── index.js                          # Entry: auth -> client -> db -> server -> stdio
├── server.js                         # McpServer factory
├── auth/
│   ├── index.js                      # Auth factory (auto-detects mode from env)
│   ├── service-account.js            # Service account key file auth
│   ├── oauth.js                      # Browser flow + token persistence + auto-recovery
│   ├── token-store.js                # ~/.gsc-mcp/tokens.json
│   └── setup.js                      # Standalone setup script
├── gsc/                              # Pure GSC API wrappers (no MCP knowledge)
│   ├── client.js
│   ├── sites.js
│   ├── search-analytics.js
│   ├── sitemaps.js
│   └── url-inspection.js
├── db/
│   ├── connection.js                 # SQLite setup with WAL mode
│   └── schema.js                     # Migrations
├── analysis/                         # SEO analysis engine (uses local SQLite)
│   ├── sync.js                       # GSC API -> SQLite incremental sync
│   ├── low-hanging-fruit.js          # Opportunity scoring
│   ├── cannibalization.js            # HHI-based detection
│   ├── trending.js                   # PoP / YoY trending queries & pages
│   ├── traffic-drop.js              # Multi-view drop diagnostics
│   ├── group-performance.js          # Group-level aggregation
│   ├── auto-segment.js              # Automatic URL segmentation
│   ├── auto-group.js                # Automatic query grouping
│   ├── shared.js                     # Shared SQL helpers
│   ├── groups/
│   │   ├── manager.js                # CRUD for groups + rules
│   │   ├── compiler.js               # OR/AND/NOT rule compilation
│   │   └── matcher.js                # Regex matching engine
│   └── semantic/
│       ├── discover.js               # Cluster discovery orchestrator
│       ├── clustering.js             # Connected components algorithm
│       ├── similarity.js             # Multi-signal similarity scoring
│       └── labeler.js                # Cluster naming
├── tools/
│   ├── definitions.js                # Core GSC tools (declarative)
│   ├── analysis-definitions.js       # Analysis tools (declarative)
│   ├── middleware.js                  # Rate limiting + error handling wrapper
│   ├── auth.js                       # switch_account tool
│   └── index.js                      # Registration loop
├── resources.js                      # sites://list resource
├── prompts.js                        # SEO analysis + index check prompts
└── utils/
    ├── logger.js                     # stderr-only (stdout = MCP protocol)
    ├── errors.js                     # Google API error -> MCP error
    ├── constants.js                  # Scopes, rate limits, defaults
    ├── rate-limiter.js               # Sliding window
    └── open-url.js                   # Cross-platform browser opener

Two-layer separation: gsc/ knows nothing about MCP. tools/ knows nothing about Google's API. analysis/ operates on local SQLite data. Each layer is independently testable.

Environment Variables

Variable Required Default Description
GSC_AUTH_MODE No Auto-detected oauth or service_account. Auto-detected from which credentials are set.
GSC_OAUTH_CLIENT_ID OAuth OAuth client ID
GSC_OAUTH_CLIENT_SECRET OAuth OAuth client secret
GSC_OAUTH_REFRESH_TOKEN No Skip browser flow with a pre-existing token
GSC_SERVICE_ACCOUNT_KEY_PATH Service acct Path to JSON key file
GSC_API_SCOPES No webmasters.readonly Override scopes (comma-separated)
GSC_LOG_LEVEL No info debug / info / warn / error
GSC_TOKEN_PATH No ~/.gsc-mcp/tokens.json Custom token storage path
GSC_DB_PATH No ~/.gsc-mcp/data.db Custom SQLite database path

Debugging

Launch the MCP Inspector for interactive testing:

npm run inspect

Windows note: The inspect script uses bash. Run it from Git Bash, WSL, or replace with:

npx @modelcontextprotocol/inspector node src/index.js

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选