Skip to main content

Python client for the Trends MCP API. Keyword trend time series and growth rates across Google Search, YouTube, Reddit, Amazon, TikTok, Wikipedia, npm, Steam, and more.

Project description

trendsmcp

PyPI version Python versions License: MIT

The number one Python client for live keyword trend data. Time series and growth percentages from Google Search, YouTube, Reddit, Amazon, TikTok, Wikipedia, npm, Steam, and more. One API key. No scraping. No proxies. No 429 errors.

Works as a Python API client in any script, notebook, or pipeline. Also works as an MCP tool — plug it directly into Claude, Cursor, VS Code Copilot, or any MCP-compatible AI host.

Powered by trendsmcp.ai.

Get a free API key — 100 requests/month, no credit card.

Full API docs


Requirements

Python 3.8 or later. Depends on httpx.


Install

pip install trendsmcp

Connect

Store your API key in an environment variable:

export TRENDSMCP_API_KEY="your-api-key"
import os
from trendsmcp import TrendsMcpClient

client = TrendsMcpClient(api_key=os.environ["TRENDSMCP_API_KEY"])

Get your key at trendsmcp.ai.


get_trends

Returns a weekly time series for a keyword. Default is 5 years of weekly data. Pass data_mode="daily" for the last 30 days at daily granularity.

import os
from trendsmcp import TrendsMcpClient

client = TrendsMcpClient(api_key=os.environ["TRENDSMCP_API_KEY"])

series = client.get_trends(source="google search", keyword="bitcoin")

print(series[0])
# TrendsDataPoint(date='2021-01-03', value=12, volume=None, keyword='bitcoin', source='google search')

print(series[-1])
# TrendsDataPoint(date='2026-03-23', value=47, volume=None, keyword='bitcoin', source='google search')

# Daily granularity
series = client.get_trends(source="youtube", keyword="bitcoin", data_mode="daily")

Parameters

Parameter Type Required Description
source str Yes Data source (see supported sources below)
keyword str Yes Keyword to query
data_mode str No "weekly" (default) or "daily"

Response fields

Field Type Description
date str ISO date string
value float Normalized value 0 to 100
volume float or None Absolute volume estimate where available
keyword str The keyword queried
source str The data source

get_growth

Returns period-over-period growth percentages for a keyword.

growth = client.get_growth(
    source="google search",
    keyword="bitcoin",
    percent_growth=["3M", "12M", "YTD"],
)

for r in growth.results:
    print(f"{r.period}: {r.growth:+.1f}% ({r.direction})")
# 3M: +8.2% (increase)
# 12M: +31.4% (increase)
# YTD: +14.5% (increase)

Growth presets: 7D 14D 30D 1M 2M 3M 6M 9M 12M 1Y 18M 24M 2Y 36M 3Y 48M 60M 5Y MTD QTD YTD

Custom date ranges:

from trendsmcp import TrendsMcpClient, CustomGrowthPeriod
import os

client = TrendsMcpClient(api_key=os.environ["TRENDSMCP_API_KEY"])

growth = client.get_growth(
    source="amazon",
    keyword="air fryer",
    percent_growth=[
        CustomGrowthPeriod(name="holiday lift", recent="2025-12-31", baseline="2025-10-01")
    ],
)

get_top_trends

Returns today's live trending items from platform feeds. Omit type to get all feeds at once.

trending = client.get_top_trends(type="Google Trends", limit=10)
print(trending.data)
# [[1, 'tiger woods'], [2, 'miley cyrus'], ...]

# All feeds at once
all_feeds = client.get_top_trends()

Available feeds: Google Trends YouTube TikTok Trending Hashtags Reddit Hot Posts Amazon Best Sellers Top Rated App Store Top Free App Store Top Paid Wikipedia Trending Spotify Top Podcasts X (Twitter)


Async

All three methods are available on AsyncTrendsMcpClient. Run multiple platform queries concurrently:

import asyncio
import os
from trendsmcp import AsyncTrendsMcpClient

async def main():
    client = AsyncTrendsMcpClient(api_key=os.environ["TRENDSMCP_API_KEY"])

    google, youtube, reddit = await asyncio.gather(
        client.get_trends(source="google search", keyword="AI"),
        client.get_trends(source="youtube", keyword="AI"),
        client.get_trends(source="reddit", keyword="AI"),
    )
    print(f"Google: {google[-1].value}  YouTube: {youtube[-1].value}  Reddit: {reddit[-1].value}")

asyncio.run(main())

Error handling

from trendsmcp import TrendsMcpClient, TrendsMcpError
import os

client = TrendsMcpClient(api_key=os.environ["TRENDSMCP_API_KEY"])

try:
    series = client.get_trends(source="google search", keyword="bitcoin")
except TrendsMcpError as e:
    print(e.status)   # HTTP status code, e.g. 429
    print(e.code)     # Machine-readable code, e.g. "rate_limited"
    print(e.message)  # Human-readable message

Use with Pandas

import pandas as pd
import os
from trendsmcp import TrendsMcpClient

client = TrendsMcpClient(api_key=os.environ["TRENDSMCP_API_KEY"])
series = client.get_trends(source="google search", keyword="bitcoin")
df = pd.DataFrame([vars(p) for p in series])
print(df.tail())

Supported sources

source What it measures
"google search" Google Search volume
"google images" Google Images search volume
"google news" Google News search volume
"google shopping" Google Shopping purchase intent
"youtube" YouTube search volume
"tiktok" TikTok hashtag volume
"reddit" Reddit mention and discussion volume
"amazon" Amazon product search volume
"wikipedia" Wikipedia page views
"news volume" News article mention count
"news sentiment" News sentiment score (positive / negative)
"npm" npm package weekly downloads
"steam" Steam concurrent player count

All values are normalized 0 to 100 so you can compare across sources directly. See trendsmcp.ai/docs for the full and always up-to-date source list.


Why not pytrends?

pytrends scrapes Google and has been archived since 2023. It breaks regularly, returns 429 errors, requires proxies, and only covers Google Search with relative scores. No absolute volume. No other platforms.

trendsmcp is a managed REST API. One key, all sources, no scraping, no 429s, actively maintained.


Related packages

Platform-specific packages that expose the same client with a pre-set SOURCE constant:


License

MIT

Project details


Download files

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

Source Distribution

trendsmcp-1.0.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

trendsmcp-1.0.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file trendsmcp-1.0.2.tar.gz.

File metadata

  • Download URL: trendsmcp-1.0.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for trendsmcp-1.0.2.tar.gz
Algorithm Hash digest
SHA256 8e7e63379754c3c8be7bc60ac5ad6963d61ba58fd3830147650fa9bc6b8c2ff9
MD5 4b284b23d2121e6086186a7724852f14
BLAKE2b-256 cd8cf067ad6bcb349f37d643c3ca7bc6941bb8cc7e572628521f0d7a620c4050

See more details on using hashes here.

Provenance

The following attestation bundles were made for trendsmcp-1.0.2.tar.gz:

Publisher: publish.yml on trendsmcp/trendsmcp-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trendsmcp-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: trendsmcp-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for trendsmcp-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e9a87361e23b2ea666e2559cbd6370de126e252b6cf7cff0893469bd43896811
MD5 c2fd293153b248841b2ff2d6a7edd36f
BLAKE2b-256 388e860b163d5affec53e4a79aaff00fe3022bae4ab39f9fec0a534b1fedf028

See more details on using hashes here.

Provenance

The following attestation bundles were made for trendsmcp-1.0.2-py3-none-any.whl:

Publisher: publish.yml on trendsmcp/trendsmcp-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page