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.

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
pytrendsscripts 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.jsonfor 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.
gtfa-mcp), any MCP host calls live calibrated Trends tools directly.02 // HONEST COMPARISON
Three ways to feed Google Trends into AI agents (and the trade-offs)
Before adding another MCP server to your workspace, it is worth comparing all three approaches teams actually use in 2026. Generic web search solves news summaries, not real-time search demand curves.
| Approach | What the agent gets | Cost | Honest trade-offs |
|---|---|---|---|
| Let agent write Python pytrends / curl on the fly | Ad-hoc scripts that usually fail on HTTP 429 | $0 (+ wasted tokens) | GeneralMills/pytrends is archived; agents waste context debugging cookies and still get relative 0–100 only. |
| Generic Web Search MCP (Tavily / Exa / Brave) | Articles and blog posts mentioning a topic | Free tier / usage-based | Great for news context, but cannot return live Google Trends curves, rising queries, or daily search volume. |
| gtfa-mcp (MIT local stdio or Apify Streamable HTTP) | 4 typed tools: calibrated daily volume, comparisons, rising terms, live Trending Now | $0 local · $5/mo Apify free tier | Unofficial Google Trends endpoints (best for interactive agent research, not bulk scraping or SLAs); local stdio needs Node.js 20+. |
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.
initialize + tools/list against npx -y -p google-trends-for-agent@0.2.45 gtfa-mcp.# 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.
# 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.// 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 --jsonTip: 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($0unlimited, 4 directtrends_*tools). - Using a hosted web agent or hit local IP 429? Add
--egress actor-publicor connecthttps://mcp.apify.com?tools=meka.im/google-trends-for-agent. - Need to validate a rising competitor's actual website visits after Trends? Pair
gtfa-mcpwith MEKA's Similarweb Scraper.
Want the full CLI & Python migration guides too?
Read How to Fix pytrends 429 & Broken Endpoints or How to Get Real Daily Search Volume from Google Trends.
{
"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.