The most common Python approach to trend data is pytrends - an unofficial Google Trends scraper that works until it does not. Trends MCP is accessible via standard HTTP from any Python script, returns structured JSON with absolute volume estimates and data quality scores, covers 15+ sources, and does not break when Google updates its frontend. No SDK required, no special library, just an HTTP call with an Authorization header.
Python developers who need trend data have historically had one main option: pytrends. It is free, widely documented, and integrates well with pandas. It is also an unofficial scraper built on reverse-engineered Google Trends endpoints, which means its status as a reliable production dependency is always conditional.
Trends MCP is a different approach. It is a managed HTTP API with a consistent JSON schema, no scraping, absolute volume estimates, and 15+ data sources. From Python, calling it requires nothing more than the requests library.
pytrends has been widely used since 2015. The problem is not that it fails often - it works fine most of the time. The problem is the failure mode when it does break.
Google updates its Trends frontend 1-4 times per year in ways that break pytrends. When this happens, every pipeline using pytrends starts returning errors overnight, with no warning. The fix depends on the open-source community identifying the change, writing a patch, merging it, and releasing a new version. This process has historically taken anywhere from a few days to several weeks, depending on the severity of the change and maintainer availability.
For a research notebook, waiting a week for a fix is inconvenient. For a production pipeline that feeds a dashboard or a model, it is a hard outage. Trends MCP is a managed service - infrastructure issues are handled on the provider side.
The endpoint is a standard HTTPS URL accepting POST requests with JSON-RPC bodies. Authentication is an Authorization Bearer header with your Trends MCP API key.
import requests
API_KEY = "your_api_key"
ENDPOINT = "https://api.trendsmcp.ai/mcp"
def call_trends_mcp(tool_name: str, params: dict) -> dict:
payload = {
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": tool_name,
"arguments": params
},
"id": 1
}
response = requests.post(
ENDPOINT,
json=payload,
headers={"Authorization": f"Bearer {API_KEY}"}
)
return response.json()
result = call_trends_mcp("get_trends", {
"keyword": "large language models",
"source": "google",
"data_mode": "weekly"
})
The response follows the MCP JSON-RPC schema. The actual trend data is inside result["result"]["content"][0]["text"], which is a JSON string that you parse to get the time series array.
Once you have the time series, loading it into pandas is straightforward:
import json
import pandas as pd
trend_json = json.loads(result["result"]["content"][0]["text"])
time_series = trend_json.get("data", [])
df = pd.DataFrame(time_series)
df["date"] = pd.to_datetime(df["date"])
df = df.set_index("date")
The data_quality_score column is worth using immediately. Filtering out rows where data_quality_score < 0.4 removes low-confidence data points before any analysis, which is better than discovering them as outliers later.
get_growth with multiple sources in a single call returns all platform growth rates at once. This is the most efficient pattern for building cross-platform feature sets:
growth_result = call_trends_mcp("get_growth", {
"keyword": "electric vehicles",
"source": "google, tiktok, reddit, amazon, youtube",
"percent_growth": ["1M", "3M", "6M", "1Y"]
})
growth_data = json.loads(growth_result["result"]["content"][0]["text"])
One request, five sources, four time periods each. The equivalent in pytrends would require five separate Google Trends calls, scraping a different site for Reddit and TikTok, and manual normalization before any comparison was valid.
For Python AI agent frameworks that support MCP (LangChain, CrewAI, PydanticAI, AutoGen), Trends MCP integrates as a tool definition. The agent can call get_trends, get_growth, get_ranked_trends, and get_top_trends in response to natural language instructions - no custom wrapper code required once the MCP connection is configured.
For frameworks that use MCP tool definitions natively, the server URL is https://api.trendsmcp.ai/mcp with HTTP transport. The tool schemas are exposed via the MCP tools/list endpoint.
Tools for this workflow
get_trendsRetrieve a full 5-year weekly time series for any keyword and source - returns a JSON array of date/value/volume objects ready for pandas DataFrame construction.
get_trends(keyword='electric vehicles', source='google', data_mode='weekly')
get_growthCompute period-over-period growth rates for any keyword across multiple sources in one call - returns a flat dict of source: {growth_rate, start_volume, end_volume} for direct use as model features.
get_growth(keyword='electric vehicles', source='google, tiktok, reddit, amazon', percent_growth=['1M', '3M', '1Y'])
get_ranked_trendsRetrieve ranked lists of the fastest-growing keywords on any platform - useful for generating keyword candidate sets without manual curation.
get_ranked_trends(source='google', sort='yoy_pct_change', limit=50)
get_top_trendsPull what is trending right now with no seed keyword - for pipelines that need to capture current trending topics on a schedule.
get_top_trends(type='TikTok Trending Hashtags', limit=30)
FAQ