Skip to main content
Glama
TrendPulse - Google News & Trends

TrendPulse - Google News & Trends

mcp-trendpulse

MCP Python License

TrendPulse 是一个用于研究当前新闻和搜索兴趣趋势的 Python Model Context Protocol (MCP) 服务器。它将 Google News 发现与文章提取、Google Trends 分析相结合,使 MCP 客户端能够查看热门内容、比较关键词势头、探索相关需求,并为研究工作流添加上下文新闻背景。

该项目目前以 社区/自托管 MCP 服务器 形式发布,同时还包含一个独立的 TrendPulse by DigestSEO 托管层的实现,用于远程 MCP 客户端(如 ChatGPT 和 Codex)。托管层使用更小、面向目标的工具面,而社区服务器则保留完整、底层的研究工具包供开发人员使用。

项目状态: 本地/社区服务器目前即可使用。DigestSEO 托管的 MCP 和公开的 OpenAI 插件尚未发布,不应被视为可用端点。

工程背景:TrendPulse 是 DigestSEO MCP 生态系统的一部分。它补充了用于 Google Search Console 数据的 mcp-gsc、用于 AI 可见性的 mcp-geo,以及用于技术性网页验证的 mcp-web-validator。更广泛的架构记录在 DigestSEO MCP Suite 工程案例研究 中。

TrendPulse 能做什么

新闻研究

  • 按关键词、地点、主题或发布商域名搜索 Google News。

  • 获取热门新闻文章。

  • 解析 Google News 链接并提取文章内容。

  • 在难以处理的页面上,从普通 HTTP 检索回退到 Playwright/Chromium。

  • 可选地通过 MCP 客户端采样来总结文章文本,并使用本地 NLP 作为回退方案。

趋势研究

  • 获取某个地理市场的当前热门搜索词。

  • 提取一个或多个关键词的 Google Trends 随时间变化的兴趣数据。

  • 计算关键词在自定义时间窗口(如 3M 或 1Y)内的增长情况。

  • 按搜索量或增长对实时趋势进行排名。

  • 在支持的情况下,按国家、地区、城市或 DMA 查看兴趣数据。

  • 探索相关查询、相关主题、建议和类别 ID。

  • 在底层提供商支持的情况下,比较 Google Search、YouTube Search、News Search、Image Search 和 Google Shopping 的趋势属性。

Related MCP server: NewsIQ MCP

社区版与托管版架构

TrendPulse 正在开发两个精心设计的接口:

接口

用途

状态

Community MCP

用于本地使用、开发、自托管以及与兼容 MCP 的客户端集成的完整 Python MCP 服务器。

可在本仓库中获取

TrendPulse by DigestSEO

面向 ChatGPT/Codex 的托管远程 MCP,以及未来面向 OpenAI 的公开插件,提供更小、面向任务的工具面。

开发中

社区服务器本身仍然非常有用。托管版本将复用相同的核心趋势研究概念,同时增加托管服务所需的部署、可靠性、身份验证、可观测性和产品集成能力。

已实现的托管工具面刻意比社区 API 更上一层楼,并围绕以下目标展开:

  • discover_trends

  • analyze_keyword_trend

  • compare_keyword_trends

  • discover_related_demand

  • get_trend_context

  • find_seo_opportunities

这些名称描述的是托管的 ChatGPT Apps/MCP 接口;它们与当前 Community MCP 工具名称相互独立。

安装

使用 uvx 直接从 GitHub 运行(推荐)

该软件包尚未发布到 PyPI,因此最直接的安装方式是:

uvx --from git+https://github.com/AKzar1el/mcp-trendpulse.git mcp-trendpulse

在 PyPI 发布之后,更简短的形式将是:

uvx mcp-trendpulse

使用 pip 从检出目录安装

git clone https://github.com/AKzar1el/mcp-trendpulse.git
cd mcp-trendpulse
python -m pip install .
python -m mcp_trendpulse

浏览器回退

当普通检索无法提取到可用文章时,新闻/文章工具可以回退到 Playwright。安装 Python playwright 包并不会自动安装 Chromium。

用于本地使用:

playwright install chromium

对于还需要浏览器系统依赖项的 Linux 环境:

playwright install --with-deps chromium

仅趋势操作本质上不需要 Chromium。

客户端配置

Claude Desktop

使用 uvx 直接从 GitHub 运行:

{
  "mcpServers": {
    "mcp-trendpulse": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/AKzar1el/mcp-trendpulse.git",
        "mcp-trendpulse"
      ]
    }
  }
}

VS Code

{
  "mcp": {
    "servers": {
      "mcp-trendpulse": {
        "command": "uvx",
        "args": [
          "--from",
          "git+https://github.com/AKzar1el/mcp-trendpulse.git",
          "mcp-trendpulse"
        ]
      }
    }
  }
}

Cursor

Cursor 支持全局和项目级 MCP 配置。将服务器添加到相应的 mcp.json 配置中:

{
  "mcpServers": {
    "mcp-trendpulse": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/AKzar1el/mcp-trendpulse.git",
        "mcp-trendpulse"
      ]
    }
  }
}

ChatGPT 及其他云 MCP 客户端

该仓库现在包含一个专用的无状态 Streamable HTTP ASGI 入口点:mcp_trendpulse.asgi:app。它与此前保持不变并继续使用的 Community stdio 入口点是分开的。

为了进行受控的本地/私有测试,你可以使用 Uvicorn 运行 ASGI 应用,或使用提供的容器。有关加固容器、Host/Origin 允许列表、Chromium 沙箱要求、健康/就绪端点和反向代理注意事项,请参阅 deploy/README.md。

DigestSEO 托管的端点和公开的 ChatGPT 应用仍未 发布。托管部署现在支持默认拒绝的 Clerk OAuth 身份验证;除非已为该部署配置 Clerk issuer/JWKS/audience 设置、公共基础 URL 以及 Host/Origin 允许列表,否则不要公开暴露远程传输。

配置

TrendPulse 从进程环境以及本地 .env 文件(如果存在)加载环境变量。

有用的变量包括:

HTTP_PROXY=http://your-proxy-address:port
HTTPS_PROXY=http://your-proxy-address:port
GOOGLE_TRENDS_DELAY=2.0

GOOGLE_TRENDS_DELAY 控制当前趋势提供商使用的请求延迟。当上游服务对特定网络进行速率限制或封锁时,代理变量可能很有用。

远程部署还支持 TRENDPULSE_HTTP_PATH、TRENDPULSE_HTTP_ALLOWED_HOSTS、TRENDPULSE_HTTP_ALLOWED_ORIGINS 和 TRENDPULSE_BROWSER_SANDBOX。容器会显式启用 Chromium 沙箱;本地 Community 运行保留与 Playwright 兼容的默认设置,除非你选择启用。

不要提交密钥、私有代理凭据或特定于机器的 .env 文件。

MCP 工具

社区 MCP 服务器目前提供 16 个工具。

新闻工具

Tool

Purpose

get_news_by_keyword

查找与关键词匹配的最近新闻文章。

get_news_by_location

查找与某个地点相关的最近新闻。

get_news_by_topic

查找某个受支持的 Google News 主题的最近新闻。

get_top_news

获取 Google News 热门新闻。

get_news_by_site

查找来自特定发布商域名的最近新闻。

get_article_content

下载、验证、提取,并可选择总结一篇新闻文章 URL。

趋势工具

Tool

Purpose

get_trending_terms

获取某个地理目标当前的流行搜索词。

get_trends

获取一个或多个关键词的随时间兴趣变化数据点。

get_growth

计算请求时间窗口内的搜索兴趣增长。

get_ranked_trends

按增长或搜索量对当前趋势进行排名。

get_top_trends

在无需提供关键词的情况下获取热门趋势信息流。

get_interest_by_region

比较关键词在各地理区域的兴趣度。

get_related_queries

获取热门和相关上升的搜索查询。

get_related_topics

获取热门和相关上升的 Google Trends 主题。

get_suggestions

为查询解析自动补全/主题建议。

get_categories

获取 Google Trends 类别 ID 和名称。

示例:显式趋势时间窗口

get_trends 接受显式 timeframe。当你需要可重复的比较时,提供该参数更佳。

{
  "keyword": ["technical SEO audit", "AI SEO audit"],
  "geo": "US",
  "source": "google search",
  "timeframe": "today 12-m",
  "cat": 0
}

提供商支持的范围包括标准窗口,如 today 12-m 和 today 5-y;相对窗口,如 today 90-d、all;以及精确日期范围,如 2021-01-01 2026-01-01。

Google Trends 值是以 0-100 表示的归一化兴趣分数。请勿将 0-100 的兴趣序列理解为绝对搜索量。

CLI

独立的 Click CLI 提供了比 MCP 服务器更小、面向新闻的命令集:

uv run mcp-trendpulse-cli --help

当前 CLI 命令:

keyword
location
top
topic
trending

CLI 和 MCP 接口被有意分开记录,因为它们并不公开相同的命令集。

开发

使用你偏好的 Python 环境安装项目及其开发依赖项,然后运行单元测试套件:

python -m pytest

默认的 pytest 配置会排除实时集成测试。

使用以下命令显式运行实时提供商测试:

python -m pytest tests/integration -m integration

标记为浏览器集成的测试需要安装 Playwright Chromium。

使用以下命令运行 Ruff 检查:

ruff check .

MCP Inspector

通过 MCP Inspector 运行从 GitHub 发布的服务器:

npx @modelcontextprotocol/inspector uvx --from git+https://github.com/AKzar1el/mcp-trendpulse.git mcp-trendpulse

对于本地检出:

npx @modelcontextprotocol/inspector uv run mcp-trendpulse

打包

仓库中已经包含一个 GitHub Actions 工作流,用于在 GitHub 发布版本时通过 PyPI Trusted Publishing 构建并发布 Python 发行包。在第一个软件包版本发布之前,请使用上面显示的 GitHub uvx --from ... 命令。

安全说明

文章检索是一项出站网络功能,并被视为不可信输入。该实现会验证 HTTP(S) 目标,拒绝私有的、不可路由的目标,检查重定向目标,强制执行响应大小限制,并在使用 Playwright 时应用浏览器路由验证。

如果你远程部署 TrendPulse,请保留这些控制措施,并增加部署级别的速率限制、请求超时、可观测性和资源限制,而不是仅依赖应用程序默认设置。

路线图

当前的生产就绪工作集中在:

  1. 保持文档、打包元数据和生成的 MCP 清单与实际工具面一致。

  2. 为单元测试和静态检查添加持续集成。

  3. 将提供商访问与 TrendPulse 的领域逻辑分离,以便在不重写 MCP 层的情况下更换提供商。

  4. 在保留本地 stdio 操作的同时,添加生产级远程 HTTP 传输。

  5. 为 ChatGPT/Codex 设计更小、更高级的托管工具面。

  6. 将托管服务与 DigestSEO 应用和运维技术栈集成。

  7. 仅在服务达到生产就绪后,再将托管 MCP 作为 OpenAI 插件进行打包和测试。

许可证

MIT。参见 LICENSE。

Available Tools

16 tools
get_article_contentA
Read-only

Download and parse one specific news article when you already have an article URL. Use it to retrieve article text or metadata or summarize that URL; do not use it for discovery - use the news search tools instead.

Inputs: url (required), full_data, summarize. Returns: result

get_categoriesA
Read-only

Return a bounded page of Google Trends category IDs and names for use in the cat parameter of trend tools. Use query to find categories by name and offset/limit to page through broader results; do not guess category IDs.

Inputs: limit, query, offset. Returns: result

get_growthA
Read-only

Estimate momentum for one or more known keywords across requested growth windows. Use this when percentage growth is the goal; use get_trends when the user needs the underlying historical time series.

Inputs: keyword (required), geo, source, percent_growth. Returns: result

get_interest_by_regionA
Read-only

Return geographic Google Trends interest for one or more known keywords at country, region, city, or DMA resolution. Use this to compare where demand is strongest; use get_trends for interest over time instead.

Inputs: keywords (required), cat, geo, gprop, +3 more. Returns: result

get_news_by_keywordA
Read-only

Find recent Google News articles for a free-form keyword or phrase. Use this for ad-hoc subject searches; use get_news_by_topic for a predefined topic category or get_news_by_site for one publisher.

Inputs: keyword (required), period, full_data, summarize, +2 more. Returns: result

get_news_by_locationA
Read-only

Find recent Google News articles about a place-focused location such as a city, state, or country. Use this when geography is the primary filter; use get_news_by_keyword for general subject searches.

Inputs: location (required), period, full_data, summarize, +2 more. Returns: result

get_news_by_siteA
Read-only

Find recent Google News articles from one publisher domain. Use this when the user wants source-specific coverage; use get_news_by_keyword for cross-publisher subject search.

Inputs: site (required), period, full_data, summarize, +2 more. Returns: result

get_news_by_topicA
Read-only

Find recent Google News articles from a predefined Google News topic category. Use this for topic category browsing such as BUSINESS, TECHNOLOGY, or SPORTS; use get_news_by_keyword for a free-form query.

Inputs: topic (required), period, full_data, summarize, +2 more. Returns: result

get_suggestionsA
Read-only

Return Google Trends autocomplete suggestions for a seed keyword. Use this for lightweight autocomplete or entity candidates; use get_related_queries when you need top or rising demand signals.

Inputs: keyword (required), language. Returns: result

get_top_newsA
Read-only

Return general headline and top-news stories from Google News without a keyword or topic seed. Use this for a broad news snapshot; use the keyword, location, topic, or site tools when the user gives a filter.

Inputs: period, full_data, summarize, max_results, +1 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 16 tools

    Disambiguation4/5

    The news tools are cleanly separated by filter (keyword, location, topic, site, top), and trend tools mostly include explicit cross-references to guide selection. The main overlap is among get_ranked_trends, get_top_trends, and get_trending_terms, which all surface current trends, though descriptions provide clear usage cues.

    Naming Consistency5/5

    All tools use snake_case with a get_ verb prefix and noun-based names such as get_news_by_topic, get_interest_by_region, and get_related_queries. The pattern is predictable throughout, with only natural variation between get_news_by_* and get_top_* forms.

    Tool Count4/5

    Sixteen tools cover two related but distinct domains—Google News search and Google Trends analysis—and each maps to a specific query type. The count is slightly above the ideal 3–15 range but remains reasonable for the breadth of functionality.

    Completeness4/5

    The surface covers news discovery across keyword, location, topic, site, and top stories, plus article retrieval and a broad Trends lifecycle including historical interest, growth, regional interest, categories, related queries/topics, suggestions, and current trends. Minor gaps include no date-range or language filters for news search and no batch article retrieval, but core workflows are well supported.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server providing news article mention volume data, weekly series, growth percentages, and a live Google News feed as an AI tool.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      An AI-powered news aggregator MCP server that fetches live news from multiple sources, provides AI summaries via Claude, and performs sentiment analysis and trending topic detection.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      A persistent news intelligence MCP server that enables AI agents to fetch, store, deduplicate, embed, and semantically query news from Google News across 141 countries and 41 languages.
      8
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      MCP 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.
      -