How AI Agents Can Use Real-Time Trend Data via API & MCP
Practical guide for developers: use TrendsAGI REST API, Python SDK and MCP so AI agents can pull real-time social trend velocity, insights and recommendations

Developers building AI agents that need current social and demand signals can pull real-time trend data through a REST API or the Model Context Protocol (MCP) instead of relying on training cut-offs or scraping. TrendsAGI supplies both a typed Python SDK with agent tools and a hosted MCP endpoint so agents can list rising topics, read velocity and growth metrics, fetch AI-generated insights, and optionally act on recommendations under explicit human or write-gate control.
The Model Context Protocol is an open-source standard that lets AI applications connect to external data sources and tools in a standardized way, analogous to a USB-C port for AI, according to modelcontextprotocol.io. TrendsAGI provides a hosted MCP server at https://api.trendsagi.com/mcp with OAuth sign-in plus a Python SDK that ships agent tools and an MCP server for Claude Desktop, Cursor, VS Code and similar clients. Multiple market-data providers have also shipped remote MCP servers in 2026 so AI agents can query live quotes and indicators without custom integrations; TrendsAGI focuses on broader social, search and paid-media trend intelligence rather than pure price data.
What real-time trend data gives an agent
For an autonomous research, content or paid-media agent, live trend signals mean the model can reason over topics that are currently accelerating rather than static knowledge. TrendsAGI measures velocity as a snapshot rate of posts per hour drawn from stored data, not a forecast or unique-user count. It also surfaces growth, volume, AI insights (summary, key themes, sentiment, audience, marketing angles), evidence-backed recommendations and crisis or watchlist alerts. Recommendation confidence reflects evidence completeness, not probability of success.
This data is useful for marketers, growth and paid-media teams, creators, newsrooms, PR and operations teams, and developers building AI agents. Ad-platform connectors (Google Ads, Meta Ads and Conversions API, TikTok Ads, LinkedIn Ads, Microsoft Ads, Pinterest Ads, Snapchat Ads, Reddit Ads) exist; changes are previewed before any explicit execution. Webhooks, Slack notifications and Google Sheets exports are also available. Zapier, Make and n8n connect through webhooks and the REST API; there is no native app for them.
Accessing trend data with the Python SDK
Install the official client (version 0.12.0 or later; agent-tool and MCP features are documented for 0.14.0 on pypi.org):
pip install trendsagi
Create a client that reads the key from the environment:
import os
from trendsagi import TrendsAGIClient
client = TrendsAGIClient(api_key=os.environ["TRENDSAGI_API_KEY"])
# List high-velocity trends in a category
trends = client.get_trends(category="Technology", sort_by="velocity", limit=5)
# Fetch AI insights and analytics for one trend
insights = client.get_ai_insights(trend_id)
analytics = client.get_trend_analytics(trend_id, period="7d")
# Search insights by theme
results = client.search_insights(key_theme_contains="AI chips")
# Pull high-priority recommendations
recs = client.get_recommendations(limit=10, priority="high")
# Create a watchlist interest with a volume threshold
client.create_topic_interest(
keyword="edge AI",
alert_condition_type="volume_threshold",
volume_threshold_value=500
)
The same client supports the full REST surface: GET /api/trends (with category, search, sort_by, limit, page, period), category listing, per-trend detail, AI insights, analytics periods (24h|7d|30d), insight search, recommendations, crisis events, user interests/watchlist, and API-usage reporting. Authenticate with the header X-API-Key or Authorization: Bearer; keys are created in the account profile. The base URL is https://api.trendsagi.com.
Agent tools for OpenAI, Anthropic and LangChain
TrendsAGI ships agent tools that wrap the same capabilities. According to pypi.org (trendsagi 0.14.0), the package provides a typed REST client, agent tools for OpenAI function calling, Anthropic tool use and LangChain, an MCP server, and a plugin for Grok/Claude/Cursor. The tools are read-only by default; write tools are exposed only when allow_writes=True is set.
from trendsagi import TrendsAGIClient, TrendsAGITools
import os
client = TrendsAGIClient(api_key=os.environ["TRENDSAGI_API_KEY"])
tools = TrendsAGITools(client) # read-only
# tools = TrendsAGITools(client, allow_writes=True) # adds write tools
# Export schemas for the framework you use
openai_tools = tools.openai() # Chat Completions format
openai_resp = tools.openai_responses() # Responses API
anthropic_tools = tools.anthropic() # Claude tool use
langchain_tools = tools.langchain()
# Execute a tool call and unpack the result
response = tools.call("list_trends", {"category": "Technology"})
# Success shape: {"result": {"trends": [...], "total": N}}
# Failure shape: {"error": "...", "detail": "..."}
trend_id = response["result"]["trends"][0]["id"]
Documented tool names include list_trends, list_trend_categories, search_trend_insights, get_trend, get_trend_ai_insights, get_trend_analytics, list_recommendations, list_crisis_events, list_watchlist, get_api_usage, find_capability (0.14.0+), and the write tools add_to_watchlist and update_recommendation when writes are enabled. The same thirteen tools are available across formats.
Running the MCP server (local stdio or hosted OAuth)
For Claude Desktop, Cursor, VS Code or any MCP-compatible client you can run a local stdio server:
pip install "trendsagi[mcp]" # Python 3.10+
export TRENDSAGI_API_KEY=your_key
trendsagi mcp # or trendsagi-mcp
# Add --allow-writes for write tools
Claude Code example:
claude mcp add trendsagi --env TRENDSAGI_API_KEY=... -- trendsagi mcp
JSON config fragment for Claude Desktop, Cursor or VS Code:
{
"mcpServers": {
"trendsagi": {
"command": "trendsagi-mcp",
"env": {
"TRENDSAGI_API_KEY": "..."
}
}
}
}
TrendsAGI also runs a hosted MCP server at https://api.trendsagi.com/mcp that supports OAuth sign-in for Claude, Cursor and similar clients (documented on pypi.org). Hosted OAuth removes the need to manage a local process and API key in every client; local stdio is useful for air-gapped or highly customized agent runtimes. Both surfaces expose the same tool set.
Safety defaults, rate awareness and ad previews
Read-only is the default. Write tools (add_to_watchlist, update_recommendation) appear only when the caller explicitly constructs TrendsAGITools with allow_writes=True or starts the MCP server with --allow-writes. This keeps exploratory agents from mutating watchlists or recommendation state by accident.
Call get_api_usage (or the corresponding tool) to inspect remaining quota before long agent loops. Exact rate limits and plan tiers for TrendsAGI are listed at the subscription page; the SDK and MCP surface the same usage endpoint so an agent can decide whether to continue or back off. A separate product, Trends MCP, offers a free tier of 100 requests per month and paid plans starting at $19/month for 1,000 requests according to trendsmcp.ai; that product is distinct from TrendsAGI.
When an agent proposes an ad-audience or keyword change through the available ad-platform connectors, the platform previews the change before any explicit execution. Agents should surface that preview to a human or a policy gate rather than auto-committing spend.
End-to-end example: rising-trend research agent
The following sketch finds a high-velocity Technology trend, inspects its 7-day analytics and AI insights, then proposes a campaign adjustment for human approval. It stays read-only until a later write step is deliberately enabled.
import os
from trendsagi import TrendsAGIClient, TrendsAGITools
client = TrendsAGIClient(api_key=os.environ["TRENDSAGI_API_KEY"])
tools = TrendsAGITools(client) # read-only
# 1. Discover rising topics
list_resp = tools.call("list_trends", {
"category": "Technology",
"sort_by": "velocity",
"limit": 5
})
trends = list_resp["result"]["trends"]
top = trends[0]
trend_id = top["id"]
# 2. Check recent analytics
analytics = tools.call("get_trend_analytics", {
"trend_id": trend_id,
"period": "7d"
})
# 3. Read AI insights (summary, themes, audience, marketing angles)
insights = tools.call("get_trend_ai_insights", {"trend_id": trend_id})
# 4. Optionally surface high-priority recommendations
recs = tools.call("list_recommendations", {"limit": 5, "priority": "high"})
# 5. Agent reasoning step (pseudo)
# "Velocity is elevated, key theme matches our product line,
# audience segment overlaps existing Meta lookalike.
# Propose adding the top theme as a keyword expansion
# and refreshing the lookalike seed. Surface preview only."
# 6. Human or policy gate decides whether to call write tools
# or an ad connector after reviewing the preview.
# 7. Monitor remaining quota
usage = tools.call("get_api_usage", {})
The same sequence can be expressed with the raw client methods or inside an OpenAI / Anthropic / LangChain tool-calling loop by registering the schemas returned by tools.openai(), tools.anthropic() or tools.langchain(). Because velocity is a measured snapshot rate and recommendation confidence is evidence completeness, the agent should treat both as inputs to judgment rather than as guarantees of outcome.
Frequently asked questions
How can an AI agent access live trend data via MCP or REST without scraping?
Use the TrendsAGI REST API (base https://api.trendsagi.com) with an API key, the Python SDK, the local MCP server started by "trendsagi mcp", or the hosted MCP endpoint at https://api.trendsagi.com/mcp with OAuth. All paths return structured trend, velocity, insight and recommendation objects; no HTML scraping is required.
What tools does a TrendsAGI MCP server expose to agents?
The same tool set is available across MCP, OpenAI, Anthropic and LangChain formats: list_trends, list_trend_categories, search_trend_insights, get_trend, get_trend_ai_insights, get_trend_analytics, list_recommendations, list_crisis_events, list_watchlist, get_api_usage, find_capability, and optionally add_to_watchlist and update_recommendation when writes are enabled. pypi.org documents that the tools are read-only by default.
How do I install and authenticate the TrendsAGI Python SDK or hosted MCP endpoint?
Run pip install trendsagi (or pip install "trendsagi[mcp]" for the local server). Instantiate TrendsAGIClient(api_key=os.environ["TRENDSAGI_API_KEY"]). For the hosted MCP server use the OAuth flow at https://api.trendsagi.com/mcp. Local MCP is configured with the TRENDSAGI_API_KEY environment variable.
What rate limits and plan tiers apply to agent API or MCP usage?
Exact TrendsAGI limits depend on the plan listed at the subscription page; agents should call get_api_usage to inspect remaining quota. A separate product, Trends MCP, offers a free tier of 100 requests per month and paid plans starting at $19/month for 1,000 requests according to trendsmcp.ai.
How does TrendsAGI differ from pure market-data MCP servers?
Market-data MCP servers typically expose live quotes and indicators. TrendsAGI focuses on social and search trend velocity, growth, AI-generated insights, evidence-backed recommendations and mapping into paid-media audience and keyword updates, with ad changes previewed before execution.
Can agents both read trends and optionally write recommendations or watchlists?
Yes. Read tools are always available. Write tools (add_to_watchlist, update_recommendation) are exposed only when TrendsAGITools is constructed with allow_writes=True or the MCP server is started with --allow-writes. This opt-in keeps autonomous loops safe by default.
How we researched this
Prepared by TrendsAGI Research. Facts checked on 19 October 2026 against the sources listed below.
Capability descriptions and code use TrendsAGI's documented REST API, Python SDK and MCP server. External facts come from the sources below.
| Claim | Applies to | Source |
|---|---|---|
| TrendsAGI ships an official Python client that provides a typed REST client, agent tools for OpenAI function calling, Anthropic tool use and LangChain, an MCP server, and a plugin for Grok/Claude/Cursor. | 0.14.0 | pypi.org |
| TrendsAGI runs a hosted MCP server at https://api.trendsagi.com/mcp that supports OAuth sign-in for Claude, Cursor and similar clients. | All plans | pypi.org |
| The same thirteen tools are available across formats; they are read-only by default and write tools (add_to_watchlist, update_recommendation) are exposed only when allow_writes=True is set. | All plans | pypi.org |
| MCP is an open-source standard that lets AI applications connect to external data sources and tools in a standardized way, analogous to a USB-C port for AI. | All plans | modelcontextprotocol.io |
| Trends MCP (a separate product) offers a free tier of 100 requests per month and paid plans starting at $19/month for 1,000 requests. | Free / Starter | trendsmcp.ai |
We re-research and rewrite this page at least every four months; the updated date only changes when the facts are re-checked.
Sources
- What is the Model Context Protocol (MCP)? — modelcontextprotocol.io
- trendsagi 0.14.0 (PyPI) — pypi.org
- Trends MCP | MCP Server & API for AI Assistants & Agents — trendsmcp.ai