Skip to main content
Glama
google-search-console-mcp

google-search-console-mcp

by ni-c

google-search-console-mcp

CI OpenSSF Scorecard Socket Badge Glama score npm version container image HTTP via mcp-hub 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 put to a person first 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.

Listing the tools, narrowing them to the essential preset, and the startup abort a mistyped tool name produces

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.

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

Requirements

  • Node.js 24 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.

Variable

Description

GSC_SERVICE_ACCOUNT_KEY

Service account key as raw JSON, or base64-encoded JSON

GSC_SERVICE_ACCOUNT_KEY_FILE

Path to a service account key file. Alternative to the above — setting both is an error

GSC_CLIENT_ID

OAuth2 client id

GSC_CLIENT_SECRET

OAuth2 client secret

GSC_REFRESH_TOKEN

OAuth2 refresh token. All three OAuth2 variables are required together

GOOGLE_APPLICATION_CREDENTIALS

Application default credentials, used when no GSC_ credential is set

GSC_SITE_URL

Default property, e.g. sc-domain:example.com or https://example.com/. Makes site_url optional everywhere

GSC_ALLOWED_SITES

Comma-separated properties this server may touch at all; anything else is refused

GSC_READ_ONLY

true (or 1/yes) registers only the twelve read tools

GSC_ALLOW_TOOLS

Comma-separated tool names, a list_* prefix, or essential

GSC_DENY_TOOLS

Same shape, subtracted from whatever the allow list left

ELICITATION

false replaces the approval dialog with the two-call token. Not prefixed

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.

If you run several of these servers at once, mcp-hub is the other answer — its /hub endpoint replaces every server's tools with six meta-tools.

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

Through mcp-hub

A client that cannot spawn a local process — ChatGPT connectors, Claude on the web, Cursor, LibreChat — reaches google-search-console-mcp through mcp-hub: one container serves many stdio MCP servers over Streamable HTTP, with an OAuth 2.1 login behind a single password and long-lived tokens for the clients that cannot do OAuth. Its /hub endpoint puts every server behind six meta-tools, so one connector reaches all of them without N×tool schemas in the model's context, and it speaks both protocol revisions — a question this server asks travels through it to the person at the far end.

Its /config/mcp.json uses Claude Code's format, so the entry is the one you already have:

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

allowTools and denyTools there are the hub's own per-server filter, which is not the same thing as *_ALLOW_TOOLS in env — the difference, and the mistake it invites, are in the client guide.

Tools

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

Every tool declares an outputSchema and answers with structuredContent alongside the text block, so a client can use the result without parsing prose. query_search_analytics keeps its rendered table in the text block and puts the rows themselves in the structured half; six tools that answered with a sentence now answer with fields too.

Every tool that reports Google's data carries untrusted: true and source: "search-console" as fields. "It is only search data" is exactly the wrong intuition: a search query is a string a member of the public typed into Google, and a page title comes from the crawled site. Six tools are without the marker, because their answer is a property this server was given and a fact it established: add_site, delete_site, submit_sitemap, submit_sitemaps, delete_sitemap and unverify_site.

Properties and ownership

Tool

What it does

setup_site

Reports which of the four setup steps a property is missing, with the DNS record or meta tag to place. Changes nothing

list_sites

Every property this credential can see, with its permission level

get_site

One property — the way to settle which of the two spellings exists

add_site

Adds a property. Does not verify ownership

delete_site 👤

Removes a property and its history

list_verified_sites

Sites this credential has proven ownership of, with all owners

get_verified_site

One of them by its opaque resource id

get_verification_token

The token, and exactly where to put it. Claims nothing

verify_site

Checks for the placed token and records ownership

unverify_site 👤

Gives up ownership

update_site_owners

Replaces the owner list. method: "patch" uses PATCH, which behaves identically

Sitemaps

Tool

What it does

list_sitemaps

Submitted sitemaps, with download times, URL counts and errors

get_sitemap

One sitemap — where a submission's errors actually appear

submit_sitemap

Submits or refreshes one. There is no separate update call

submit_sitemaps

Up to 50 in one call, with per-entry results

delete_sitemap 👤

Removes one

Search analytics and indexing

Tool

What it does

query_search_analytics

The Performance report: clicks, impressions, CTR and position by any dimensions, with filters and relative periods

inspect_url

What Google knows about one URL — index status, canonicals, crawl time, rich results

inspect_urls

Up to 20 URLs, condensed to verdicts

get_indexing_status

Indexing API notification history for a URL

request_indexing

Notifies 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 ask a person. delete_site, delete_sitemap, unverify_site and update_site_owners raise a real dialog through MCP elicitation where the client supports it — one the model cannot answer on its behalf. Where it does not, they refuse the first call and return a short-lived token bound to those exact arguments, and say so rather than implying somebody approved. Either way the approval is bound to the property, so one issued for one cannot be replayed against another. 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. ELICITATION=false takes the fallback path deliberately; it never removes the guard. See Asking a person.

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, GSC_SITE_URL or ELICITATION by mistake, and including the access token itself, which is checked before it becomes a header.

What Google sends is held to a shape. The status of a response is decided before its body is read, every field a result promises is checked at the boundary — a row that is not an object is dropped, a null site block is not a site, an empty 200 is an empty record — and text is stripped of control characters on the way out. Results are budgeted in both channels, caller strings have ceilings, and a batch call stops after two minutes and says how far it got. See Security.

Documentation

The full guide, tool reference and security notes live at google-search-console-mcp.ni-c.de (source in docs/).

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.

Contributing

Issues, discussions and pull requests are welcome — see CONTRIBUTING.md. For vulnerabilities please use private reporting rather than a public issue; the policy is in SECURITY.md.

License

MIT © Willi Thiel

Available Tools

21 tools
add_siteAdd a propertyA
Idempotent

Adds a property to Search Console. This does NOT verify ownership: unless the credential already owns the domain, the property lands as siteUnverifiedUser and every data call for it returns 403. To actually get a working property, use setup_site, which does this in the right order — get_verification_token, then the DNS record or HTML file, then verify_site, then this.

Inputs: site_url (required). Returns: note, site, added

delete_siteRemove a propertyA
DestructiveIdempotent

Removes a property from Search Console. Two-step: the first call returns a confirmation token, the second performs the removal.

Inputs: site_url (required), confirm_token. Returns: site, removed

delete_sitemapRemove a sitemapA
DestructiveIdempotent

Removes a sitemap from the property. Two-step: the first call returns a confirmation token, the second performs the removal.

Inputs: feedpath (required), site_url (required), confirm_token. Returns: site, removed, feedpath

get_indexing_statusGet Indexing API status for a URLA
Read-onlyIdempotent

Returns when this credential last notified Google about a URL through the Indexing API, and what kind of notification it was. This reports the notification history only — it says nothing about whether the page is indexed. inspect_url answers that. The credential must be a verified owner of the property — Search Console user access is not enough, and the API answers 403 without saying which of the two is missing.

Inputs: url (required). Returns: url, source, untrusted, latestRemove, +1 more

get_siteGet one propertyA
Read-onlyIdempotent

Returns one property and the permission level this credential has on it. Useful for settling which of the two spellings exists — "sc-domain:example.com" and "https://example.com/" are separate properties holding separate data.

Inputs: site_url (required). Returns: source, untrusted

get_sitemapGet one sitemapA
Read-onlyIdempotent

Returns the full record for a single submitted sitemap: last submitted, last downloaded, warnings, errors, and the URL counts per content type. This is how to check whether a submission actually worked — errors appear here, never in the response to submit_sitemap.

Inputs: feedpath (required), site_url (required). Returns: source, untrusted

get_verification_tokenGet a verification tokenA
Read-onlyIdempotent

Returns the token that proves ownership of a site, and says exactly where to put it. Nothing is created and nothing is claimed by this call — it is safe to run against a domain you do not own, it just achieves nothing.

A domain property can only be proven by DNS. A URL-prefix property can use FILE or META here; ANALYTICS and TAG_MANAGER prove ownership through an existing Google product rather than a token, so they have no token to fetch and are only usable with verify_site directly.

Placing the token is a human step. Once it is in place, call verify_site.

Inputs: site_url (required), method. Returns: site, type, token, method, +3 more

get_verified_siteGet one owned siteA
Read-onlyIdempotent

Returns one verified site and the email addresses of all its owners.

Inputs: id (required). Returns: source, untrusted

inspect_urlInspect a URLA
Read-onlyIdempotent

Asks Google what it knows about one URL: whether it is indexed, when it was last crawled, which sitemaps reference it, the canonical Google chose versus the one declared, robots.txt and mobile-usability verdicts, and any rich-result problems. This is the API behind the URL Inspection tool in the Search Console interface.

It reports the indexed state, not a live fetch — a page changed an hour ago still shows what Google last saw. The URL Inspection API allows 2 000 calls per property per day and 600 per minute. That is a daily budget, not a rate limit — spending it blocks inspection for the rest of the day.

Inputs: site_url (required), inspection_url (required), language_code. Returns: source, untrusted, inspectionResult

inspect_urlsInspect several URLsA
Read-onlyIdempotent

Inspects up to 20 URLs of one property in a single call, reporting a per-URL verdict. The API has no batch method — this makes the calls one after another — but it saves a round trip per URL. One failure does not stop the rest.

The result is condensed to the verdict fields; use inspect_url for the full report on a single URL. The URL Inspection API allows 2 000 calls per property per day and 600 per minute. That is a daily budget, not a rate limit — spending it blocks inspection for the rest of the day.

Inputs: site_url (required), inspection_urls (required), language_code. Returns: source, results, truncated, untrusted

list_sitemapsList sitemapsA
Read-onlyIdempotent

Lists the sitemaps submitted for a property, each with when Google last downloaded it, how many URLs it holds per content type, and whether processing produced warnings or errors. To refresh a sitemap Google already knows, submit the same URL again — there is no separate update call, and submitting is idempotent. Google re-crawls on its own schedule; nothing can force it, and the ping endpoint that used to exist was removed in 2023.

Inputs: site_url (required), sitemap_index. Returns: source, sitemaps, truncated, untrusted

list_sitesList propertiesA
Read-onlyIdempotent

Lists every Search Console property this credential can see, with the permission level it has on each. This is the first call to make when anything returns 403: an empty list means the identity was never added to any property, which is the usual state of a fresh service account. permissionLevel is what the credential may do: siteOwner (everything, including the Indexing API), siteFullUser (all data, no user management), siteRestrictedUser (most data), and siteUnverifiedUser — which means the property is listed but ownership was never proven, and every data call for it returns 403 until it is verified.

Inputs: no named parameters. Returns: sites, source, truncated, untrusted

list_verified_sitesList owned sitesA
Read-onlyIdempotent

Lists every site this credential has verified ownership of, with the full owner list for each. This is a different list from list_sites: that one is Search Console properties, this one is proven ownership, and a site can be in either without being in the other. setup_site compares the two.

Inputs: no named parameters. Returns: source, truncated, untrusted, verified_sites

query_search_analyticsQuery search analyticsA
Read-onlyIdempotent

Clicks, impressions, CTR and average position from Google Search, grouped by any combination of dimensions. This is the whole of the Performance report, as an API.

Give a date range as either period ("last28days") or start_date and end_date. Data is finalised 2–3 days behind, and only the last 16 months are retained.

Two things about the numbers. Rows are capped at row_limit (default 100, maximum 25,000) and paged with start_row. And with the query dimension, Google withholds rare queries for anonymity, so the rows never sum to the property total — query without it when you need a true total.

Inputs: site_url (required), type, period, filters, +8 more. Returns: rows, site, source, endDate, +7 more

request_indexingNotify Google that a URL changedA
Idempotent

Tells Google through the Indexing API that a URL was updated or removed.

Google only acts on this for pages with JobPosting or BroadcastEvent structured data. For any other page the call succeeds, returns a timestamp, and changes nothing — it is not a way to get a normal page crawled sooner. Submit a sitemap for that.

The credential must be a verified owner of the property — Search Console user access is not enough, and the API answers 403 without saying which of the two is missing. The default quota is 200 URLs per day per project.

Inputs: url (required), type. Returns: url, note, type, source, +3 more

setup_siteCheck what a property still needsA
Read-onlyIdempotent

Works out where a property stands and says exactly what to do next.

Getting a working Search Console property takes four steps in one order — obtain a verification token, place it in DNS or on the page (a human step), verify ownership, add the property — and nothing in the API enforces that order. Calling add_site first succeeds and leaves a property that returns 403 for every piece of data, which looks like a permissions problem and is not.

This reads the current state and reports the next step, including the DNS record or meta tag to copy when that is what is missing. It changes nothing.

Inputs: site_url (required). Returns: site, owned, stage, steps, +4 more

submit_sitemapSubmit a sitemapA
Idempotent

Submits a sitemap URL, or resubmits one Google already knows. To refresh a sitemap Google already knows, submit the same URL again — there is no separate update call, and submitting is idempotent. Google re-crawls on its own schedule; nothing can force it, and the ping endpoint that used to exist was removed in 2023. The call succeeding means Google accepted the address, not that the sitemap is valid — it is fetched later, and any parse error shows up in get_sitemap minutes to hours afterwards.

Inputs: feedpath (required), site_url (required). Returns: note, site, feedpath, submitted

submit_sitemapsSubmit several sitemapsA
Idempotent

Submits up to 50 sitemaps for one property in a single call, reporting success or failure per entry. The API has no batch method — this makes the calls one after another — but it saves a round trip per sitemap, which is what makes a large site practical. One failure does not stop the rest.

Inputs: site_url (required), feedpaths (required). Returns: results, truncated

unverify_siteRemove ownershipA
DestructiveIdempotent

Removes this credential from the owners of a site. Two-step: the first call returns a confirmation token, the second performs the removal.

Inputs: id (required), confirm_token. Returns: note, site, unverified

update_site_ownersChange the owner listA
DestructiveIdempotent

Replaces the list of verified owners of a site. This is how a second person or a service account is granted ownership without placing a token of their own.

It REPLACES rather than adds: the list you pass becomes the complete owner list. Call get_verified_site first and send back the existing addresses plus the new one, or the others are removed. This server refuses a list that does not contain at least one address, because that is the shape of an accidental wipe.

Two-step: the first call returns a confirmation token, the second performs the change.

Inputs: id (required), owners (required), method, confirm_token. Returns: site, owners, source, resource, +2 more

verify_siteVerify ownershipA
Idempotent

Tells Google to check for the verification token and, if it finds it, records this credential as an owner. Run get_verification_token first and place the token — this call only checks, it does not place anything.

A failure here is almost always "not there yet" rather than "wrong": DNS records take minutes to an hour to propagate, and a freshly uploaded file may still be behind a CDN cache. Retrying later is the normal response.

Inputs: site_url (required), method. Returns: note, site, type, method, +5 more

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 21 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes, with descriptions that explicitly separate similar-sounding pairs like list_sites vs list_verified_sites and add_site vs setup_site. A few pairs (get_site vs get_verified_site, submit_sitemap vs submit_sitemaps) could be confused at first glance, but the descriptions resolve the ambiguity.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern (list_sites, delete_sitemap, verify_site, etc.). Even batch variants like submit_sitemaps and inspect_urls fit the convention naturally.

    Tool Count4/5

    21 tools is slightly above the ideal 3-15 range, but the Search Console API spans multiple domains (properties, sitemaps, analytics, inspection, verification, indexing). Batch variants inflate the count a bit, though they are justified by saving round trips.

    Completeness4/5

    The tool set covers the core Search Console workflows comprehensively: property lifecycle, sitemap submission, search analytics, URL inspection, verification, and indexing. The only notable gap is lack of user management beyond owners, but this is a minor omission for most use cases.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      MCP server for Google Search Console, URL Inspection & Indexing API — search analytics, sitemap management, and batch indexing
      13
      126 npm
      8
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server for Google Search Console API that enables querying search analytics, managing sites, inspecting URLs, and supporting domain delegation via service accounts.
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server for Google Search Console, enabling querying search performance, listing properties, and inspecting URL indexing status from MCP-compatible clients.
      4
      38 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Read-only MCP server for Google Search Console data, enabling search analytics, URL inspection, indexing diagnostics, and sitemap management through MCP clients.
      3 npm
      1
      MIT