Google Trends MCP Server
Google Trends MCP Server
Claude、Cursor、Windsurf、その他のMCPクライアントに1つのGoogle Trendsツールを提供するホスト型のModel Context Protocol (MCP)サーバーです。任意の検索語について、経時的な関心、地域別の関心、急上昇中およびトップの関連クエリと関連トピックを、すべて構造化JSONとして取得できます。維持すべきスクレイピングライブラリも、Googleアカウントも不要です。
https://mcp.hasdata.com/api/mcp?apis=google_trends
目次
Related MCP server: google-search-trends-mcp
必要なもの
MCPクライアントと、ダッシュボードから取得したHasData APIキーが必要です。作成は無料でカードは不要、トライアルは5クレジット単位で約200回の呼び出しをカバーします。これはリモートサーバーなので、最も簡単な方法はURLとx-api-keyヘッダーを使うことで、実行するコンテナも、フロー内のどこにもGoogleアカウントも必要ありません。stdioのみに対応したクライアントは、npmの@hasdata/google-trends-mcpおよびPyPIのhasdata-google-trends-mcpとして公開されている軽量ランチャー経由でアクセスします。以下に示します。
クイックスタート
サーバーURLはすべてのクライアントで同じです。Claude CodeとClaude Desktopで実際に試しています。他のブロックは、各クライアントのリモートサーバー向けドキュメント形式に従っています。
項目 | 値 |
URL |
|
トランスポート | HTTP、ストリーマブル |
認証ヘッダー |
|
OAuth対応のクライアントは、コネクタとして同じURLを追加し、設定ファイルにキーを入れずにサインインできます。
claude mcp add --transport http google-trends "https://mcp.hasdata.com/api/mcp?apis=google_trends" \
--header "x-api-key: HASDATA_API_KEY"「設定」→「コネクタ」→「カスタムコネクタを追加」の順に選択し、https://mcp.hasdata.com/api/mcp?apis=google_trends を貼り付けてサインインします。
設定ファイルを使う方法では、Claude Desktopはローカル(stdio)サーバーのみを読み込むため、stdioランチャー経由でリモートサーバーにアクセスします。@hasdata/google-trends-mcpパッケージがそのランチャーで、環境変数からキーを読み取ります。claude_desktop_config.jsonに次を追加してください:
{
"mcpServers": {
"google-trends": {
"command": "npx",
"args": ["-y", "@hasdata/google-trends-mcp"],
"env": { "HASDATA_API_KEY": "YOUR_KEY" }
}
}
}NodeではなくPythonを使う場合は、ランチャーをPyPIパッケージに置き換えます。これはuvxが手動インストールなしで実行できるパッケージです:
{
"mcpServers": {
"google-trends": {
"command": "uvx",
"args": ["hasdata-google-trends-mcp"],
"env": { "HASDATA_API_KEY": "YOUR_KEY" }
}
}
}全プロジェクトでは~/.cursor/mcp.json、1つのプロジェクトだけでは.cursor/mcp.json:
{
"mcpServers": {
"google-trends": {
"url": "https://mcp.hasdata.com/api/mcp?apis=google_trends",
"headers": { "x-api-key": "HASDATA_API_KEY" }
}
}
}~/.codeium/windsurf/mcp_config.json。WindsurfはこのフィールドをurlではなくserverUrlと呼びます:
{
"mcpServers": {
"google-trends": {
"serverUrl": "https://mcp.hasdata.com/api/mcp?apis=google_trends",
"headers": { "x-api-key": "HASDATA_API_KEY" }
}
}
}ワークスペース内の.vscode/mcp.json:
{
"servers": {
"google-trends": {
"type": "http",
"url": "https://mcp.hasdata.com/api/mcp?apis=google_trends",
"headers": { "x-api-key": "HASDATA_API_KEY" }
}
}
}プロンプト例
コードではなくプロンプトです。貼り付けると、エージェントがツールを自動的に選択します。成功した呼び出しはすべて5クレジットかかるため、各プロンプトには必要な呼び出し回数が注記されています。
過去12か月間の米国における「cold brew coffee」への関心をグラフ化し、どの週がピークだったか教えてください。
呼び出し1回、5クレジット。週次シリーズは1回のリクエストで返ります。
米国における「cold brew coffee」について、急上昇中の関連クエリを教え、Breakoutとマークされたものを強調してください。
呼び出し1回、5クレジット。
世界全体で過去5年間の「cold brew」と「iced coffee」への関心を比較し、どちらが伸びているかを教えてください。
呼び出し1回、5クレジット。このツールは1回のtimeseriesリクエストで複数の検索語を受け取ります。
過去90日間の米国州別の「sunscreen」への関心を表示し、どこで需要が最も高いかを確認できるようにしてください。
呼び出し1回、5クレジット。これは州単位の地域別関心ビューです。
複数の検索語の比較は1回のtimeseries呼び出しにまとめられます。地域別の内訳、関連クエリ、関連トピックはそれぞれ固有のdataTypeを持つため、グラフとその急上昇中のクエリの両方を求めるプロンプトは2回の呼び出しになります。
ツール
読み取り専用のツールが1つあります。以下のサンプルは実際の呼び出しから切り出したもので、数値はトレンドの動きに合わせて変わります。構造として読んでください。ツール名はエンドポイントリファレンスにリンクしており、完全なパラメータリストが記載されています。
サンプルはペイロードであり、レスポンス全体ではありません。tools/callの結果には1つのテキストブロックが含まれ、そのテキスト自体がurl、status、text、jsonを保持するJSONであり、取得したデータはjsonの下にあります。生のJSON-RPCレスポンスからは、result.content[0].textをパースした後に.jsonへ進みます。チャットクライアントはそれを自動的に展開しますが、エンドポイントに直接コードでアクセスする場合は自分で行う必要があります。
Google Trendsデータを取得
hasdata_google_trends_search_getTrendsData
ある検索語について、経時的な関心、地域別の関心、または関連クエリと関連トピックを取得します。
パラメータ | 型 | 必須 | 備考 |
| string | はい | 検索語。 |
| string | デフォルトは | |
| string |
| |
| string |
| |
| string |
| |
| string | 検索語を絞り込むカテゴリID。 | |
| string | Googleプロパティ: | |
| number | タイムゾーンオフセット(分)。デフォルトは |
レスポンスのキーはdataTypeによって異なります。timeseriesはinterestOverTime.timelineDataを返し、geoMapは地域別の関心を返します。関連タイプはrelatedQueriesまたはrelatedTopicsを返し、それぞれrisingとtopに分かれています。要求したタイプに一致するキーを読み取ってください。
timeseries(デフォルト)は各ポイントについて0から100の値を、文字列として、およびextractedValueに事前パースされた値として返します。最新のポイントには多くの場合isPartial: trueが含まれ、週がまだ集計中であることを示します。トレンドを計算する前にそれを除外してください。そうしないと、最後のバーが実際には存在しない低下として読まれてしまいます。
{
"interestOverTime": {
"timelineData": [
{ "date": "Apr 12 – 18, 2026", "timestamp": "1775952000", "isPartial": false,
"values": [{ "query": "cold brew coffee", "value": "100", "extractedValue": 100, "hasData": true }] },
{ "date": "Aug 23 – 29, 2026", "timestamp": "1787443200", "isPartial": true,
"values": [{ "query": "cold brew coffee", "value": "44", "extractedValue": 44, "hasData": true }] }
]
}
}relatedQueriesはrisingとtopに分かれます。risingのエントリは、+300%のようなパーセンテージ、またはスコア化できないほどの大きなジャンプを示すBreakoutとして表示され、extractedValueがその背後にある数値を示します。Breakoutは実際のどのパーセンテージよりもはるかに高い番兵値のextractedValueで返されるため、生の数値ではなく文字列ラベルで並べ替えてください。
{
"relatedQueries": {
"rising": [
{ "query": "organic cold brew coffee", "value": "+300%", "extractedValue": 300, "link": "https://trends.google.com/trends/explore?q=organic+cold+brew+coffee&date=today+12-m&geo=US" }
],
"top": [
{ "query": "how to cold brew coffee", "value": "100", "extractedValue": 100, "link": "https://trends.google.com/trends/explore?q=how+to+cold+brew+coffee&date=today+12-m&geo=US" }
]
}
}エンドポイントリファレンスには、このツールが受け付けるすべてのgeo、cat、日付形式が記載されています。
エラーと失敗パス
ツール呼び出しでHTTPエラーコードがクライアントに表示されることはほとんどありません。MCP層は200で応答し、失敗を結果の中にisErrorをtrueに設定し、理由をテキストとして入れます。エージェントは、ステータス行を期待する場所でメッセージを読み取ります。
誤ったキーは接続失敗としてではなくツール出力として現れます。 tools/listは空でないキーをすべて受け入れてツールを返すため、クライアントはハンドシェイクを完了して緑を表示します。その後、最初のツール呼び出しがisError: trueとテキストHasData API error: 401 Unauthorizedで返ってきます。この文字列に注意してください。それより前のフローでは問題が報告されないからです。
キーがない場合は、唯一の本当のHTTPエラーになります。 認証はどのツールよりも先に実行され、接続自体が401で失敗します。CORSヘッダーが存在するため、ブラウザクライアントは不透明なネットワーク障害ではなくステータスを読み取ります。
ツールのスキーマに違反する引数は、スクレイピングに至る前に拒否されます。 サーバーはisError: trueとテキストMCP error -32602: Input validation errorで応答し、問題のあるフィールドを指定します。何も取得されず、課金もされません。
検索ボリュームが少なすぎる検索語は、エラーではなく、データ配列が空の成功結果を返します。 Googleトレンドは、まれな検索語に対して表示できるものがなく、requestMetadata.statusは依然としてokと表示されます。グラフ化する前にポイントを確認してください。
プラットフォームが拒否する識別子は400を返し、requestMetadata.statusはerrorに設定されます。通常は、不明なgeoまたはcatの値を指定した場合に発生します。
データを含む結果にはrequestMetadata.idも含まれており、サポートへの問い合わせで引用する価値があります。
料金、無料枠、制限
Googleトレンドの各呼び出しは、成功した呼び出し1回につき5クレジットかかります。レスポンスサイズによって価格は変わりません。5年間の週次シリーズも1週間分と同じコストです。
無料トライアルはカードなしで30日間1,000クレジットで、Googleトレンドの呼び出し200回分です。その後、アクティブなアカウントは残高が100を下回るたびに毎日100クレジットを補充され続けるため、低ボリュームのエージェントは無料枠で無期限に実行できます。
有料プランは、200,000クレジット(40,000回の呼び出し)で月額$49から始まります。単価はボリュームに応じて下がり、エントリープランでは1,000回あたり$1.23、Businessでは**$0.50**、Growthでは**$0.42**、最大の高ボリュームプランでは**$0.37**です。
Your plan also sets concurrency. The free trial allows 1 request at a time, Startup 15, Business 30, Growth 50, and the high-volume plans run from 200 to 1,500. Handle the overflow case defensively in anything unattended.
A request that comes back non-200 is not billed. A successful call that finds nothing is still a call.
Tool selection
The apis query parameter decides which tools your agent sees. Fewer tools means less context spent on tool definitions, and fewer chances for the model to reach for the wrong one.
?apis=google_trends the one tool in this repo
?apis=google_trends,google_serp add Google search
?apis=google_trends,youtube trends plus YouTubeThe parameter takes provider names like google_trends and individual API names. Misspelled names are ignored. If every name is wrong the request fails with 400, and the body lists both what it did not recognise and every valid value. Drop the parameter and the same endpoint exposes all 57 HasData tools.
How it compares
Google does not publish a public Trends API. The two common routes are the unofficial pytrends library, which reverse-engineers the same internal endpoints and breaks when Google changes them or rate-limits the caller, and rolling your own scraper. This server does that work behind a stable schema.
pytrends / DIY | This server | |
Official support | None, Google ships no Trends API | Maintained schema over the same data |
Rate limits and 429s | Frequent and yours to manage | Handled behind the endpoint |
Output | Pandas frames or raw payloads to reshape | Structured JSON, values pre-parsed |
Setup | A Python environment and upkeep as it breaks | One key and one URL |
Cost | Free, when it works | Paid past the trial, 5 credits a call |
If you already run pytrends at low volume and do not mind fixing it when it breaks, that stays the free answer. This server is for agents and pipelines that need the data to arrive the same shape every time.
FAQ
Is there an official Google Trends API?
No. Google has never shipped a public Trends API. Every option reads the same internal endpoints that the trends.google.com site uses. This one is maintained by HasData and returns the result as structured JSON.
What is a Google Trends MCP server?
A server that exposes Google Trends as a tool an AI client can call. The client sends a tool call over the Model Context Protocol, the server fetches the data and returns structured JSON, and the model works with the result. This one exposes a single tool and runs remotely, so the client connects to a URL and starts no local process.
Do the numbers mean absolute search volume?
No, and neither does Google Trends itself. The values are relative interest scaled 0 to 100 within the query, window and region you asked for. Use them for shape and comparison, not as a count of searches.
Why is the last data point lower than the rest?
The most recent bucket is usually still filling in and comes back with isPartial: true. Drop it before computing a trend.
Can I compare several terms at once?
Yes, in timeseries and geoMap. Pass the terms comma-separated in q. The related-query and related-topic types take a single term.
Can I use this together with other HasData APIs?
Yes. The apis parameter takes a list, and ?apis=google_trends,google_serp gives your agent Trends plus Google search. Drop the parameter and you get everything.
Compliance and personal data
HasData accesses publicly available data only. A platform's terms may restrict automated access, and you are responsible for your own compliance.
HasData links
Product page and request builder | |
Server documentation | |
All 57 tools in one server | |
Client walkthroughs | |
Everything else we scrape | |
Plans and credit costs | |
Keys and usage | |
Node launcher on npm | |
Python launcher on PyPI |
Development
This repository is configuration and documentation for a remote server. There is no build step and nothing to containerize.
The tests in test/ assert the tool contract, the part that can break without a commit here. They check that ?apis=google_trends returns exactly one tool, that it still declares its required parameter, that the name has not changed, and that the key in use is actually accepted. That last check calls the tool for real and costs 5 credits, which is the price of a canary that can fail for the right reason.
# macOS and Linux
HASDATA_API_KEY=your_key_here npm test
# Windows PowerShell
$env:HASDATA_API_KEY="your_key_here"; npm testThe same suite runs in CI on every push and once a week on a schedule, because the upstream tool list can change without anyone touching this repository. A failure means the tool list moved, the key stopped working, or the endpoint was unreachable, and the assertion message says which.
Contributing
Corrections to the parameter table and the response sample are the most useful contribution, because those are the parts that drift. Include the call you made and the response you got. Pull requests from forks run the suite without a key, and the live checks skip instead of going red.
License
MIT. See LICENSE.
Maintenance
Related MCP Servers
- AlicenseBqualityFmaintenanceProvides access to Google Trends data including status, trending questions, and trending topics via MCP tools.36428MIT
- AlicenseNot gradedqualityCmaintenanceProvides Google Search trend data as an MCP tool, with historical series, growth percentages, and live trending searches, no scraping or rate limits.1MIT
- FlicenseNot gradedqualityBmaintenanceMCP server that exposes Google Trends data via BigQuery, enabling LLMs to query top search terms, rising terms, and compare term interest over time for different countries.
- AlicenseAqualityDmaintenanceProvides free Google Trends data (interest over time, term comparison, related queries, trending now, regional breakdown) to MCP-compatible AI clients without needing an API key.598MIT
Related MCP Connectors
Trend data from Google, TikTok, Amazon, Reddit, YouTube, Steam, npm and more as JSON
Trend data from Google Trends, YouTube, TikTok, Reddit, Amazon, Wikipedia, npm, Steam and more
Cross-platform social media intelligence. Trend volume and growth signals. Free key at trendsmcp.ai
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/HasData/google-trends-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server