Google Alerts MCP Server for fetching topic-based news and information
SaferSkills independently audited google-alerts-mcp (MCP Server) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
一个基于 MCP (Model Context Protocol) 的 Google Alerts 插件,通过模拟浏览器工作流程来获取特定主题的新闻资讯。该插件能够动态提取 Google Alerts 页面的状态参数,避免被检测和封锁。
本 MCP Server 需要访问 Google 服务,某些地区需要科学上网环境。
window.STATE 参数https://www.google.com/alerts?hl={language} 获取初始 cookieswindow.STATE 参数,包括认证令牌使用 UV 包管理器:
# 克隆项目
git clone https://github.com/ycrao/google-alerts-mcp.git
cd google-alerts-mcp
# 安装依赖
uv sync
# 激活虚拟环境
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 或者直接
uv run python src/google_alerts_mcp/server.py在 MCP 客户端配置中添加:
{
"mcpServers": {
"google-alerts": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/google-alerts-mcp/src/google_alerts_mcp/",
"run",
"server.py"
],
"env": {}
}
}
}或者如果已经发布为包:
{
"mcpServers": {
"google-alerts": {
"command": "uvx",
"args": ["google-alerts-mcp"],
"env": {}
}
}
}#### search_google_alerts
根据特定主题搜索 Google Alerts 新闻文章。
参数:
query (必需): 搜索查询/主题(如 "白银", "bitcoin", "人工智能")language (可选): 语言代码(默认: "zh-CN")region (可选): 地区代码(默认: "US")clean_urls (可选): 是否清理Google重定向参数获取直接链接(默认: true)示例:
{
"query": "bitcoin",
"language": "en-US",
"region": "US",
"clean_urls": true
}URL清理功能:
clean_urls=true 时,会自动移除Google重定向参数,直接返回目标新闻网站的链接clean_urls=false 时,保留原始的Google重定向URLhttps://www.google.com/url?q=https://example.com/article&sa=U&ved=...https://example.com/article服务器从 window.STATE 中提取以下参数:
domain: Google 域名(通常是 "com")language: 状态中的语言代码region: 状态中的地区代码number_param: 数字参数(因语言而异)locale_format: 区域格式字符串token: 认证令牌(避免检测的关键)运行测试套件验证功能:
# 测试完整 MCP 服务器功能
python test_mcp_server.py# 测试搜索功能
import asyncio
from google_alerts_mcp.server import GoogleAlertsClient
async def test():
client = GoogleAlertsClient()
try:
# 中文搜索
articles = await client.get_preview_content("白银", "zh-CN")
for article in articles:
print(f"标题: {article.title}")
print(f"链接: {article.url}")
print(f"摘要: {article.snippet}")
print(f"来源: {article.source}")
print("-" * 50)
# 英文搜索(启用URL清理)
client_clean = GoogleAlertsClient(clean_urls=True)
articles = await client_clean.get_preview_content("bitcoin", "en-US")
for article in articles:
print(f"Title: {article.title}")
print(f"URL: {article.url}") # 直接链接,无Google重定向参数
print(f"Snippet: {article.snippet}")
print(f"Source: {article.source}")
print("-" * 50)
await client_clean.close()
# 英文搜索(保留原始URL)
client_original = GoogleAlertsClient(clean_urls=False)
articles = await client_original.get_preview_content("bitcoin", "en-US")
for article in articles:
print(f"Title: {article.title}")
print(f"URL: {article.url}") # 包含Google重定向参数
print(f"Snippet: {article.snippet}")
print(f"Source: {article.source}")
print("-" * 50)
await client_original.close()
finally:
await client.close()
asyncio.run(test())clean_urls=false 参数保留原始Google重定向URLMIT License
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.