search-console-mcp
MCP server for Google Search Console, enabling querying site performance, URL inspection, sitemaps, and more via typed tools with OAuth authentication.
README
search-console-mcp
Superfast, stdio-first MCP server for Google Search Console with:
- Fast startup
- Typed tool inputs
- In-memory TTL caching + request coalescing
- OAuth 2.0 refresh-token authentication
Features
Available MCP tools:
list_sitesquery_performanceinspect_urllist_sitemapsget_sitemap
Requirements
- Node.js 20+
- pnpm 9+
- Google Search Console property access
- OAuth client credentials + refresh token
Quick Start (Plug & Play)
- Get your refresh token (one-time setup):
pnpm install
pnpm auth
This will:
- Prompt for your Client ID and Secret
- Open your browser for authorization
- Save credentials to
.envautomatically
- Build and run:
pnpm build
pnpm start
That's it! The server reads credentials from .env automatically.
Getting Credentials
Step 1: Create OAuth Client ID on Google Cloud Console
- Go to Google Cloud Console
- Create a new project (or use an existing one)
- Enable the Google Search Console API:
- Navigate to "APIs & Services" → "Library"
- Search for "Google Search Console API"
- Click "Enable"
- Create OAuth 2.0 credentials:
- Go to "APIs & Services" → "Credentials"
- Click "Create Credentials" → "OAuth client ID"
- Choose "Desktop application" or "Web application"
- Add redirect URI:
http://localhost:9876(unique port to avoid conflicts) - Copy the Client ID and Client Secret
Step 2: Get Refresh Token
Easiest way — use the built-in script:
pnpm install
pnpm auth
This will:
- Prompt for Client ID and Secret
- Open your browser for authorization
- Automatically save to
.env
Manual alternative if needed — use Google's OAuth 2.0 Playground:
- Configure the OAuth Client ID (gear icon)
- Use scope:
https://www.googleapis.com/auth/webmasters - Authorize and copy the refresh token
Step 3: Find Your Search Console Site URL
- Go to Google Search Console
- Select your property
- In the URL bar, you'll see a property like:
sc-domain:example.com(domain property)https://example.com(URL prefix property)
- Copy this value as your
GSC_SITE_URL
Setup
After pnpm auth creates your .env, you're ready to go:
pnpm build
pnpm start
The server automatically reads GSC_CLIENT_ID, GSC_CLIENT_SECRET, GSC_REFRESH_TOKEN, and GSC_SITE_URL from .env.
Manual .env Setup (optional)
If you prefer to create .env manually:
cat > .env << 'EOF'
GSC_CLIENT_ID="your-client-id"
GSC_CLIENT_SECRET="your-client-secret"
GSC_REFRESH_TOKEN="your-refresh-token"
GSC_SITE_URL="sc-domain:example.com"
GSC_CACHE_TTL_MS="30000"
GSC_HTTP_TIMEOUT_MS="12000"
GSC_HTTP_RETRIES="2"
EOF
Then run:
pnpm build
pnpm start
Docker
Build image:
docker build -t search-console-mcp .
Run with .env file (easiest):
docker run --rm -i --env-file .env search-console-mcp
Or pass env vars directly:
docker run --rm -i \
-e GSC_CLIENT_ID="your-client-id" \
-e GSC_CLIENT_SECRET="your-client-secret" \
-e GSC_REFRESH_TOKEN="your-refresh-token" \
-e GSC_SITE_URL="sc-domain:example.com" \
search-console-mcp
AI Agent Integration
Claude Desktop
Option 1: Docker via local MCP config (Recommended)
This is the most reliable Claude Desktop setup: no custom connector UI, no remote URL, no TLS hassle.
- Build image:
docker build -t search-console-mcp .
- Add this to Claude Desktop config (
~/Library/Application Support/Claude/claude_desktop_config.jsonon macOS):
{
"mcpServers": {
"search-console": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--env-file",
"/absolute/path/search-console-mcp/.env",
"search-console-mcp"
]
}
}
}
Example absolute path:
/Users/devbyray/Projects/devbyrayray/search-console-mcp/.env
- Restart Claude Desktop.
Option 2: Local Node.js process (stdio)
{
"mcpServers": {
"search-console": {
"command": "bash",
"args": ["-c", "cd /absolute/path/search-console-mcp && source .env && pnpm start"]
}
}
}
Option 3: Custom Connector UI (remote MCP URL)
Use this only when you have a real remote endpoint.
- URL must be
https://.../mcp - Certificate must be trusted by Claude (public CA certificate)
localhost+ self-signed certificates may fail in Custom Connector mode
For local development, prefer Option 1 or 2.
Claude Code (VS Code Extension)
Create .env.local in your project, then add to VS Code settings:
{
"claude.mcpServers": {
"search-console": {
"command": "bash",
"args": ["-c", "cd /absolute/path/search-console-mcp && source .env && node dist/index.js"]
}
}
}
GitHub Copilot
Best approach: Use .env with the server:
source .env && pnpm start
Then configure Copilot CLI to connect to the running server.
Docker Integration for AI Agents
For containerized deployments, use .env:
docker build -t search-console-mcp .
docker run --rm -i --env-file .env search-console-mcp
Other MCP Clients
All MCP clients can read .env files. Example configuration structure:
{
"command": "bash",
"args": ["-c", "cd /path/to/search-console-mcp && source .env && node dist/index.js"]
}
Or pass env vars directly from your .env file to the client configuration.
MCP Client Configuration Example
Generic reference (use .env for actual values):
{
"mcpServers": {
"search-console": {
"command": "node",
"args": ["/absolute/path/search-console-mcp/dist/index.js"],
"env": {
"GSC_CLIENT_ID": "your-client-id",
"GSC_CLIENT_SECRET": "your-client-secret",
"GSC_REFRESH_TOKEN": "your-refresh-token",
"GSC_SITE_URL": "sc-domain:example.com"
}
}
}
}
OAuth Refresh Token Notes
Use any OAuth 2.0 flow that produces a Google refresh token for the same client ID/secret pair. The server only needs the refresh token and will rotate access tokens automatically.
Development
pnpm dev
Tests:
pnpm test
Lint:
pnpm lint
Troubleshooting
Missing required environment variable: check all requiredGSC_*vars.token_refresh_failed: verify OAuth client ID/secret and refresh token pair.google_api_errorwith403: verify account access to the requested property.429/5xx: retries are automatic; reduce request volume or increase interval between calls.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。