MEKA
MEKA // AI Agents & MCP
2026-11-30·7 min read

How to Give Codex, Claude Code & Cursor Live Google Trends via MCP

Ask an AI coding agent to validate a product idea and it either guesses stale search volumes or writes a pytrends script that loops on HTTP 429. Here are the three real ways to give agents live Trends data via MCP.

Codex, Claude Code, and Cursor connected to live Google Trends via gtfa-mcp

PROTOCOL

MCP stdio & HTTP

VERIFIED TOOLS

4 Direct trends_*

LOCAL COST

$0 Unlimited IP

CLOUD FALLBACK

mcp.apify.com

TL;DR // KEY FACTS

  • Without a dedicated MCP tool, AI coding agents either hallucinate search demand from stale training data or generate archived pytrends scripts that burn tokens retrying HTTP 429.
  • Connecting meka-im/google-trends-for-agent (gtfa-mcp) exposes four live-verified MCP tools (trends_ask, trends_snapshot, trends_compare, trends_now) over local stdio ($0) or hosted Streamable HTTP.
  • Register in one command on Codex (codex mcp add google-trends -- npx -y -p google-trends-for-agent gtfa-mcp) or via standard .mcp.json / .cursor/mcp.json for Claude Code and Cursor.

01 // THE REAL AGENT PROBLEM

Why AI coding agents keep hallucinating search volume—or looping on 429

Try asking Codex, Claude Code, or Cursor a straightforward product question: *"Compare US search demand for Sora, Runway, and Kling over the last 3 months and tell me what subtopics are breaking out right now."* Two things usually happen.

First, if the agent answers from memory, it invents plausible-sounding numbers from months-old training data. Second, if it tries to be thorough and writes a quick Python script using GeneralMills/pytrends (archived read-only on April 17, 2025), the script immediately slams into HTTP 429—and the agent burns thousands of tokens trying time.sleep(), fake user agents, and broken cookie patches.

What the agent actually needs is a deterministic MCP tool that returns structured JSON, calibrated daily search volume, and an explicit RATE_LIMITED error code instead of silent failures.

FIG 01 // AGENT DEMAND RESEARCH ARCHITECTUREAd-hoc pytrends retry loops vs. deterministic gtfa-mcp over stdio or HTTP
WITHOUT MCP // GUESSING OR PYTRENDS LOOPCodex / Claude / Cursor"Check US demand for Sora"writes ad-hoc pytrends script→HTTP 429 Retry LoopBurns tokens debugging cookiesor falls back to stale training data→Unverified / Hallucinated• Invented monthly volumes• No live breakout signalWITH GTFA-MCP // STANDARD STDIO OR HTTP MCPAny MCP HostCodex · Claude CodeCursor · VS Code · WindsurfJSON-RPC tools/call→Local stdio: gtfa-mcp ($0)4 direct trends_* tools · local IPCloud MCP: mcp.apify.comZero install · residential proxy→Grounded Agent Output✓ Calibrated dailySearches✓ Rising queries & regions✓ Explicit RATE_LIMITED code
Without MCP, agents waste context debugging archived scrapers or guessing stale numbers. With google-trends-for-agent (gtfa-mcp), any MCP host calls live calibrated Trends tools directly.

03 // STEP 1 · ONE-COMMAND CLIENT SETUP

Wire gtfa-mcp into Codex, Claude Code, and Cursor in 30 seconds

We verified the live MCP stdio handshake on google-trends-for-agent@0.2.45 (initialize → tools/list): it exposes four direct tools—trends_ask, trends_snapshot, trends_compare, and trends_now—with MEKA's 59 open Google Ads calibration anchors built in.

Because MCP stdio and Streamable HTTP are open standards, the same MIT package from npm works across Codex CLI, Claude Code / Desktop, Cursor, VS Code, and Windsurf.

FIG 02 // LIVE-VERIFIED MCP TOOLSThe four direct tools exposed by gtfa-mcp@0.2.45 over stdio
MCP TOOLS/LIST // VERIFIED ON GTFA-MCP@0.2.454 DIRECT TOOLStrends_snapshotSingle-term curve + calibrated daily search volume + rising queriesPrompt: "How big is gemini 4 carbon in the US right now?"trends_compareCompare 2–5 competitors on one shared scale (calibrate: true)Prompt: "Compare Sora, Runway, and Kling over the last 3 months"trends_askFast momentum verdict + Popular/Rising tables + regional breakdownPrompt: "Validate whether these 5 SaaS keywords are actually growing"trends_nowLive Trending Now feed across up to 30 countries (4h–168h)Prompt: "What tech topics are trending in the US and Japan today?"
Verified directly via JSON-RPC initialize + tools/list against npx -y -p google-trends-for-agent@0.2.45 gtfa-mcp.
SHELL & JSON // CODEX CLI, CLAUDE CODE & CURSOR SETUP
# 1. OpenAI Codex CLI (local $0 stdio — 4 direct trends_* tools):
codex mcp add google-trends -- npx -y -p google-trends-for-agent gtfa-mcp

# 2. Claude Code (remote zero-install Streamable HTTP via Apify OAuth):
claude mcp add --transport http google-trends-apify \
  "https://mcp.apify.com?tools=meka.im/google-trends-for-agent"

# 3. Cursor / VS Code / Claude Desktop (.cursor/mcp.json or .mcp.json):
# {
#   "mcpServers": {
#     "google-trends": {
#       "command": "npx",
#       "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp"]
#     }
#   }
# }

04 // STEP 2 · REAL PROMPT BEFORE → AFTER

What changes when you ask the same research prompt with MCP attached

Instead of watching your coding agent write a 40-line Python scraper that crashes on request #1, the host invokes trends_compare and trends_snapshot directly and receives a clean JSON envelope with calibrated daily searches, rising queries, and explicit anchor provenance.

BEFORE // No MCP (agent writes brittle pytrends code & hits 429)
# Agent tries to answer "Compare Sora, Runway, Kling in the US"
# 1. Installs archived pytrends
# 2. Runs TrendReq().build_payload(["Sora", "Runway", "Kling"])
# 3. Hits: TooManyRequestsError: Google returned a response with code 429
# 4. Wastes 4 tool turns adding time.sleep() and fake headers, then guesses numbers.
AFTER // gtfa-mcp stdio (verified JSON-RPC tool call + calibrated volume)
// Host calls MCP tool: trends_compare
{
  "keywords": ["Sora", "Runway", "Kling"],
  "geo": "US",
  "time": "today 3-m",
  "calibrate": true
}

// Also verify local MCP server health anytime from your terminal:
// npx -y -p google-trends-for-agent gtfa doctor --json

Tip: run npm install -g google-trends-for-agent once and point your MCP config directly at gtfa-mcp so startup is instant without npx resolution.

05 // STEP 3 · WHEN LOCAL IP HITS 429 OR IDE OAUTH LOOPS

Cloud residential fallback, IDE OAuth fix, and how to choose

Two real-world gotchas show up once you use Google Trends MCP daily. First, if your office VPN, cloud workspace, or CI runner hits Google Trends HTTP 429, pass --egress actor-public with APIFY_TOKEN (or switch to the hosted Streamable HTTP endpoint https://mcp.apify.com?tools=meka.im/google-trends-for-agent, backed by the same MIT Apify Actor on Apify's $5/month free tier).

Second, some Cursor and VS Code versions occasionally loop on remote MCP OAuth prompts (Needs authentication). If that happens, switch your .cursor/mcp.json entry to an explicit Authorization: Bearer <your-apify-token> header—stored only in your user-level MCP settings, never committed to git.

  • Working on your own laptop with Node.js 20+? Start with local gtfa-mcp ($0 unlimited, 4 direct trends_* tools).
  • Using a hosted web agent or hit local IP 429? Add --egress actor-public or connect https://mcp.apify.com?tools=meka.im/google-trends-for-agent.
  • Need to validate a rising competitor's actual website visits after Trends? Pair gtfa-mcp with MEKA's Similarweb Scraper.
JSON // LOCAL STDIO + CLOUD PROXY OR IDE BEARER HEADER WORKAROUND
{
  "mcpServers": {
    "google-trends": {
      "command": "npx",
      "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp", "--egress", "actor-public"],
      "env": { "APIFY_TOKEN": "<your-apify-token>" }
    }
  }
}

FAQ

FREQUENTLY ASKED QUESTIONS

Which MCP tools does google-trends-for-agent expose?
Running gtfa-mcp over stdio exposes four direct MCP tools: trends_ask (momentum verdict, Popular/Rising tables, and regions), trends_snapshot (calibrated daily search volume and curve), trends_compare (2 to 5 keywords with optional anchor calibration), and trends_now (live Trending Now across up to 30 countries).
Is gtfa-mcp free to run with Codex, Claude Code, and Cursor?
Yes. google-trends-for-agent is MIT open source and runs for $0 unlimited on your local machine's IP or your own HTTPS_PROXY. If a datacenter or VPN IP hits HTTP 429, you can optionally switch to --egress actor-public or mcp.apify.com, where Apify's $5/month free tier covers roughly 3,000 to 7,000 queries.
How do I fix Cursor or VS Code looping on remote MCP OAuth?
If your IDE repeatedly prompts for OAuth authentication on https://mcp.apify.com, configure the MCP server with type http and an explicit Authorization: Bearer <APIFY_TOKEN> header in your user-level MCP settings (never commit tokens to a repo), or run local stdio gtfa-mcp instead.