Skip to main content
Glama
jain-eshan

Google Trends MCP

by jain-eshan

Google Trends MCP

A local MCP server that lets Claude (or any MCP client) query Google Trends directly — search interest over time, related queries and topics, regional breakdowns, and real-time trending searches — so you can do market research inside a conversation instead of tab-switching to trends.google.com and pasting screenshots back in.

Built for personal/self-use market research. No API key required — Google Trends has no official public API, so this wraps pytrends, the standard unofficial Python client, in an MCP server.

工具

所有工具默认使用 geo="IN"(印度),除非另有说明 —— 传入 geo="" 表示全球范围,或任意一个 ISO 国家/地区代码(如 "US""GB" 等)。timeframe 接受 pytrends 的格式,例如 "today 12-m""today 5-y""now 7-d",或一个明确的区间,如 "2024-01-01 2024-06-01"

interest_over_time(keywords, timeframe="today 12-m", geo="IN")

相对搜索兴趣(0–100)随时间的变化,最多支持 5 个关键词并排对比。第 6 个及之后的关键词会被静默丢弃。每条记录都包含 isPartial —— 最近一个数据点上的 true 表示该周期尚未完成,其值是临时值;不要把该点的下降解读为真实的趋势变化。

单关键词的热门和相关查询。返回 {"top": [...], "rising": [...]},每个字段都是 {"query": ..., "value": ...} 记录的列表。top 的值是 0–100 的相对兴趣。rising 的值是百分比增长 —— 但是,当值为 5000% 时是 Google 的 Breakout 标记,表示从近乎为零的基数上爆发的增长,而不是字面意义的百分比。

related_queries 相同,但返回的是主题分组(Google 自己的主题聚类),而不是原始查询字符串 —— 记录中除了 value 之外,还包含 topic_titletopic_typerising 同样适用 Breakout 约定。

interest_by_region(keyword, timeframe="today 12-m", geo="IN")

在给定的 geo 范围内,按州/地区细分关键词的搜索兴趣。返回一个由 {"geoName": ..., "<keyword>": 0-100} 组成的列表,每个地区一条记录。

某个国家的今日热门搜索。请注意,这里的 geo 格式不同 —— 它是完整的小写国家名称("india""united_states"),不是像其他四个工具那样的 ISO 代码。这是 Google 自身端点的真实不一致,而不是 bug。

已知限制: 截至撰写本文时,trending_now 遇到 HTTP 404 而失败。Google 似乎已弃用了 pytrends 的 trending-search 方法所依赖的旧端点(hottrends/dailytrends/realtimetrends)——这一结论已通过测试 pytrends 提供的全部三种变体得到确认。这是上游问题,无法在此代码库中修复;它以干净的、可读的错误字符串失败,而不是崩溃。其他 4 个工具使用另一组仍然可用的不同端点,因此不受影响。如果 Google 恢复该端点、或 pytrends 提供补丁,这里无需任何改动即可恢复工作。

所有工具都会捕获失败情况(接口限流、网络错误、上述情况)并返回普通的错误字符串而不是崩溃 —— Google Trends 是一个被爬取的公网端点,不是稳定的 API,因此这是预期行为,不是例外情况。

设置

需要 Python 3.10+ 和 uv

git clone https://github.com/jain-eshan/google-trends-mcp.git
cd google-trends-mcp
uv sync

注册到 Claude Code

claude mcp add google-trends -- uv run --directory /absolute/path/to/google-trends-mcp server.py

验证连接:

claude mcp list

你应该会看到 google-trends 被列为 ✔ Connected。在注册后新的 Claude Code 对话中开始使用 —— 已经运行的会话不会检测到新添加的服务器。

使用

注册后,只需让 Claude 使用它即可 —— 例如:

“使用 google-trends MCP 对比印度过去 12 个月中 ‘lab grown diamonds’ 与 ‘diamond jewellery’ 的装机兴趣,并展示相关查询。”

可选:/trends 技能

本仓库包含一个位于 .claude/skills/trends/SKILL.md 的 Claude Code 技能,它会将原始工具包装成一个研究、总结工作流 —— 该技能决定哪些工具与你的主题相关,并写出一份通俗易懂的总结,而不是输出原始 JSON。如果你在使用 Claude Code,该技能会自动从本仓库加载;只需运行:

/trends <your topic>

设计说明

  • 只提供数据,服务器内不做总结。 每个工具只返回原始的、结构化数据 —— 如何解读(这个趋势是否真实、这里的 Breakout 标记意味着什么、什么值得标记)发生在调用它的对话中,而不是内建在服务器里。这让服务器保持简单,并让任何调用者在里面做出自己的判断。

  • 依赖只有 mcp[cli]pytrends 没有数据库、没有配置文件、没有 API 密钥。

  • 没有正式的测试套件。 它封装的是一个被爬取的第三方端点;只有测试套件大多只是测试 pytrends 和 Google 当前的响应结构,并不是测试这段代码。开发期间,每个工具都在真实的 Google Trends 数据上验证过。

许可证

MIT —— 见 LICENSE

-
license - not tested
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • Cross-platform social media intelligence. Trend volume and growth signals. Free key at trendsmcp.ai

  • Trend data from Google Trends, YouTube, TikTok, Reddit, Amazon, Wikipedia, npm, Steam and more

  • Topics gaining momentum before they peak. Trend volume and growth signals. Free key at trendsmcp.ai

View all MCP Connectors

Latest Blog Posts

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/jain-eshan/google-trends-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server