Skip to main content
Glama

gsc-mcp: read-only local MCP server for Google Search Console

gsc-mcp

Minimal, strictly read-only local Model Context Protocol (MCP) server for Google Search Console, written in TypeScript (~1,200 lines across four files).

Why a pinned local build instead of npx ...@latest?

Connecting Google Search Console to a coding agent requires a Google Cloud service-account key. Passing that key into an unpinned package via npx -y ...@latest downloads and executes whatever was pushed to the registry most recently—inside the same process that holds your credentials—on every session start.

To anyone else reading this on GitHub, this repository is third-party code too—so do not run it blindly either. For read-only Search Console reporting, the entire API surface is three endpoints (sites.list, searchanalytics.query, urlInspection.index.inspect). Keeping the server deliberately small (four files in src/, three runtime dependencies, ignore-scripts=true) means you can read the full source in a few minutes—especially src/gsc-client.ts, where the key is loaded and the OAuth scope is pinned—before building a fixed commit locally, forking it, or using it as a blueprint to write your own. Once built, nothing updates behind your back.

Related MCP server: google-search-console-mcp-server

Security Model (Defense in Depth)

  1. Hardcoded read-only OAuth scope: src/gsc-client.ts pins https://www.googleapis.com/auth/webmasters.readonly. Sitemaps cannot be deleted, URLs cannot be removed, and settings cannot be modified—even under prompt injection.

  2. Property-level least privilege: The service account only sees Search Console properties where you explicitly add its email address with Restricted (siteRestrictedUser) permission.

  3. Local key isolation: Credentials live outside every Git repository at ~/.config/gsc/service-account.json (chmod 600; startup warns on stderr if group/world-readable). Install scripts are disabled via .npmrc (ignore-scripts=true), and @googleapis/searchconsole is used instead of the monolithic googleapis package.

Provided MCP Tools

All tools carry MCP readOnlyHint: true and destructiveHint: false annotations:

Tool

Purpose

gsc_list_sites

Lists all Search Console properties granted to the service account (siteUrl and permissionLevel).

gsc_search_analytics

Queries clicks, impressions, ctrPercent, and position grouped by query, page, country, device, searchAppearance, or date, with AND-filters, pagination (rowLimit, startRow), searchType, and sorting (clicks, impressions, ctr, position). Defaults to the last 28 days shifted back by GSC's 3-day data lag.

gsc_compare_periods

Compares two equal-length periods (e.g., last 28 or 90 days vs. preceding period) and returns property-wide deltas plus top winners and losers (clicksDiff, impressionsDiff, positionDiff) with optional minImpressions noise filtering. Queries ungrouped property totals alongside dimension rows so Google's privacy-thresholded query breakdowns never undercount total site clicks.

gsc_inspect_url

Runs the URL Inspection API for a specific URL: indexing verdict, coverage state, lastCrawlTime, crawledAs, googleCanonical vs. userCanonical, robotsTxtState, sitemaps, mobile usability, and rich results.

Setup in 5 Minutes

1. Create a read-only Google Cloud service account

Using the Google Cloud CLI (gcloud):

export GCP_PROJECT="your-project-id" # must be globally unique in Google Cloud
export SA_NAME="gsc-reader"
export SA_EMAIL="${SA_NAME}@${GCP_PROJECT}.iam.gserviceaccount.com"

# Create a dedicated project (or skip if using an existing project)
gcloud projects create "$GCP_PROJECT" --name="GSC Read-Only MCP"
gcloud config set project "$GCP_PROJECT"

# Enable the Google Search Console API
gcloud services enable searchconsole.googleapis.com

# Create the service account (no IAM project roles needed)
gcloud iam service-accounts create "$SA_NAME" \
  --display-name="Search Console Read-Only MCP"

# Export the key outside your repositories and lock down permissions
mkdir -p ~/.config/gsc
chmod 700 ~/.config/gsc
gcloud iam service-accounts keys create ~/.config/gsc/service-account.json \
  --iam-account="$SA_EMAIL"
chmod 600 ~/.config/gsc/service-account.json

2. Grant property access in Google Search Console

Repeat this 30-second step for each property you want to query:

  1. Open Google Search Console and select your property (e.g., example.com).

  2. Go to Settings -> Users and permissions -> Add user.

  3. Enter your service-account email (gsc-reader@your-project-id.iam.gserviceaccount.com) with permission Restricted.

The property becomes immediately visible to gsc_list_sites.

3. Inspect, verify, and build locally

Requires Node.js 22+ (Node 24 LTS recommended). Read through src/ first (start with src/gsc-client.ts), then install and build a pinned commit:

git clone https://github.com/uwejettkant/gsc-mcp.git
cd gsc-mcp
git log -n 1        # Verify the commit you are building (or git checkout <commit-sha>)
npm ci
npm audit
npm run check

4. Register in your coding agent

Claude Code

claude mcp add gsc-mcp --scope user -- node /absolute/path/to/gsc-mcp/dist/index.js

Google Antigravity / Claude Desktop / Cursor (mcp_config.json)

{
  "mcpServers": {
    "gsc-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/gsc-mcp/dist/index.js"]
    }
  }
}

If you store the key somewhere other than ~/.config/gsc/service-account.json, pass GSC_CREDENTIALS_PATH via "env":

{
  "mcpServers": {
    "gsc-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/gsc-mcp/dist/index.js"],
      "env": {
        "GSC_CREDENTIALS_PATH": "~/.config/gsc/custom-key.json"
      }
    }
  }
}

Development & Verification

npm run check       # Typecheck (src + tests), Vitest suite, and TypeScript build
npm audit           # Verify zero known vulnerabilities in locked dependencies
npm test            # Run unit and in-memory MCP protocol tests
npm run typecheck   # Strict TypeScript check without emitting files
npm run build       # Compile TypeScript into dist/

License

MIT © Uwe Jettkant

Available Tools

4 tools
gsc_compare_periodsCompare Two Search Analytics PeriodsB
Read-onlyIdempotent

Compares two date ranges (e.g., last 28 or 90 days vs. the previous period) to identify true property-wide totals as well as top dimension winners and losers.

Inputs: siteUrl (required), days, limit, sortBy, +9 more.

gsc_inspect_urlInspect URL Indexing StatusA
Read-onlyIdempotent

Checks Google Search Console URL Inspection indexing status, crawl state, canonicals, and robots.txt state for a specific URL.

Inputs: siteUrl (required), inspectionUrl (required), languageCode.

gsc_list_sitesList Search Console PropertiesA
Read-onlyIdempotent

Lists all Google Search Console properties accessible to the configured read-only service account.

Inputs: no named parameters.

gsc_search_analyticsQuery Search AnalyticsC
Read-onlyIdempotent

Queries Google Search Console performance data (clicks, impressions, CTR, position) by dimensions such as query, page, country, device, searchAppearance, or date.

Inputs: siteUrl (required), sortBy, endDate, filters, +7 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 4 tools

    Disambiguation4/5

    Each tool has a distinct focus: property listing, performance queries, period comparison, and URL inspection. The only mild overlap is between gsc_search_analytics and gsc_compare_periods, since both use performance data, but their descriptions clarify aggregation versus comparison workflows.

    Naming Consistency5/5

    All tool names follow a consistent gsc_ prefix with snake_case verb/noun structure. The pattern is predictable and readable throughout the set.

    Tool Count5/5

    Four tools is well-scoped for a focused Google Search Console analytics server. Each tool covers a distinct core capability without unnecessary surface area.

    Completeness4/5

    The surface covers the main read-only workflows: listing properties, querying analytics, comparing periods, and inspecting URLs. Minor gaps include sitemap listing and batch URL inspection, but agents can work around these with repeated calls.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides read-only access to Google Search Console data, including search analytics, sitemap status, and URL inspection, for MCP clients like Claude.
      10 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables MCP clients to query Google Search Console search performance, inspect indexing, analyze sitemaps, and run SEO analyses such as cannibalisation detection, query clustering, and wins/losses, all with read-only access.
      20
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables read-only access to Google Search Console data, including property discovery, search analytics queries, and URL inspection, through a security-focused interface.
      3
      3,564 PyPI
      3
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables read-only access to Google Search Console data, including properties, Search Analytics with filters and auto-pagination, sitemaps, and URL inspection with batch support and throttling.
      5
      39 PyPI
      1
      MIT