一个通过与 SerpAPI 集成来提供 Google 新闻搜索功能的 Model Context Protocol (MCP) 服务器实现。自动对新闻结果进行分类,并支持多种语言和地区。
<a href="https://glama.ai/mcp/servers/dbx6imq4ef"><img width="380" height="200" src="https://gips0.baidu.com/it/u=2298943891,1877396826&fm=3081&app=3081&f=PNG?w=760&h=400" alt="Google News Server MCP 服务器" /></a>
<br/> <br/>https://github.com/user-attachments/assets/1cc71c27-f840-4c94-9ab5-460d84ba4779
包括基于查询的搜索、主题搜索、出版物过滤和故事覆盖在内的全面搜索能力。
通过可配置的语言和地区代码支持多种语言和地区。
自动将新闻结果分类到如人工智能和技术、商业、科学与研究以及医疗保健等主题中。
处理各种新闻结果类型,包括标题、故事、相关主题和菜单链接。
对于 API 失败和无效输入有全面的错误处理机制,带有有用的错误消息。
对于不支持的语言代码,自动回退到英语,并适当通知用户。
在开始之前,您需要获取一个 SerpApi 密钥。以下是步骤:
访问 SerpApi 网站 并创建一个账户
注册后,进入您的仪表板:
API 使用详情:
使用限制:
点击查看我的配置解决方案 👉 https://github.com/modelcontextprotocol/servers/issues/76
npm install
npm run build
claude_desktop_config.json 文件,添加以下内容(根据您的系统调整路径): "google-news": {
"command": "D:\\Program\\nvm\\node.exe",
"args": [
"D:\\github_repository\\path_to\\dist\\index.js"
],
"env": {
"SERP_API_KEY": "your-api-key"
}
}
npm start
claude_desktop_config.json 中验证 API 密钥配置评估包加载了一个 mcp 客户端,然后运行 index.ts 文件,因此在测试之间无需重新构建。您可以通过前缀 npx 命令来加载环境变量。完整的文档可以在 这里 找到。
OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/index.ts
要通过 Smithery 自动安装 Google News for Claude Desktop:
npx -y @smithery/cli install @chanmeng666/google-news-server --client claude
npx @michaellatman/mcp-get@latest install @chanmeng666/google-news-server
如果您使用的是旧版本的 Windows PowerShell,可能需要在执行此命令之前运行
Set-ExecutionPolicy Bypass -Scope Process。
<img src="https://cdn.simpleicons.org/npm/CB3837" height="14"/> <a href="https://www.npmjs.com/package/@chanmeng666/google-news-server">@chanmeng666/google-news-server</a>
# 使用 npm
npm i @chanmeng666/google-news-server
# 或
npm install @chanmeng666/google-news-server
# 使用 yarn
yarn add @chanmeng666/google-news-server
# 使用 pnpm
pnpm add @chanmeng666/google-news-server
该服务器实现了 Model Context Protocol,并公开了具有以下参数的 Google 新闻搜索工具:
q: 搜索查询字符串gl: 国家代码(例如,'us', 'uk')hl: 语言代码(例如,'en', 'es')topic_token: 特定新闻主题的令牌publication_token: 特定出版商的令牌story_token: 故事完整覆盖的令牌section_token: 特定部分的令牌# 在开发模式下运行并启用热重载
npm run dev
# 运行代码检查
npm run lint
# 运行测试
npm run test
本项目采用 MIT 许可证。
由 Chan Meng 创建和维护。
此 MCP 服务器针对 AI 代理使用进行了优化,提供了全面的指令和结构化数据。
{
"tool": "google_news_search",
"parameters": {
"q": "人工智能最新发展",
"gl": "us",
"hl": "en"
}
}
服务器返回分类新闻,其结构如下:
此服务器包括针对 AI 代理使用的全面监控和优化。
interface GEOMonitoringConfig {
trackingEnabled: boolean;
metricsEndpoint: string;
reportingInterval: number; // 分钟
alertThresholds: {
errorRate: number;
responseTime: number;
successRate: number;
satisfactionScore: number;
};
}
有关技术实施细节,请参阅 src/geo-metrics.ts。
</details> <details> <summary>🔍 结构化数据与元数据</summary>此服务器为 AI 代理和搜索引擎提供了全面的结构化数据。
服务器包括遵循 Schema.org 标准的结构化数据:
google_news_search有关完整的结构化数据,请参阅 structured-data.json。
</details>