Skip to main content

niche-google-trends-mcp

MCP server for Google Trends keyword validation and demand analysis. No API key needed.

v0.2.0 — Replaces broken pytrends backend with real Chrome browser + RSS feed.

How it works

Tool Backend Description
trends_interest_over_time Chrome browser Keyword interest over time (0-100 scale)
trends_related_queries Chrome browser Related and rising queries
trends_compare Chrome browser Compare interest across keywords
trends_trending_searches RSS feed Today's real-time trending searches

Browser tools launch a real Chrome via CDP (port 9223), navigate to trends.google.com/trends/explore, and intercept the API responses from:

  • /trends/api/widgetdata/multiline → timeline data
  • /trends/api/widgetdata/relatedsearches → related queries
  • /trends/api/widgetdata/comparedgeo → geographic data

This bypasses pytrends 429 issues entirely by routing through a real browser session.

RSS fetches from the public Google Trends RSS feed (trends.google.com/trending/rss). Always available.

Setup

# Install
pip install niche-google-trends-mcp
# or
uvx niche-google-trends-mcp

# First-time setup: open Chrome and accept Google cookies
niche-google-trends-mcp --login

MCP Config

{
  "mcpServers": {
    "niche-google-trends-mcp": {
      "command": "uvx",
      "args": ["niche-google-trends-mcp"]
    }
  }
}

Architecture

src/google_trends_mcp/
├── server.py          # FastMCP with 4 tools + CLI
├── tools.py           # Pydantic params + async routing
├── rss.py             # Google Trends RSS fetcher  
└── browser/
    ├── __init__.py
    ├── client.py      # TrendsBrowser via Patchright/CDP
    └── scraper.py     # API response interception + parsing

Key differences from v0.1.0 (pytrends)

v0.1.0 (pytrends) v0.2.0 (Patchright + RSS)
Backend pytrends scraper Real Chrome browser + RSS
429 issues Constant Rare (retry logic built in)
API key None None
Dependencies pytrends, pandas patchright (no pandas)
Data extraction HTTP calls Network response interception

Rate limiting

Google rate-limits the widgetdata/multiline and relatedsearches endpoints. The code handles this with:

  • 2 retries with 10s/20s exponential backoff
  • parse_jsonp() returns None for non-JSON responses (HTML error pages)
  • RSS trending_searches is never rate-limited

Testing

# Unit tests (no Chrome needed)
uv run pytest tests/ -v

# Integration test (requires Chrome on port 9223)
uv run python scripts/integration_test.py

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

niche_google_trends_mcp-0.2.1.tar.gz (57.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

niche_google_trends_mcp-0.2.1-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

Release history Release notifications | RSS feed

0.3.0

2 files

This release

0.2.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page