Back to Browse

Google Search Console MCP Server

by Ni C
Developer ToolsLow Risk10.0MCP RegistryLocal
Free

Server data from the Official MCP Registry

MCP server for Google Search Console: properties, sitemaps, search analytics and URL inspection

About

MCP server for Google Search Console: properties, sitemaps, search analytics and URL inspection

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (1 strong, 1 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry. Trust signals: trusted author (15/15 approved).

5 files analyzed · 1 issue found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

HTTP Network Access

Connects to external APIs or services over the internet.

What You'll Need

Set these up before or after installing:

Service account key as JSON, or base64-encoded JSON. One of the three credential options.Required

Environment variable: GSC_SERVICE_ACCOUNT_KEY

Path to a service account key file. Alternative to GSC_SERVICE_ACCOUNT_KEY.Optional

Environment variable: GSC_SERVICE_ACCOUNT_KEY_FILE

OAuth2 client id. Use together with GSC_CLIENT_SECRET and GSC_REFRESH_TOKEN.Optional

Environment variable: GSC_CLIENT_ID

OAuth2 client secret. All three OAuth2 variables are required together.Required

Environment variable: GSC_CLIENT_SECRET

OAuth2 refresh token. All three OAuth2 variables are required together.Required

Environment variable: GSC_REFRESH_TOKEN

Path to application default credentials, used when no GSC_ credential is set.Optional

Environment variable: GOOGLE_APPLICATION_CREDENTIALS

Default property, e.g. sc-domain:example.com or https://example.com/ — makes site_url optionalOptional

Environment variable: GSC_SITE_URL

Comma-separated properties this server may touch; anything else is refusedOptional

Environment variable: GSC_ALLOWED_SITES

Set to true to register only the read tools (default: false)Optional

Environment variable: GSC_READ_ONLY

Comma-separated tool names or list_* prefixes to register; 'essential' selects a curated preset (default: all tools)Optional

Environment variable: GSC_ALLOW_TOOLS

Comma-separated tool names or list_* prefixes to remove from whatever the allow list leftOptional

Environment variable: GSC_DENY_TOOLS

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "io-github-ni-c-google-search-console-mcp": {
      "env": {
        "GSC_SITE_URL": "your-gsc-site-url-here",
        "GSC_CLIENT_ID": "your-gsc-client-id-here",
        "GSC_READ_ONLY": "your-gsc-read-only-here",
        "GSC_DENY_TOOLS": "your-gsc-deny-tools-here",
        "GSC_ALLOW_TOOLS": "your-gsc-allow-tools-here",
        "GSC_ALLOWED_SITES": "your-gsc-allowed-sites-here",
        "GSC_CLIENT_SECRET": "your-gsc-client-secret-here",
        "GSC_REFRESH_TOKEN": "your-gsc-refresh-token-here",
        "GSC_SERVICE_ACCOUNT_KEY": "your-gsc-service-account-key-here",
        "GSC_SERVICE_ACCOUNT_KEY_FILE": "your-gsc-service-account-key-file-here",
        "GOOGLE_APPLICATION_CREDENTIALS": "your-google-application-credentials-here"
      },
      "args": [
        "-y",
        "@ni-c/google-search-console-mcp"
      ],
      "command": "npx"
    }
  }
}

Documentation

View on GitHub

From the project's GitHub README.

google-search-console-mcp

CI npm version npm downloads node license container docs sponsor

A Model Context Protocol (MCP) server for Google Search Console, the service that tells you how Google sees your site — this reads it and sets it up.

Lets MCP clients like Claude Code, Claude Desktop or Codex create a property and prove ownership of it, submit and refresh sitemaps, ask what any URL's index status is, and query the whole Performance report — with the irreversible operations behind a confirmation token and the write tools switchable off entirely.

21 tools is the ceiling, not the floor: GSC_ALLOW_TOOLS=essential registers a curated five instead, and a model picks the right tool far more reliably from five than from 21 — see choosing which tools load.

What makes it different

It can actually create a working property. Getting one takes four steps in a fixed order — obtain a verification token, place it in DNS or on the page, verify ownership, add the property — and nothing in Google's APIs enforces that order. Calling sites.add first succeeds and leaves a property that appears in every listing and answers 403 for every piece of data, which looks like a permissions bug and is not. setup_site reports which step is missing and hands over the exact DNS record to paste. Servers that expose sites.add alone can only add properties somebody already verified by hand.

Three APIs, not one. Search Console v1 is ten methods and does not include ownership. Site Verification is a separate service with its own scope, its own host and an incompatible way of naming the same site — sc-domain:example.com there is {type: INET_DOMAIN, identifier: example.com}, and passing the property spelling straight through is accepted and verifies a domain literally called sc-domain:example.com. The Indexing API is a third. All three are covered, and the translation between them is in src/site-identity.ts.

The numbers are right. Search analytics come back as a table with totals where CTR is computed from the totals rather than averaged across rows, and average position is weighted by impressions. Unweighted, a thousand rare queries ranking 80th drag a property's real average of 12 up into the nineties. The result also says plainly that the rows do not sum to the property total when the query dimension is used — Google withholds rare queries for anonymity, commonly a third or more of all impressions, and a total printed without that caveat is a number people will quote.

It knows where these APIs are sharp. The trailing slash on https://example.com/ is mandatory and its absence is a 403; a domain property and a URL-prefix property for the same site are different properties with different data, so a bare hostname is refused rather than guessed at; days are counted in Pacific Time, so a last7days computed in UTC asks for a day Google has no data for; the hour dimension silently returns nothing without dataState: HOURLY_ALL; Google omits empty arrays entirely, so a fresh credential's property list arrives as {}; and the Indexing API returns 200 for any owned URL while only acting on JobPosting and BroadcastEvent pages.

Requirements

  • Node.js 22 or newer (or the container image)
  • A Google credential — a service account key, an OAuth2 refresh token, or application default credentials
  • The APIs you intend to use enabled in a Google Cloud project: Search Console API, and separately Site Verification API and Indexing API

Configuration

The server starts without credentials and lists its tools; every call then fails with setup instructions rather than a Google error. That is deliberate, so registries and sandbox inspectors can introspect it.

VariableDescription
GSC_SERVICE_ACCOUNT_KEYService account key as raw JSON, or base64-encoded JSON
GSC_SERVICE_ACCOUNT_KEY_FILEPath to a service account key file. Alternative to the above — setting both is an error
GSC_CLIENT_IDOAuth2 client id
GSC_CLIENT_SECRETOAuth2 client secret
GSC_REFRESH_TOKENOAuth2 refresh token. All three OAuth2 variables are required together
GOOGLE_APPLICATION_CREDENTIALSApplication default credentials, used when no GSC_ credential is set
GSC_SITE_URLDefault property, e.g. sc-domain:example.com or https://example.com/. Makes site_url optional everywhere
GSC_ALLOWED_SITESComma-separated properties this server may touch at all; anything else is refused
GSC_READ_ONLYtrue registers only the twelve read tools
GSC_ALLOW_TOOLSComma-separated tool names, a list_* prefix, or essential
GSC_DENY_TOOLSSame shape, subtracted from whatever the allow list left

Credentials are tried in that order — explicit beats ambient. A partial OAuth triple is a startup error rather than a reason to fall through to application default credentials, because that fallback would quietly run the server as whatever account the machine is logged into.

Which credential

A service account is the recommended one: it sees only the properties you explicitly add it to, and revoking it does not touch anyone's Google account. Add its client_email under Settings → Users and permissions in Search Console, or give it ownership with verify_site. Note that the Indexing API requires owner, not full user.

An OAuth2 refresh token acts as the person who consented and sees everything they see. Its scopes were fixed at consent time and cannot be widened later.

Choosing which tools load

Every visible tool costs context on every request, and a model picks the right one far more reliably from five than from 21. Two variables narrow the list:

GSC_ALLOW_TOOLS=essential          # the curated five
GSC_ALLOW_TOOLS='list_*,get_site'  # exact names, or one trailing *
GSC_DENY_TOOLS='delete_*'          # subtracted from whatever allow left

essential is list_sites, get_site, list_sitemaps, query_search_analytics and inspect_url — everything needed to look at a property, and nothing that changes it.

An entry that matches no tool stops the server with the list of real names. An ignored typo would otherwise leave a tool missing from tools/list with nothing pointing at the cause, and nobody traces an absence back to an environment variable.

Narrowing the list also narrows the credential: the OAuth scopes this server requests are derived from the tools that are actually registered, so a server denied the Indexing tools never asks for the Indexing scope.

Installation

Claude Code

claude mcp add google-search-console -- npx -y @ni-c/google-search-console-mcp

Claude Desktop

{
  "mcpServers": {
    "google-search-console": {
      "command": "npx",
      "args": ["-y", "@ni-c/google-search-console-mcp"],
      "env": {
        "GSC_SERVICE_ACCOUNT_KEY_FILE": "/path/to/key.json",
        "GSC_SITE_URL": "sc-domain:example.com"
      }
    }
  }
}

Codex

[mcp_servers.google-search-console]
command = "npx"
args = ["-y", "@ni-c/google-search-console-mcp"]

[mcp_servers.google-search-console.env]
GSC_SERVICE_ACCOUNT_KEY_FILE = "/path/to/key.json"
GSC_SITE_URL = "sc-domain:example.com"

Docker

docker run --rm -i \
  -v /path/to/key.json:/key.json:ro \
  -e GSC_SERVICE_ACCOUNT_KEY_FILE=/key.json \
  -e GSC_SITE_URL=sc-domain:example.com \
  ghcr.io/ni-c/google-search-console-mcp

Tools

site_url is optional on every tool that takes it when GSC_SITE_URL is set.

Properties and ownership

ToolWhat it does
setup_siteReports which of the four setup steps a property is missing, with the DNS record or meta tag to place. Changes nothing
list_sitesEvery property this credential can see, with its permission level
get_siteOne property — the way to settle which of the two spellings exists
add_siteAdds a property. Does not verify ownership
delete_siteRemoves a property and its history. Two-step
list_verified_sitesSites this credential has proven ownership of, with all owners
get_verified_siteOne of them by its opaque resource id
get_verification_tokenThe token, and exactly where to put it. Claims nothing
verify_siteChecks for the placed token and records ownership
unverify_siteGives up ownership. Two-step
update_site_ownersReplaces the owner list. method: "patch" uses PATCH, which behaves identically

Sitemaps

ToolWhat it does
list_sitemapsSubmitted sitemaps, with download times, URL counts and errors
get_sitemapOne sitemap — where a submission's errors actually appear
submit_sitemapSubmits or refreshes one. There is no separate update call
submit_sitemapsUp to 50 in one call, with per-entry results
delete_sitemapRemoves one. Two-step

Search analytics and indexing

ToolWhat it does
query_search_analyticsThe Performance report: clicks, impressions, CTR and position by any dimensions, with filters and relative periods
inspect_urlWhat Google knows about one URL — index status, canonicals, crawl time, rich results
inspect_urlsUp to 20 URLs, condensed to verdicts
get_indexing_statusIndexing API notification history for a URL
request_indexingNotifies Google a URL changed. Only acts on JobPosting and BroadcastEvent pages

Not exposed, on purpose

urlTestingTools.mobileFriendlyTest is still in Google's discovery document and the service behind it was switched off in December 2023. A tool for it could only ever return an error, so there is not one.

Safety

Four operations are two-step. delete_site, delete_sitemap, unverify_site and update_site_owners refuse the first call and return a short-lived token bound to those exact arguments; the second call performs the operation. A confirmation issued for one property cannot be replayed against another, and the token only ever appears in a previous tool result, so a model cannot invent it. update_site_owners is in that list because the list it takes is the complete owner list afterwards — one well-formed call removes everyone else, and nothing here can put them back.

Everything from the APIs is marked untrusted. Search queries are strings the public typed into Google; page titles and crawl diagnostics come from whoever runs the crawled site. Someone who wants a model to act on their instructions can put them in a page title and wait to be crawled. The two sentences of a confirmation prompt are built only from values the server derived; a sitemap URL or an owner list is quoted below them as data.

The allowlist has no exemptions. GSC_ALLOWED_SITES is enforced wherever a tool names a property, and separately on the two shapes that do not name one: the Indexing API tools match the page URL against the list the way Search Console scopes a property, and the verification tools resolve their opaque resource id to a property before acting on it. Both listings filter to the allowlist and say how many entries they withheld.

Read-only goes below the tool layer. GSC_READ_ONLY=true does not register the write tools and requests webmasters.readonly instead of webmasters, so a write is impossible even if a tool tried.

Credentials never leak into output. They are deleted from the environment after start-up, never sent to a redirect target, and a rejected value is described rather than echoed — including when it is a key pasted into GSC_ALLOW_TOOLS by mistake.

Development

npm install
npm test            # no network — every test runs against a stubbed fetch
npm run lint
npm run build

See CONTRIBUTING.md.

Releasing

Update CHANGELOG.md, bump the version in package.json and server.json, then push a signed tag:

git tag -s v0.1.0 -m 'v0.1.0' && git push origin main v0.1.0

release.yml runs the suite, publishes to npm with provenance through a trusted publisher, pushes the multi-arch image to GHCR and updates the MCP registry entry.

Reviews

No reviews yet

Be the first to review this server!