Metadata-Version: 2.5
Name: gsc-mcp-full
Version: 0.1.0
Summary: Google Search Console MCP server that understands every language: multilingual query grouping, unlimited history, hourly data and analysis tools.
Project-URL: Homepage, https://mamrrez.github.io/gsc-mcp-full/
Project-URL: Documentation, https://mamrrez.github.io/gsc-mcp-full/
Project-URL: Repository, https://github.com/mamrrez/gsc-mcp-full
Project-URL: Issues, https://github.com/mamrrez/gsc-mcp-full/issues
Project-URL: Changelog, https://github.com/mamrrez/gsc-mcp-full/blob/main/CHANGELOG.md
Author: Mohammadreza (mamrrez)
License-Expression: MIT
License-File: LICENSE
Keywords: arabic,chinese,claude,google,japanese,mcp,model-context-protocol,multilingual,persian,search-console,seo
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Requires-Python: >=3.10
Requires-Dist: google-auth-oauthlib>=1.2
Requires-Dist: google-auth>=2.30
Requires-Dist: mcp<3,>=2.0
Requires-Dist: requests>=2.31
Requires-Dist: tzdata>=2024.1; sys_platform == 'win32'
Provides-Extra: all
Requires-Dist: fugashi>=1.3; extra == 'all'
Requires-Dist: jieba>=0.42; extra == 'all'
Requires-Dist: opencc-python-reimplemented>=0.1.7; extra == 'all'
Requires-Dist: pythainlp>=5.0; extra == 'all'
Requires-Dist: unidic-lite>=1.0.8; extra == 'all'
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Provides-Extra: ja
Requires-Dist: fugashi>=1.3; extra == 'ja'
Requires-Dist: unidic-lite>=1.0.8; extra == 'ja'
Provides-Extra: th
Requires-Dist: pythainlp>=5.0; extra == 'th'
Provides-Extra: zh
Requires-Dist: jieba>=0.42; extra == 'zh'
Requires-Dist: opencc-python-reimplemented>=0.1.7; extra == 'zh'
Description-Content-Type: text/markdown

# gsc-mcp-full

**A Google Search Console MCP server that understands every language.**

Connect Search Console to Claude, Cursor, Windsurf, VS Code or any MCP client — and get answers that are right for Persian, Arabic, Chinese, Japanese, Korean, Turkish, Vietnamese and 30+ other languages, not just English.

[![PyPI](https://img.shields.io/pypi/v/gsc-mcp-full)](https://pypi.org/project/gsc-mcp-full/)
[![CI](https://github.com/mamrrez/gsc-mcp-full/actions/workflows/ci.yml/badge.svg)](https://github.com/mamrrez/gsc-mcp-full/actions/workflows/ci.yml)
[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)
[![MCP SDK 2.x](https://img.shields.io/badge/MCP%20SDK-2.x-green)](https://github.com/modelcontextprotocol/python-sdk)
[![License: MIT](https://img.shields.io/badge/license-MIT-lightgrey)](https://github.com/mamrrez/gsc-mcp-full/blob/main/LICENSE)

📖 **Docs & tutorials:** https://mamrrez.github.io/gsc-mcp-full/

---

## Why another Search Console MCP?

Search Console reports every distinct *string* as its own query. In most languages the same search is typed several ways, so one real keyword is split across rows and looks smaller than it is:

| What people type | What Search Console shows | What you actually have |
|---|---|---|
| کولر گازی · كولر گازي · کولر‌گازی · كولر گازى | 4 queries, 4 small numbers | **1 keyword** |
| قیمت ۱۲۰۰۰ · قیمت 12000 · قيمت ١٢٠٠٠ | 3 queries | 1 keyword |
| エアコン · えあこん · ｴｱｺﾝ | 3 queries | 1 keyword |
| 에어컨 설치 · 에어컨설치 | 2 queries | 1 keyword |
| İstanbul klima · istanbul klima | 2 queries | 1 keyword |
| sghl | a meaningless Latin query | «سلام» typed on the wrong keyboard layout |

Every existing Search Console MCP passes those rows through as-is. This one groups them — per script, with rules that are right for each language — and every analysis tool (cannibalization, striking distance, brand split, comparisons…) works on the grouped keyword.

**Other things the popular servers don't do:**

- **Hourly data** (`HOUR` dimension, last 10 days) — and with it **true local days**. Search Console's daily numbers are Pacific-Time days; for a site in Tehran or Tokyo that is not your Monday. `hourly_performance(timezone="Asia/Tehran")` re-cuts the hours into your days.
- **History beyond 16 months.** `sync_history` stores rows in a local SQLite file, day by day, past Google's window and past the per-request row cap. Compare this quarter with the same quarter two years ago.
- **Regex filters that work.** RE2's `\b` is ASCII-only, so `\bکولر\b` silently matches nothing in the API *and* in the UI. `build_query_regex` gives you a pattern with Unicode boundaries that matches every spelling.
- **Answers, not dumps.** Tools return compact Markdown with the analysis done: which pages compete, which keywords sit at position 8–20, which titles under-perform their position, what decayed since last month.
- **Read-only by default.** Write tools (add/remove property, submit/delete sitemap) are off until you opt in.
- **Built on MCP SDK 2.x** (the July 2026 release that broke most 1.x servers), with a fallback for 1.x.

## Quick start

**1. Get Google credentials** (5 minutes, free)

1. In [Google Cloud Console](https://console.cloud.google.com/) create a project.
2. **APIs & Services → Library** → enable **Google Search Console API**.
3. **OAuth consent screen** → External → add yourself as a test user, then **Publish app** (otherwise Google expires your sign-in every 7 days; no verification is needed for personal use).
4. **Credentials → Create credentials → OAuth client ID → Desktop app** → **Download JSON**.

That file is your `GSC_CREDENTIALS_PATH`. A service-account key works too (add its email as a user in Search Console). Full walkthrough: [Setup guide](https://mamrrez.github.io/gsc-mcp-full/setup).

**2. Install and sign in**

```sh
# Install uv if you don't have it: https://docs.astral.sh/uv/getting-started/installation/
export GSC_CREDENTIALS_PATH=~/Downloads/client_secret_xxx.json
uvx gsc-mcp-full auth   # opens the browser once
uvx gsc-mcp-full doctor # lists your properties
```

Prefer pip? `pip install gsc-mcp-full` gives you the same `gsc-mcp-full` command.

**3. Add it to your MCP client** — Claude Desktop shown; [Claude Code, Cursor, Windsurf and VS Code here](https://mamrrez.github.io/gsc-mcp-full/install).

```json
{
  "mcpServers": {
    "search-console": {
      "command": "uvx",
      "args": ["gsc-mcp-full"],
      "env": {
        "GSC_CREDENTIALS_PATH": "/Users/you/Downloads/client_secret_xxx.json",
        "GSC_TIMEZONE": "Asia/Tehran",
        "GSC_LANG": "fa"
      }
    }
  }
}
```

Then ask: *"Show me keywords on example.com that are split across spellings"*, *"What decayed last month?"*, *"Which pages compete for کولر گازی?"*

## Tools

| Group | Tools |
|---|---|
| **Properties** | `list_properties` · `get_property` · `add_property`* · `remove_property`* |
| **Search analytics** | `query_search_analytics` (any dimensions/filters, multilingual `query_filter`) · `performance_overview` · `compare_periods` · `queries_for_page` · `pages_for_query` · `hourly_performance` · `data_freshness` |
| **Multilingual** | `query_variants` · `language_breakdown` · `keyboard_mistypes` · `top_terms` · `build_query_regex` |
| **Opportunities** | `find_cannibalization` · `striking_distance` · `low_ctr_opportunities` · `content_movers` · `brand_split` |
| **History** | `sync_history` · `history_status` · `history_query` · `history_trend` · `history_compare` · `history_sql` |
| **URL inspection** | `inspect_url` · `inspect_urls` (concurrent, up to 50) · `indexing_summary` · `inspection_quota` |
| **Sitemaps** | `list_sitemaps` · `get_sitemap` · `submit_sitemap`* · `delete_sitemap`* |
| **Utilities** | `get_capabilities` · `reauthenticate` |

\* needs `GSC_ALLOW_WRITE=1`. Full reference with every parameter: [Tools](https://mamrrez.github.io/gsc-mcp-full/tools).

Every analysis tool accepts `source="history"` to run on the local store instead of the API, so it works for any date range once you have synced.

## Languages

Two grouping levels. **standard** folds only things that are the *same word typed differently*; **loose** also merges near-spellings. The original query text is never changed — only the grouping key.

| Script / language | standard | loose adds |
|---|---|---|
| Persian, Arabic, Urdu, Pashto | ی/ي/ى, ک/ك, ه/ة/ۀ, ا/أ/إ/آ; harakat; tatweel; half-space; Persian & Arabic-Indic digits | ؤ→و, ئ→ی, ء dropped, Urdu ے/ھ/ہ; all spaces removed |
| Chinese | full-width forms, punctuation, case | Traditional→Simplified (with the `zh` extra) |
| Japanese | half-width katakana, dash-as-chōonpu | hiragana↔katakana, middle dot |
| Korean | NFC composition | spacing differences |
| Hindi & other Indic | joiners are **kept** (they change spelling) | — |
| Hebrew | niqqud | — |
| Turkish | dotted/dotless i done right (`İ`→`i`, `I`→`ı`) | accents |
| Vietnamese, French, German, Spanish… | case, punctuation | diacritics (điều hòa = dieu hoa, straße = strasse) |
| Russian, Ukrainian | ё→е | — |
| Greek | case | tonos, final sigma |

Chinese/Japanese/Thai queries have no spaces; `top_terms` segments them with `jieba` / `fugashi` / `pythainlp` when installed (`pip install "gsc-mcp-full[zh]"`, `[ja]`, `[th]` or `[all]`) and falls back to a script-aware splitter otherwise. Details and the reasoning behind each rule: [Multilingual guide](https://mamrrez.github.io/gsc-mcp-full/multilingual).

## Configuration

All settings are environment variables in the MCP client's config.

| Variable | Required | Default | Meaning |
|---|---|---|---|
| `GSC_CREDENTIALS_PATH` | yes* | — | OAuth client secrets JSON **or** a service-account key (detected automatically) |
| `GSC_SCOPE` | no | `readonly` | `readonly` or `full` |
| `GSC_ALLOW_WRITE` | no | off | `1` enables add/remove property and submit/delete sitemap (implies `full`) |
| `GSC_TIMEZONE` | no | — | IANA zone for local-day features, e.g. `Asia/Tehran`, `Asia/Tokyo` |
| `GSC_LANG` | no | auto | Language hint for ambiguous scripts (`fa`, `ar`, `tr`…) |
| `GSC_DATA_STATE` | no | `all` | `all` matches the UI (includes fresh data); `final` only settled days |
| `GSC_CONFIG_DIR` | no | `~/.config/gsc-mcp-full` | Where the token and history live |
| `GSC_TOKEN_PATH`, `GSC_DB_PATH` | no | inside config dir | Override individual paths |
| `GSC_ROW_CAP` | no | `100000` | Hard cap on rows one tool call may fetch |
| `GSC_BIDI_ISOLATE` | no | off | Wrap RTL cells in bidi isolates for clients that scramble mixed tables |

\* Without it the server falls back to [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials); an existing `token.json` also works on its own.

`GSC_OAUTH_CLIENT_SECRETS_FILE` and `GSC_ALLOW_DESTRUCTIVE` are accepted as aliases so configs written for other servers keep working.

## CLI

```sh
gsc-mcp-full                     # run the server (stdio) — what MCP clients call
gsc-mcp-full auth [--force]      # sign in with Google in the browser
gsc-mcp-full doctor              # check credentials and list properties
gsc-mcp-full sync example.com --days 30   # pull history (put it in cron)
gsc-mcp-full serve --transport streamable-http --port 8000   # HTTP for remote use
gsc-mcp-full tools               # the tool reference as Markdown
```

## Security

- **Read-only scope by default.** A leaked token then cannot change anything in Search Console.
- **Tokens are written with owner-only permissions** (`0600`) under your config dir, are never logged, and never leave your machine — the server runs locally; there is no hosted component and nobody but you holds your credentials.
- **Query strings are public input.** Anyone can type anything into Google; it lands in your data and then in your AI's context. The server's instructions say so, write tools are off by default, and destructive tools never run without an explicit environment flag.
- **Few dependencies**, all mainstream (`mcp`, `google-auth`, `google-auth-oauthlib`, `requests`); language extras are optional.

Report a vulnerability privately: see [SECURITY.md](https://github.com/mamrrez/gsc-mcp-full/blob/main/SECURITY.md).

## Development

```sh
git clone https://github.com/mamrrez/gsc-mcp-full && cd gsc-mcp-full
uv venv && uv pip install -e ".[dev,all]"
uv run pytest        # no network needed: the tools are tested against a fake Search Console
uv run ruff check
```

The multilingual engine (`src/gsc_mcp_full/i18n/`) has no dependencies and no I/O — adding a language is a table plus a test. Contributions welcome; see [CONTRIBUTING.md](https://github.com/mamrrez/gsc-mcp-full/blob/main/CONTRIBUTING.md).

## Acknowledgements

Built after using [AminForou/mcp-gsc](https://github.com/AminForou/mcp-gsc) and the other community servers daily and wanting them to understand Persian. The Search Console API surface was taken from Google's discovery document, revision 2026-09-23.

## License

MIT © Mohammadreza (mamrrez)
