Google Trends MCP Server
Google Trends MCP Server
一个托管的 Model Context Protocol (MCP) 服务器,为 Claude、Cursor、Windsurf 以及任何其他 MCP 客户端提供一个 Google Trends 工具。你可以获取任意术语的随时间变化的兴趣度、按区域的兴趣度,以及上升和热门的相关查询和主题,全部以结构化 JSON 返回,无需维护抓取库,也无需 Google 账号。
https://mcp.hasdata.com/api/mcp?apis=google_trends
目录
Related MCP server: HasData MCP Server
你需要什么
你需要一个 MCP 客户端,以及从仪表盘获取的 HasData API 密钥。该密钥可免费创建,无需银行卡,试用版按 5 积分/次的价格大约覆盖 200 次调用。这是一个远程服务器,因此最简单的接入方式是使用一个 URL 和一个 x-api-key 请求头,无需运行容器,整个流程中也无需 Google 账号。仅支持 stdio 的客户端可以通过一个轻量级启动器访问它,该启动器以 @hasdata/google-trends-mcp 发布在 npm 上,以 hasdata-google-trends-mcp 发布在 PyPI 上,如下所示。
快速开始
服务器 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" }
}
}
}如果你使用 Python 而不是 Node,可将启动器换成 PyPI 包,uvx 无需手动安装即可运行它:
{
"mcpServers": {
"google-trends": {
"command": "uvx",
"args": ["hasdata-google-trends-mcp"],
"env": { "HASDATA_API_KEY": "YOUR_KEY" }
}
}
}~/.cursor/mcp.json 用于所有项目,或 .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 将该字段称为 serverUrl,而不是 url:
{
"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 个月的兴趣变化图,并告诉我它在哪些周达到峰值。
一次调用,5 积分。每周的序列会在单个请求中返回。
对于美国的“冷萃咖啡”,给我上升的相关查询,并标出标记为 Breakout 的项。
一次调用,5 积分。
将“冷萃”与“冰咖啡”在世界范围内五年间的兴趣度进行比较,并说明哪一个在增长。
一次调用,5 积分。该工具可在一次 timeseries 请求中接受多个术语。
向我展示“防晒霜”在美国各州过去 90 天的兴趣度,以便我了解哪里的需求最高。
一次调用,5 积分。这是按州粒度查看的区域兴趣度。
多个术语的比较在一次 timeseries 调用中完成。区域细分、相关查询和相关主题各自对应自己的 dataType,因此一个想要图表及其上升查询的提示需要两次调用。
工具
一个只读工具。下面的示例来自真实调用并经过删减,数字会随趋势变化而变化。请将其视为一种结构形态。工具名称链接到其端点参考,其中包含完整的参数列表。
示例是载荷,不是整个响应。tools/call 的结果包含一个文本块,该文本本身是 JSON,包含 url、status、text 和 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。上升条目显示为类似 +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 请求头存在,浏览器客户端会读取状态,而不是不透明的网络失败。
破坏工具模式(schema)的参数会在成为抓取请求之前被拒绝。 服务器返回 isError: true 和文本 MCP error -32602: Input validation error,并指出违规字段。不会获取任何内容,也不会产生任何费用。
搜索量太少的术语会返回成功结果,但数据数组为空,而不是错误。Google Trends 对罕见术语没有可显示的内容,requestMetadata.status 仍为 ok。在绘制图表之前请检查数据点。
平台拒绝的标识符会返回 400,并将 requestMetadata.status 设为 error。未知的 geo 或 cat 值是常见的触发方式。
包含数据的结果还带有 requestMetadata.id,在支持时值得引用。
定价、免费额度和限制
每次 Google Trends 调用花费 每次成功调用 5 积分。响应大小不改变价格。五年的每周序列与单周花费相同。
免费试用为 30 天内 1,000 积分,无需银行卡,即 200 次 Google Trends 调用。之后,活跃账户只要余额低于 100,每天都会获得 100 积分补充,因此低流量的代理可以无限期地在免费额度上运行。
付费计划起价为 每月 $49,提供 200,000 积分,即 40,000 次调用。单价随用量下降,从入门计划的 每 1,000 次调用 $1.23 降至 Business 计划的 $0.50、Growth 计划的 $0.42 和最大高用量计划的 $0.37。
你的套餐还规定了并发数。免费试用版允许同时 1 个请求,Startup 为 15,Business 为 30,Growth 为 50,高流量套餐从 200 到 1,500 不等。在任何无人值守的流程中,都要对溢出情况做防御性处理。
返回非 200 的请求不会被计费。成功调用但没有找到任何结果,仍然算一次调用。
工具选择
apis 查询参数决定你的代理能看到哪些工具。工具越少,意味着用于工具定义的上下文越少,模型选错工具的机会也越少。
?apis=google_trends the one tool in this repo
?apis=google_trends,google_serp add Google search
?apis=google_trends,youtube trends plus YouTube该参数接受提供方名称(如 google_trends)和单个 API 名称。拼写错误的名称会被忽略。如果所有名称都错误,请求将失败并返回 400,响应体会同时列出它无法识别的名称和所有有效值。省略该参数后,同一端点会暴露全部 57 个 HasData 工具。
对比
Google 没有发布公开的 Trends API。两种常见路径是:非官方的 pytrends 库(它逆向工程了相同的内部端点,当 Google 更改这些端点或对调用者限流时就会失效),以及自己编写爬虫。本服务器以一个稳定的结构完成这些工作。
pytrends / DIY | 本服务器 | |
官方支持 | 无,Google 没有提供 Trends API | 同一数据之上维护的结构 |
限流和 429 | 频繁,且需要自行管理 | 在端点背后处理完毕 |
输出 | Pandas 数据框或需要重塑的原始负载 | 结构化 JSON,数值已预先解析 |
设置 | Python 环境,以及在失效时进行维护 | 一个密钥和一个 URL |
费用 | 免费(在能用时) | 试用期后付费,每次调用 5 点积分 |
如果你已经在低流量下运行 pytrends,并且不介意在它失效时修复它,那它仍然是一个免费方案。本服务器面向那些需要每次都以相同结构获得数据的代理和流水线。
常见问题
有官方的 Google Trends API 吗?
没有。Google 从未发布过公开的 Trends API。所有方案读取的都是 trends.google.com 网站使用的相同内部端点。这个 API 由 HasData 维护,并以结构化 JSON 返回结果。
什么是 Google Trends MCP 服务器?
这是一种将 Google Trends 作为工具暴露给 AI 客户端调用的服务器。客户端通过 Model Context Protocol 发送工具调用,服务器获取数据并返回结构化 JSON,模型再处理结果。本服务器只暴露一个工具并远程运行,因此客户端连接到一个 URL 即可,无需启动本地进程。
这些数字表示绝对搜索量吗?
不,Google Trends 本身也不表示绝对搜索量。这些值是在你请求的查询、时间范围和地域内,按 0 到 100 缩放的相对兴趣度。请用它们来观察走势和进行对比,而不是当作搜索次数。
为什么最后一个数据点比其他数据点低?
最近的一个数据桶通常仍在填充中,返回时会带有 isPartial: true。在计算趋势前请先将其丢弃。
我可以同时比较多个词条吗?
可以,timeseries 和 geoMap 都可以。在 q 中以逗号分隔传入词条。related-query 和 related-topic 类型只接受单个词条。
我可以将它与其它 HasData API 一起使用吗?
可以。apis 参数接受一个列表,?apis=google_trends,google_serp 会让你的代理获得 Trends 和 Google 搜索。省略该参数 即可获得全部工具。
合规性和个人数据
HasData 仅访问公开可用的数据。平台的条款可能会限制自动化访问,你需要自行负责合规性。
HasData 链接
产品页面和请求构建器 | |
服务器文档 | |
一个服务器中的全部 57 个工具 | |
客户端入门指南 | |
我们抓取的其他所有内容 | |
套餐和积分费用 | |
密钥和使用情况 | |
npm 上的 Node 启动器 | |
PyPI 上的 Python 启动器 |
开发
本仓库是一个远程服务器的配置和文档。没有构建步骤,也不需要容器化。
test/ 中的测试用于验证工具契约,也就是即使这里没有提交也可能出问题的部分。它们会检查 ?apis=google_trends 是否恰好返回一个工具、是否仍然声明其必需参数、名称是否未变,以及正在使用的密钥是否确实被接受。最后一项检查会真实调用该工具并消耗 5 点积分,这就是金丝雀测试的代价——它可能因为正确的原因而失败。
# macOS and Linux
HASDATA_API_KEY=your_key_here npm test
# Windows PowerShell
$env:HASDATA_API_KEY="your_key_here"; npm test同一套测试会在每次推送时以及每周一次的定时任务中于 CI 中运行,因为上游工具列表可能在无人改动本仓库的情况下发生变化。一次失败意味着工具列表发生了变动、密钥失效或端点不可达,断言消息会说明具体是哪一种。
贡献
对参数表和响应示例的更正是最有用的贡献,因为这些部分容易出现偏差。请附上你发出的调用和你收到的响应。来自 fork 的拉取请求会在没有密钥的情况下运行测试套件,真实检查会被跳过,而不是显示为红色。
许可证
MIT。参见 LICENSE。
Available Tools
1 toolhasdata_google_trends_search_getTrendsDatagoogle_trends_search: GET /AInspect
Get Google Trends Data
Pulls Google Trends data for one or more queries with geo targeting, region granularity (country/subregion/metro/city), date range, category, time zone, Google property (web, images, news, shopping, YouTube), and dataType (timeseries, geoMap, relatedTopics, relatedQueries). Returns interest-over-time series, geo-level breakdowns, and rising/top related topics/queries with relative scores. Use for keyword/content strategy, demand forecasting, seasonality analysis, topic discovery, campaign timing, and adding live-trend signals to marketing or research agents.
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Specify the search term for which you want to retrieve trends data. | |
| tz | No | Defines a time zone offset in minutes. The default value is 420 (Pacific Daylight Time (PDT): UTC-7). The valid range for this parameter is from -1439 to 1439. To calculate the `tz` value for a specific time zone, you can use the time difference between UTC +0 and the desired time zone. Examples: - `420`: Pacific Daylight Time (PDT) - `60`: Central European Time (CET) - `-540`: Japan Standard Time | |
| cat | No | Category of the search term. The default value is 0 ("All categories"). Provide one exact documented value (1133 allowed), e.g. `0`, `3`. | |
| geo | No | Specifies the location for the search. Defaults to Worldwide if not set or empty. Provide one exact documented value (3517 allowed), e.g. `AF`, `AF-BDS`. | |
| date | No | Defines a date range for the search. Available options: - `now 1-H`: Past hour - `now 4-H`: Past 4 hours - `now 1-d`: Past day - `now 7-d`: Past 7 days - `today 1-m`: Past 30 days - `today 3-m`: Past 90 days - `today 12-m`: Past 12 months - `today 5-y`: Past 5 years - `all`: 2004 - present You can also specify a custom date range using one of the following formats: - `yyyy-mm-dd yyyy-mm-dd` - (e.g. 2021-10-15 2022-05-25) for dates from 2004 to present. - `yyyy-mm-ddThh yyyy-mm-ddThh` - (e.g. 2022-05-19T10 2022-05-24T22) for dates with hours within a week range. The hours will be calculated based on the tz (time zone) parameter. | |
| gprop | No | Sorts results by a specific property. The default property is Web Search (applied when the gprop parameter is not set or empty). Available options: - `images`: Image Search - `news`: News Search - `froogle`: Google Shopping - `youtube`: YouTube Search | |
| region | No | Used to get more specific results when using "Interest by region" data type. Other data types do not accept this parameter. The default value depends on the geo location that is set. Available options: - `country`: Country - `region`: Subregion - `dma`: Metro - `city`: City Note: Not all region options will return results for every geo location. | |
| dataType | No | Defines the type of search to perform. Available options: - `timeseries`: Interest over time (default). Accepts both single and multiple queries per search. - `geoMap`: Interest by region. Accepts both single and multiple queries per search. - `relatedTopics`: Related topics. Accepts only single query per search. - `relatedQueries`: Related queries. Accepts only single query per search. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of explaining behavior. It implies a read-only data retrieval operation through words like 'Pulls' and 'Returns', and mentions no destructive side effects. However, it does not explicitly state that the operation is read-only, nor does it mention authentication, rate limits, or potential errors, leaving some behavioral aspects implicit.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and front-loaded with the core purpose, followed by a compact summary of parameters and use cases. It avoids redundancy and stays focused, though the final list of use cases adds length without critical operational detail. Overall it is well-structured and not overly verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Without an output schema, the description gives a reasonable overview of expected outputs (interest-over-time series, geo-level breakdowns, related topics/queries with relative scores). It also covers parameter capabilities and domain use cases. It does not describe response formats, pagination, or error conditions, but given the tool's complexity and lack of output schema, the description is fairly complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
All eight parameters have detailed descriptions, covering defaults, allowed values, and format examples. The q parameter is described as a singular 'search term' while the main description says 'one or more queries', leaving ambiguity about how to pass multiple terms. Most other parameters are very well explained, but this minor gap prevents a perfect score.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool retrieves Google Trends data, enumerates the key parameters (geo, region, date, category, time zone, property, dataType), and distinguishes it from sibling tools by focusing specifically on Trends. The verb 'Pulls' and the listed outputs make the tool's purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit use cases such as keyword/content strategy, demand forecasting, seasonality analysis, and topic discovery, which strongly signal when an agent should select this tool. It does not explicitly mention when not to use it or point to alternatives, but given there is no other Google Trends sibling tool, the guidance is sufficient.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- First observed
hasdata_google_trends_search_getTrendsData
TDQS
Scored across 1 tool
With only a single tool, there is no risk of overlapping purposes or misselection. The single tool's scope and parameters are clearly described, making the tool's purpose immediately identifiable.
The tool name combines snake_case and camelCase ('getTrendsData') with a vendor-specific prefix, so the naming style is internally inconsistent. With only one tool, there is no broader pattern for the server to enforce.
One tool for a specialized Google Trends server is borderline. The tool is very broad and covers multiple data types, so it is usable, but it places a large command surface into a single entry point that might be easier to split into multiple focused tools.
The tool covers the full Google Trends feature set: timeseries, geo maps, related topics/queries, various filters, and property selection. No obvious major gap in the domain space.
Maintenance
Related MCP Connectors
Google Trends data as JSON: interest over time, rising and top queries, regions, Trending Now.
Google Trends: Search, Images, News, Shopping over time, growth metrics. Free key at trendsmcp.ai
Google Trends JSON + trend summary, $0.0025/keyword; rate-limited keywords never charged.
Google Trends Scraper API: Interest and Trending Now
Related MCP Servers
- AlicenseAqualityAmaintenanceA Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing.329,666 PyPI1,551MIT

HasData MCP Serverofficial
AlicenseAqualityAmaintenanceDirect access to 40+ scraping and search tools. Extract structured data from Google (Search, Maps, Trends), Amazon, Airbnb, Social Media, and any web page directly into your AI agent.6321MIT- AlicenseBqualityDmaintenanceProvides access to Google Trends data including status, trending questions, and trending topics via MCP tools.2325 npm34MIT
- AlicenseNot gradedqualityBmaintenanceProvides Google Search trend data as an MCP tool, with historical series, growth percentages, and live trending searches, no scraping or rate limits.1MIT