Google Webmaster MCP
Enables AI agents to manage Google Tag Manager, Google Search Console, and Google Analytics (GA4) through unified access to tags, search performance data, URL inspection, sitemaps, and analytics reporting.
README
Google Webmaster MCP
A Unified Model Context Protocol (MCP) server for managing Google Tag Manager (GTM), Google Search Console (GSC), and Google Analytics (GA4).
This tool allows AI agents (like Claude, Cursor, etc.) to interact with your Google Webmaster tools directly, enabling automated auditing, tag management, and reporting.
Features
🏷️ Google Tag Manager (GTM)
- List & Search: Find tags, triggers, and variables.
- Manage Tags: Create, update, pause, and delete tags (HTML, GA4 Event, GA4 Config).
- Manage Variables: Create and update Custom JavaScript and Data Layer variables.
- Versioning: Create versions, submit workspaces, and publish containers.
- Validation: Check for common issues (missing triggers, unknown variables) before publishing.
🔍 Google Search Console (GSC)
- Site Management: List all accessible properties.
- Performance Data: Query search analytics (clicks, impressions, CTR, position).
- URL Inspection: Inspect URLs for indexing status and mobile usability.
- Sitemaps: List, submit, and extract URLs from sitemaps.
📊 Google Analytics (GA4)
- Reporting: Run reports with custom dimensions and metrics.
- Account Summary: List accessible accounts and properties.
Prerequisites
- Node.js (v18 or higher)
- A Google Cloud Project with the following APIs enabled:
- Google Tag Manager API
- Google Search Console API
- Google Analytics Data API
- Google Analytics Admin API
Installation
-
Clone the repository (or download the source):
git clone <repository-url> cd google-webmaster-mcp -
Install dependencies:
npm install -
Build the project:
npm run build
Configuration
-
Create a
.envfile: Copy.env.exampleto.env:cp .env.example .env -
Set up Google OAuth:
- Go to your Google Cloud Console.
- Create OAuth 2.0 credentials (Desktop App).
- Download the client secret JSON or copy the Client ID and Secret.
- Update
.envwith your credentials:GOOGLE_CLIENT_ID=your_client_id GOOGLE_CLIENT_SECRET=your_client_secret
-
Authenticate: Run the authentication script to generate your
token.json:npm run auth- Click the link to authorize the app.
- Grant all requested permissions (GTM, GSC, Analytics).
- The script will save
token.jsonin the root directory.
Usage
Running the Server
To use this with an MCP client, configure it to run the built Node.js script:
{
"mcpServers": {
"google-webmaster": {
"command": "node",
"args": ["/path/to/google-webmaster-mcp/dist/index.js"],
"env": {
"GOOGLE_CLIENT_ID": "...",
"GOOGLE_CLIENT_SECRET": "..."
}
}
}
}
Global Installation (CLI)
You can install this tool globally to use it as a command-line utility or to simplify the MCP configuration path.
-
Install Globally:
npm install -g . # Or from git: npm install -g git+https://github.com/ehukaimedia/google-webmasters-mcp.git -
Configuration: The tool stores its configuration (tokens) in
~/.config/google-webmaster-mcp/. You can also place a.envfile in that directory with yourGOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRET. -
Authenticate: Run the auth command from anywhere:
google-webmaster-mcp-auth(This command is available globally if you installed via
npm install -g)
Using in Other Projects (Global Usage)
Since this is an MCP server, you don't install it into other repositories. Instead, you configure your AI client (Cursor, Claude Desktop, etc.) to connect to this server. Once connected, the tools are available globally, regardless of which project you have open.
Cursor Configuration
- Open Cursor Settings.
- Go to Features > MCP.
- Click + Add New MCP Server.
- Enter the following:
- Name:
google-webmaster - Type:
command - Command:
node /absolute/path/to/google-webmaster-mcp/dist/index.js(Replace with your actual path) - Environment Variables: (Optional, if not set in
.envor if you prefer explicit config)GOOGLE_CLIENT_ID:...GOOGLE_CLIENT_SECRET:...
- Name:
Claude Desktop Configuration
Edit your claude_desktop_config.json:
{
"mcpServers": {
"google-webmaster": {
"command": "node",
"args": ["/absolute/path/to/google-webmaster-mcp/dist/index.js"],
"env": {
"GOOGLE_CLIENT_ID": "...",
"GOOGLE_CLIENT_SECRET": "..."
}
}
}
}
Multi-Repository Workflow
This tool is designed to work seamlessly across multiple projects without reconfiguration.
- Global Auth: You authenticate once (globally).
- Local Context: In each of your project repositories, create a
.envfile (or just have the info in your README) with the specific IDs for that project.
Example Project .env:
GTM_ID=GTM-ABC1234
GSC_SITE=https://my-project.com
GA4_PROPERTY_ID=987654321
How it works: When you ask your AI agent (Cursor/Claude) to "list tags" or "check indexing", the AI will:
- Read the
GTM_IDorGSC_SITEfrom your current project's files. - Pass that ID as an argument to the global MCP tool.
- The MCP tool uses your global authentication to perform the action on that specific container/site.
Migrating from Legacy Tools
If you were previously using gtm-manager-mcp or gsc-manager-mcp, you should:
-
Update your MCP Configuration: Replace the separate configurations for GTM and GSC with the single
google-webmasterconfiguration shown above.- Old tools:
gtm_list_tags,gsc_list_sites, etc. are all now available under this one server.
- Old tools:
-
Uninstall Legacy Packages: If you installed the old tools globally, you can remove them to avoid confusion:
npm uninstall -g gtm-manager-mcp gsc-manager-mcp
Available Tools
GTM Tools
- Discovery:
gtm_list_accounts,gtm_list_containers,gtm_list_workspaces - Tags:
gtm_list_tags,gtm_create_tag(supports Smart Trigger Resolution),gtm_update_tag,gtm_delete_tag - GA4 Helpers:
gtm_create_ga4_event_tag,gtm_create_ga4_configuration_tag - Variables:
gtm_list_variables,gtm_create_variable,gtm_delete_variable - Triggers:
gtm_list_triggers,gtm_create_trigger - Versions:
gtm_list_versions,gtm_create_version,gtm_publish_version - Validation:
gtm_validate_workspace
GSC Tools
gsc_list_sitesgsc_get_performance_overview(Quick Look)gsc_analytics_querygsc_inspect_urlgsc_sitemaps_submit,gsc_list_sitemaps
Analytics Tools
analytics_list_account_summariesanalytics_get_metadata(List Dimensions/Metrics)analytics_run_report
Development
- Build:
npm run build - Dev (Watch):
npm run dev - Auth:
npm run auth
License
ISC
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。