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

Metadata

Release files for niche-google-trends-mcp 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for niche-google-trends-mcp 0.3.0
File Size Uploaded Provenance Actions
niche_google_trends_mcp-0.3.0.tar.gz 57.0 kB Without provenance Details for niche_google_trends_mcp-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for niche-google-trends-mcp 0.3.0
File Interpreter ABI Platform Actions
niche_google_trends_mcp-0.3.0-py3-none-any.whl Python 3 none any Details for niche_google_trends_mcp-0.3.0-py3-none-any.whl

Total release size: 70.2 kB

Security for niche-google-trends-mcp 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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