Token导航 LogoToken导航TokenDH.com
News API MCP logo
搜索检索stdio官方级别未说明来源级核验

News API MCP

MCP Server

@smithery/cli

一个提供全球新闻文章访问的模型上下文协议(MCP)服务器,支持搜索新闻文章、获取头条新闻和列出可用新闻来源。

工具数

0

提示词数

0

GitHub Stars

12

资源数

0
新闻聚合数据检索PythonClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

berlinbra

提供方

berlinbra

最后核验

2026/5/17 20:22

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx -y @smithery/cli install @berlinbra/news-api-mcp --client claude

详细介绍

新闻API MCP服务器

一个模型上下文协议(MCP)服务器,通过 新闻API此服务器实现了用于搜索新闻文章、检索头条新闻和列出可用新闻源的标准化接口。

特性

  • 使用高级筛选选项搜索任何主题的新闻文章
  • 按国家、类别或来源检索头条新闻
  • 通过按类别、语言和国家进行筛选,获取有关可用新闻源的信息
  • 内置错误处理和速率限制管理

安装

使用克劳德桌面

通过Docker安装

  • 克隆存储库并构建本地映像,供您的Claude桌面客户端使用
cd news-api-mcp
docker build -t mcp/news-api .
  • 改变你的 claude_desktop_config.json 要匹配以下内容,请替换 REPLACE_API_KEY 使用您的实际新闻API密钥:
claude_desktop_config.json 路径 - 在MacOS上: ~/Library/Application\ Support/Claude/claude_desktop_config.json - 在Windows上: %APPDATA%/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "newsapi": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "-e",
        "NEWS_API_KEY",
        "mcp/news-api"
      ],
      "env": {
        "NEWS_API_KEY": "REPLACE_API_KEY"
      }
    }
  }
}

通过Smithery安装

通过以下方式为Claude Desktop自动安装新闻API MCP服务器 史密瑟里:

npx -y @smithery/cli install @berlinbra/news-api-mcp --client claude

开发设置

安装程序包

uv install -e .

跑步

通过json文件将Claude客户端与MCP工具连接并安装包后,Claude应该看到服务器的MCP工具。

您可以通过以下方式自行运行服务器:

uv run src/news_api_mcp/server.py

与检查员:

npx @modelcontextprotocol/inspector uv --directory /Users/{INSERT_USER}/YOUR/PATH/TO/news-api-mcp run src/news_api_mcp/server.py

可用工具

服务器实现了三个工具:

搜索新闻

搜索任何主题的新闻文章。

输入架构:

{
  "query": {
    "type": "string",
    "description": "Keywords or phrases to search for in the article title and body"
  },
  "from_date": {
    "type": "string",
    "description": "Start date for article search (YYYY-MM-DD format)"
  },
  "to_date": {
    "type": "string",
    "description": "End date for article search (YYYY-MM-DD format)"
  },
  "sources": {
    "type": "string",
    "description": "Comma-separated list of news sources to filter by (e.g., 'bbc-news,cnn')"
  },
  "language": {
    "type": "string",
    "description": "Language of the articles",
    "default": "en"
  },
  "sort_by": {
    "type": "string",
    "description": "Sort articles by relevancy, popularity, or publishedAt",
    "default": "publishedAt"
  },
  "page_size": {
    "type": "integer",
    "description": "Number of results to return per page (max 100)",
    "default": 20
  },
  "page": {
    "type": "integer",
    "description": "Page number for pagination",
    "default": 1
  }
}

示例响应:

Search results for 'artificial intelligence' (Found 28156 articles):

Article 1:
Title: OpenAI announces breakthrough in artificial intelligence reasoning
Source: TechCrunch
Author: John Smith
Published: 2025-03-25 14:30 UTC
Description: The AI research lab has developed a new model that demonstrates advanced reasoning capabilities...
URL: https://techcrunch.com/2025/03/25/openai-announces-new-ai-model/
---

Article 2:
...

获得头条新闻

检索国家、类别和单一出版商的突发新闻头条。

输入架构:

{
  "country": {
    "type": "string",
    "description": "2-letter ISO 3166-1 country code"
  },
  "category": {
    "type": "string",
    "description": "Category to get headlines for"
  },
  "sources": {
    "type": "string",
    "description": "Comma-separated list of news source IDs (e.g., 'bbc-news,cnn')"
  },
  "query": {
    "type": "string",
    "description": "Keywords or phrases to search for in headlines"
  },
  "page_size": {
    "type": "integer",
    "description": "Number of results to return per page (max 100)",
    "default": 20
  },
  "page": {
    "type": "integer",
    "description": "Page number for pagination",
    "default": 1
  }
}

示例响应:

Top headlines for country: US, category: technology (Found 20 articles):

Article 1:
Title: Apple announces new MacBook Pro with M3 chip
Source: The Verge
Author: Alice Johnson
Published: 2025-03-28 13:45 UTC
Description: Apple has unveiled its latest MacBook Pro lineup featuring the new M3 chip...
URL: https://theverge.com/2025/03/28/apple-new-macbook-pro-m3
---

Article 2:
...

获取新闻来源

检索有关最著名的新闻来源的信息。

输入架构:

{
  "category": {
    "type": "string",
    "description": "Find sources that display news of this category"
  },
  "language": {
    "type": "string",
    "description": "Find sources that display news in a specific language"
  },
  "country": {
    "type": "string",
    "description": "Find sources that display news in a specific country"
  }
}

示例响应:

Available news sources for category: technology, language: en (Found 22 sources):

Source 1:
Name: TechCrunch
ID: techcrunch
Description: TechCrunch is a leading technology media property, dedicated to obsessively profiling startups, reviewing new Internet products, and breaking tech news.
Category: technology
Language: en
Country: US
URL: https://techcrunch.com
---

Source 2:
...

错误处理

该服务器包括针对各种场景的全面错误处理:

  • 超过速率限制(新闻API免费层每天限制为100个请求)
  • API密钥无效
  • 网络连接问题
  • 超时处理
  • 响应格式错误

错误消息以清晰易读的格式返回。

先决条件

  • Python 3.12或更高版本
  • httpx
  • 主控程序

贡献者

贡献

欢迎投稿!请随时提交拉取请求。

许可证

此MCP服务器根据MIT许可证获得许可。 这意味着您可以根据MIT许可证的条款和条件自由使用、修改和分发软件。有关更多详细信息,请参阅项目存储库中的LICENSE文件。

目录标签

目录标签

新闻聚合数据检索PythonClaude本地部署API服务头条新闻新闻来源

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

@smithery/cli

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP