Allows running custom reports with dimensions and metrics, listing accessible accounts and properties, and retrieving metadata for available dimensions and metrics in GA4.
Provides access to search analytics data (clicks, impressions, CTR, position), URL inspection for indexing status and mobile usability, sitemap management, and site property listing.
Enables management of tags, triggers, and variables; supports tag creation (HTML, GA4 Event, GA4 Config), workspace versioning, container publishing, and validation of common issues before deployment.
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-mcpInstall dependencies:
npm installBuild the project:
npm run build
Configuration
Create a : Copy
.env.exampleto.env:cp .env.example .envSet 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 authClick 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:
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.gitConfiguration: 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-webmasterType:
commandCommand:
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:...
Claude Desktop Configuration
Edit your claude_desktop_config.json:
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
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.
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_workspacesTags:
gtm_list_tags,gtm_create_tag(supports Smart Trigger Resolution),gtm_update_tag,gtm_delete_tagGA4 Helpers:
gtm_create_ga4_event_tag,gtm_create_ga4_configuration_tagVariables:
gtm_list_variables,gtm_create_variable,gtm_delete_variableTriggers:
gtm_list_triggers,gtm_create_triggerVersions:
gtm_list_versions,gtm_create_version,gtm_publish_versionValidation:
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 buildDev (Watch):
npm run devAuth:
npm run auth
License
ISC