这是一个MCP服务器,它可以从Google News和Google Trends的RSS端点获取数据,还能选择使用大语言模型(LLM)或自然语言处理(NLP)对数据进行提炼,最后输出结构化的结果。
使用 uv 时,无需进行特定安装。我们将使用 uvx 直接运行 google-news-trends-mcp。
pip install google-news-trends-mcp
安装完成后,你可以使用以下命令将其作为脚本运行:
python -m google_news_trends_mcp
在你的Claude设置中添加以下内容:
{
"mcpServers": {
"google-news-trends": {
"command": "uvx",
"args": ["google-news-trends-mcp@latest"]
}
}
}
{
"mcpServers": {
"google-news-trends": {
"command": "python",
"args": ["-m", "google_news_trends_mcp"]
}
}
}
{
"mcp": {
"servers": {
"google-news-trends": {
"command": "uvx",
"args": ["google-news-trends-mcp@latest"]
}
}
}
}
{
"mcp": {
"servers": {
"google-news-trends": {
"command": "python",
"args": ["-m", "google_news_trends_mcp"]
}
}
}
}
以下是可用的MCP工具:
| 工具名称 | 描述 |
|---|---|
| get_news_by_keyword | 使用特定关键词搜索新闻。 |
| get_news_by_location | 获取与特定地点相关的新闻。 |
| get_news_by_topic | 根据选定的主题获取新闻。 |
| get_top_news | 从Google News获取热门新闻报道。 |
| get_trending_keywords | 返回指定地点的Google Trends热门关键词。 |
所有与新闻相关的工具都可以选择使用LLM采样(如果支持)或NLP对文章文本进行总结。
所有工具都可以通过 uv 从命令行访问:
uv run google-news-trends
Usage: google-news-trends [OPTIONS] COMMAND [ARGS]...
Find and download news articles using Google News.
Options:
--help Show this message and exit.
Commands:
keyword Find articles by keyword using Google News.
location Find articles by location using Google News.
top Get top news stories from Google News.
topic Find articles by topic using Google News.
trending Returns google trends for a specific geo location.
npx @modelcontextprotocol/inspector uvx google-news-trends-mcp
若要在本地安装的项目中运行:
cd path/to/google/news/tends/mcp
npx @modelcontextprotocol/inspector uv run google-news-trends-mcp
cd path/to/google/news/tends/mcp
python -m pytest