gsc-mcp-server

gsc-mcp-server

MCP server for Google Search Console, enabling querying search performance, listing properties, and inspecting URL indexing status from MCP-compatible clients.

Category
访问服务器

README

gsc-mcp-server

npm version

MCP server for Google Search Console. Query search performance, list properties, inspect URLs, and list sitemaps from Cursor, Claude Desktop, or any MCP-compatible client.

npm: @jlnkrth/gsc-mcp-server

Use the scoped package name @jlnkrth/gsc-mcp-server. The unscoped name gsc-mcp-server on npm is a different package.

Quick start

Situation Auth Run MCP server
Cloned this repo (inside project folder) npm run auth npm start
Installed from npm (any other directory) npx -y -p @jlnkrth/gsc-mcp-server gsc-mcp-auth npx -y @jlnkrth/gsc-mcp-server

Set GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET before auth (see Google Cloud setup).

Using a Google passkey to sign in? That's fine — passkey only applies to signing into Google in the browser during auth. You still need your own GCP OAuth client ID and secret.

Tools

Tool Description
gsc_list_sites List Search Console properties accessible to your Google account
gsc_search_analytics Query clicks, impressions, CTR, and position with dimensions and filters
gsc_inspect_url Inspect a URL's index status, crawl state, and mobile usability
gsc_list_sitemaps List submitted sitemaps with status, errors, and indexed counts

gsc_search_analytics filters

Parameter Description
query_filter Shorthand: queries containing this string
page_filter Shorthand: page URLs containing this string
dimension_filters Full GSC filter objects (advanced)

Prerequisites

  • Node.js 18+
  • A Google Cloud project with the Search Console API enabled
  • An OAuth 2.0 Desktop client (client ID + secret)
  • A Google account with access to the Search Console properties you want to query

Google Cloud setup

  1. Go to Google Cloud Console.
  2. Create or select a project.
  3. Open APIs & Services → Library and enable Google Search Console API.
  4. Open APIs & Services → OAuth consent screen — configure the consent screen. If the app is in Testing mode, add your Google account under Test users or sign-in will fail.
  5. Open APIs & Services → Credentials → Create Credentials → OAuth client ID.
  6. Application type: Desktop app.
  7. Add http://localhost:3336/callback as an authorized redirect URI (if prompted).
  8. Copy the Client ID and Client secret.

Install and authenticate

From npm

export GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com"
export GOOGLE_CLIENT_SECRET="your-client-secret"

npx -y -p @jlnkrth/gsc-mcp-server gsc-mcp-auth

From source

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

cp .env.example .env
# Edit .env with your credentials, then:
export $(grep -v '^#' .env | xargs)
npm run auth

The auth flow opens a browser on port 3336. Tokens are saved to ~/.config/gsc-mcp/tokens.json by default (override with GSC_TOKEN_PATH).

MCP client configuration

Cursor

Add to ~/.cursor/mcp.json (merge with existing servers):

{
  "mcpServers": {
    "google-search-console": {
      "command": "npx",
      "args": ["-y", "@jlnkrth/gsc-mcp-server"],
      "env": {
        "GOOGLE_CLIENT_ID": "YOUR_CLIENT_ID",
        "GOOGLE_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
        "GSC_TOKEN_PATH": "/Users/you/.config/gsc-mcp/tokens.json"
      }
    }
  }
}

Keep mcp.json private — it contains your OAuth client secret. Do not commit it to git.

For local development, point command at Node directly:

{
  "mcpServers": {
    "google-search-console": {
      "command": "node",
      "args": ["/absolute/path/to/gsc-mcp-server/src/index.js"],
      "env": {
        "GOOGLE_CLIENT_ID": "YOUR_CLIENT_ID",
        "GOOGLE_CLIENT_SECRET": "YOUR_CLIENT_SECRET"
      }
    }
  }
}

See examples/cursor-mcp.json.

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json on macOS (see examples/claude-desktop.json).

After changing MCP config, fully quit and restart your client so the server reloads tokens.

Example prompts

Once connected, you can ask your AI assistant:

  • "List my Search Console properties"
  • "What are the top 20 queries by clicks for https://example.com/ in the last 28 days?"
  • "Show me blog pages with the most impressions last week" (use page_filter)
  • "Is https://example.com/blog/my-post indexed?"
  • "List sitemaps for sc-domain:example.com"

Environment variables

Variable Required Description
GOOGLE_CLIENT_ID Yes OAuth 2.0 Desktop client ID
GOOGLE_CLIENT_SECRET Yes OAuth 2.0 Desktop client secret
GSC_TOKEN_PATH No Token file path (default: ~/.config/gsc-mcp/tokens.json)
GOOGLE_LOGIN_HINT No Pre-fill email in the OAuth browser sign-in

Troubleshooting

Symptom Fix
Not authenticated Run npx -y -p @jlnkrth/gsc-mcp-server gsc-mcp-auth (or npm run auth if inside a clone), then restart your MCP client
npx fails inside cloned repo Use npm run auth / npm start locally, or run npx from another directory
Google sign-in fails / access denied If OAuth app is in Testing mode, add your Google account as a test user in GCP
No refresh_token in saved tokens Revoke the app at Google Account permissions, then re-run auth
Port 3336 in use Free the port or stop the conflicting process, then re-run auth
403 / permission denied on API calls Confirm the signed-in Google account has access to the property in Search Console
MCP client can't find npx Use the full path to node and src/index.js in your config
Google OAuth fails after passkey sign-in GOOGLE_CLIENT_ID / SECRET must be real GCP values — not placeholders. Check redirect URI http://localhost:3336/callback

Related MCP servers

Contributing

See CONTRIBUTING.md for local development, tests, and publishing.

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选