谷歌新闻访问服务

提供谷歌新闻的访问、过滤、主题分类和自动URL解析功能的服务。

  • by diaorui
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 diaorui/google-news-mcp

使用说明

谷歌新闻MCP服务器

MCP服务器,用于通过过滤、主题和自动URL解析访问谷歌新闻。

安装

git clone <repository-url> google-news-mcp
cd google-news-mcp
npm install
npm run build

设置

使用克劳德代码

claude mcp add --transport stdio google-news node /path/to/google-news-mcp/dist/index.js

使用Gemini CLI

gemini mcp add --transport stdio google-news node /path/to/google-news-mcp/dist/index.js

本地测试

npx @modelcontextprotocol/inspector node dist/index.js

工具

search_google_news

使用过滤器搜索。URL会自动解析为实际的文章URL。

参数:

  • query (必填):搜索词。支持 OR, "exact phrases", -exclusion
  • when:时间范围- 1h, 12h, 1d, 7d等等。
  • after/before:日期范围(YYYY-MM-DD)
  • site:按域过滤(例如。, reuters.com)
  • location:按位置过滤(例如。, New York)
  • inTitle:仅在标题中搜索(默认值:false)
  • language:语言代码(默认值: en)
  • region:国家代码(默认值: US)
  • limit:最大结果(默认值:20,最大值:100)

示例:

// Recent news from specific source
search_google_news({
  query: "bitcoin",
  site: "reuters.com",
  when: "24h"
})

// Location-specific with date range
search_google_news({
  query: "SpaceX launch",
  location: "Florida",
  after: "2025-12-01",
  before: "2025-12-03"
})

// Title-only precise search
search_google_news({
  query: "\"Federal Reserve\" rate decision",
  inTitle: true,
  when: "6h"
})

get_topic_news

从预定义的主题获取新闻。

参数:

  • topicName (必填):商业、技术、娱乐、体育、科学、健康、世界、美国
  • language, region, limit:与搜索相同

例子:

get_topic_news({ topicName: "TECHNOLOGY", limit: 10 })

get_top_headlines

获取当前头条新闻。

参数:

  • language, region, limit:与搜索相同

例子:

get_top_headlines({ region: "GB", language: "en" })

响应格式

{
  headline: string;   // Article headline
  source: string;     // News source name
  url: string;        // Direct article URL (auto-resolved)
  pubDate: string;    // UTC timestamp (YYYY-MM-DD HH:MM:SS UTC)
}

注: 这只返回标题和元数据。使用网络获取工具阅读完整的文章内容。

发展

npm run build      # Build
npm run watch      # Watch mode
npm run dev        # Run directly
npm run clean      # Clean artifacts

许可证

麻省理工学院