Skip to main content
Glama
GSC MCP Server

GSC MCP Server

by Prakhar-998

GSC MCP Server

tests python MCP license

Ask Google Search Console questions in plain English. An MCP server that gives any MCP client (Claude Desktop, Claude Code, Cursor) live Search Console tools, plus a Streamlit chat app on the same tools with Gemini function calling.

"Which blog pages lost the most clicks week over week in India?" → the model calls compare_periods(dimension="page", days_ago=7, country="IND", page_contains="/blog/") and answers from real numbers.

Live demo (generated data, no login): link added after deploy

Built originally for an in-house SEO team so non-technical people could query GSC without the UI or exports. This public version runs on configuration and ships a demo data source.

The problem

  • The Search Console UI answers one question at a time, and its exports go stale in a spreadsheet.

  • An LLM can't see your GSC data, and pasting exports into a chat loses the date range and filters.

  • Raw API responses are verbose JSON: expensive in tokens, and easy for a model to misread.

Related MCP server: Google Search Console MCP Server

Architecture

flowchart LR
    subgraph Clients
        CD[Claude Desktop /<br/>Claude Code / Cursor]
        ST[Streamlit chat app]
    end
    CD -- MCP stdio --> SRV[gsc_mcp.server<br/>FastMCP]
    ST -- Gemini automatic<br/>function calling --> TOOLS
    SRV --> TOOLS[gsc_mcp.tools<br/>search_analytics<br/>compare_periods]
    TOOLS --> Q[query.py<br/>validate args, resolve dates,<br/>build request]
    Q --> SRC{Source}
    SRC -- GSC_DATA_SOURCE=google --> API[(Search Console API<br/>read-only service account)]
    SRC -- GSC_DATA_SOURCE=demo --> DEMO[(Deterministic<br/>demo dataset)]
    SRC --> REP[report.py<br/>compact CSV, period deltas]
    REP --> TOOLS

Design choices:

  • One tool core, two front ends. The MCP server and the Streamlit app register the same plain Python functions; their docstrings and type hints are the tool schema both models see.

  • Validation before the API. Bad arguments (an unknown dimension, country="IN", an end date in the future) come back as a short text the model can correct itself with, never a stack trace.

  • Dates done right. Relative ranges end 2 days ago (GSC's incomplete days are excluded), and compare_periods compares against the adjacent period of the same length.

  • Token-lean output. Rows go back as CSV with page URLs shortened to paths, far fewer tokens than the API's JSON, with a header line stating the property and exact date range.

  • Demo source with the same interface. Weekly seasonality, per-query trends and a CTR-by-position curve, deterministic per request, so demos and tests behave like real data without credentials.

Tools

Tool

What it answers

search_analytics

Clicks, impressions, CTR and position by query, page, country, device or date, with country / device / page / query filters and relative or explicit date ranges

compare_periods

Biggest movers against the previous period of the same length, sorted by click change; includes new and lost keys

Stack

Python 3.9+ · MCP Python SDK (FastMCP) · Google Search Console API (google-api-python-client, service account) · Streamlit · Gemini (google-genai, automatic function calling) · pandas · pytest · GitHub Actions

How to run

git clone https://github.com/Prakhar-998/gsc-mcp-server.git && cd gsc-mcp-server
python3 -m venv .venv && source .venv/bin/activate

# tests (demo data, no credentials)
pip install -r requirements-dev.txt && python -m pytest -q

# the chat app: Explore works with no keys; add GEMINI_API_KEY to chat
pip install -r app/requirements.txt
streamlit run app/streamlit_app.py

MCP server (Python 3.10+): pip install -e ".[mcp]", then add it to your client. For Claude Desktop, in claude_desktop_config.json:

{
  "mcpServers": {
    "gsc": {
      "command": "/path/to/gsc-mcp-server/.venv/bin/gsc-mcp",
      "env": {
        "GSC_DATA_SOURCE": "google",
        "GSC_SITE_URL": "sc-domain:example.com",
        "GOOGLE_SERVICE_ACCOUNT_JSON": "/path/to/service_account.json"
      }
    }
  }
}

For Claude Code: claude mcp add gsc -e GSC_DATA_SOURCE=demo -- /path/to/.venv/bin/gsc-mcp.

Live data: create a service account in Google Cloud, enable the Search Console API, and add the account's email as a (restricted) user on your property. Settings are in .env.example.

Results

  • Gave a content team self-serve answers to everyday GSC questions (top queries by market, pages losing clicks, device splits) without the GSC UI or spreadsheet exports.

  • The same tools work from Claude Desktop through MCP and from a password-protected web app for people who don't use an MCP client.

Layout

gsc_mcp/
  config.py    settings from environment variables
  query.py     argument validation, date ranges, request bodies
  sources.py   Search Console API source and the demo source
  report.py    CSV / Markdown output, period comparison
  tools.py     the tool functions (shared by both front ends)
  server.py    MCP server (FastMCP, stdio)
app/           Streamlit chat app
tests/         pytest: query building, demo data, comparisons, tools, MCP server, app smoke test

License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables querying Google Search Console data, including search analytics with advanced filtering, quick wins detection, and rich dimensions, through natural language.
      MIT
    • A
      license
      A
      quality
      F
      maintenance
      Enables natural language interaction with Google Search Console data, including property management, search analytics, URL inspection, and sitemap management via MCP.
      21
      MIT