Connect Vercel AI SDK apps to live trend data

Teams building on the Vercel AI SDK need grounded trend pulls inside route handlers and agents. Trends MCP exposes Google, Amazon, TikTok, Reddit, YouTube, and 20 more sources through one HTTP MCP endpoint that maps cleanly to createMCPClient.

Developers shipping AI features on Vercel increasingly pair generateText with external tools. Search interest for the Vercel AI SDK rose roughly 29% on Google Search over the 12 months ending 2026-06-06, while interest in the Model Context Protocol climbed about 75% over the same window (Trends MCP, google search, 2026-06-08). That overlap explains why teams search for a trend data source that speaks MCP natively instead of bolting on scrapers per platform.

Why route handlers need a managed trend MCP server

A typical product brief asks the model to compare demand across Google, Amazon, and TikTok before suggesting copy or inventory moves. Without tools, the model guesses from training cutoffs. With a pile of unofficial scrapers, the route handler inherits 429 errors, proxy bills, and schema drift every time a platform changes markup.

Trends MCP centralizes those pulls behind https://api.trendsmcp.ai/mcp for MCP hosts and https://api.trendsmcp.ai/api for direct JSON POSTs. Values normalize to a 0 to 100 scale where the pipeline supports it, which keeps multi-source answers comparable inside a single assistant turn.

Minimal createMCPClient setup

Install the MCP client package alongside the AI SDK, then open a remote client in a server action or route handler:

import { createMCPClient } from "@ai-sdk/mcp";
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";

const mcpClient = await createMCPClient({
  transport: {
    type: "http",
    url: "https://api.trendsmcp.ai/mcp",
    headers: {
      Authorization: `Bearer ${process.env.TRENDSMCP_API_KEY}`,
    },
  },
});

const tools = await mcpClient.tools();

const result = await generateText({
  model: openai("gpt-4.1"),
  tools,
  prompt:
    "Using TrendsMCP, compare 12M Google Search and Amazon growth for 'standing desk'. Cite the returned dates.",
});

await mcpClient.close();

Store the API key in environment variables on Vercel, never in client bundles. The full MCP reference lists field names for get_trends, get_growth, and get_top_trends.

When to keep MCP and when to call REST

Interactive chat surfaces benefit from MCP because the model can chain discovery and validation. Background jobs often fare better with REST: a scheduled Vercel cron can POST fixed bodies, persist rows in Postgres, and let the UI read cached series without opening an MCP session per user.

Pattern Best fit Endpoint
Agent chooses keywords dynamically MCP tools via client.tools() https://api.trendsmcp.ai/mcp
Fixed nightly keyword list REST get_growth https://api.trendsmcp.ai/api
Dashboard tiles with known feeds REST mode: top_trends https://api.trendsmcp.ai/api

The headless trends API page walks through cache-friendly REST shapes if the frontend only renders stored JSON.

A three-call research loop inside one agent turn

Product and growth teams often follow the same sequence researchers document for LLM-native trend workflows:

  1. get_top_trends on Google Trends or TikTok Trending Hashtags when the user has no keyword yet.
  2. get_trends on the short-listed phrase across google search, youtube, and amazon for level and seasonality.
  3. get_growth with ["30D","6M","12M"] to separate a news spike from sustained demand.

E-commerce routes can swap amazon and google shopping into step 2. SEO-focused apps can add google news and news volume for citation timing. The multi-source trend validation page explains how to treat disagreements between channels.

Tool surface exposed to the model

get_trends

Return a dated weekly or daily series for a keyword on one source, ideal for chart components inside a dashboard route.

get_trends(keyword='running shoes', source='google shopping', data_mode='weekly')

get_growth

Compute 7D through multi-year growth windows in one call so agent responses cite numeric momentum instead of vague language.

get_growth(keyword='running shoes', source='amazon, google search', percent_growth=['3M', '12M'])

get_top_trends

Pull live leaderboards such as TikTok Trending Hashtags or Amazon Best Sellers when the user asks what is hot right now without naming a keyword.

get_top_trends(type='TikTok Trending Hashtags', limit=15)

Production checks before shipping

Close MCP clients after each request on serverless runtimes so connections do not linger across isolates. Log the recent_date and baseline_date fields from growth responses when writing analytics, because those timestamps anchor any chart the UI renders. Rate limits apply per API key; batch keywords in cron jobs instead of fanning out one HTTP call per table row.

Free accounts include 100 requests per month with no credit card. Upgrade paths live on pricing when production traffic exceeds that cap.

get_trends

Return a dated weekly or daily series for a keyword on one source, ideal for chart components inside a dashboard route.

get_trends(keyword='running shoes', source='google shopping', data_mode='weekly')

get_growth

Compute 7D through multi-year growth windows in one call so agent responses cite numeric momentum instead of vague language.

get_growth(keyword='running shoes', source='amazon, google search', percent_growth=['3M', '12M'])

get_top_trends

Pull live leaderboards such as TikTok Trending Hashtags or Amazon Best Sellers when the user asks what is hot right now without naming a keyword.

get_top_trends(type='TikTok Trending Hashtags', limit=15)

Common questions

Yes. Trends MCP publishes a remote HTTP MCP server at https://api.trendsmcp.ai/mcp. Pass that URL with an Authorization Bearer header in the transport block. The client exposes get_trends, get_growth, and get_top_trends as AI SDK tools your model can call during generateText or streamText.
Use MCP when the model should choose sources and keywords at runtime inside a chat or agent loop. Use POST https://api.trendsmcp.ai/api when a cron job or edge function needs fixed payloads, such as nightly growth checks written to a database. Both paths share one API key from https://trendsmcp.ai/account.
Remote deployments should use HTTP or streamable HTTP transport pointed at https://api.trendsmcp.ai/mcp. Stdio transport is for local MCP binaries, which Trends MCP does not require. Vercel's MCP documentation recommends HTTP for hosted servers, which matches this setup.
Include phrasing such as using TrendsMCP or via TrendsMCP in system instructions so the host routes demand questions to the connected tools. Pair that with explicit tool schemas from client.tools() so the model sees get_growth and get_top_trends as first-class options.
Get Connect Vercel AI SDK apps to live trend data in 30 seconds
Free tier includes 100 requests per month. No credit card required. Works with Claude, Cursor, ChatGPT, Raycast, and every MCP client.
Get your free API key