NewsNow
STDIO基于Newsnow API的多平台新闻聚合MCP服务器
基于Newsnow API的多平台新闻聚合MCP服务器
一个基于 Model Context Protocol (MCP) 的新闻聚合服务器,通过 Newsnow API 提供多平台热点新闻和趋势话题。
# 使用 pip 安装 pip install mcp-newsnow # 或使用 uv 安装 uv pip install mcp-newsnow
在 Claude Desktop 配置文件中添加服务器配置:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
添加以下配置:
{ "mcpServers": { "get_news": { "command": "uvx", "args": [ "mcp-newsnow" ] } } }
# 通过环境变量设置API端点 NEWS_API_URL=https://newsnow.example.com # 运行测试 mcp test server.py
async def get_newsnow(source: str) -> dict[str, Any] | None
从指定源获取最新新闻。
参数:
source: 新闻源名称 (支持中英文,例如"知乎"、"zhihu"、"B站"等)返回: 包含新闻数据的字典
async def get_multi_news(sources: list[str] = None) -> dict[str, Any]
从多个源获取最新新闻 (最多5个)。
参数:
sources: 新闻源名称列表返回: 包含多个新闻源数据的字典
async def get_all_news() -> dict[str, Any]
获取所有配置的新闻源数据。
返回: 包含所有新闻源数据和元数据的字典
async def list_sources() -> dict[str, str]
列出所有可用的新闻源及其中文名称。
返回: 新闻源ID到中文名称的映射字典
NEWS_API_URL: Newsnow API的基础URL (默认: "https://newsnow.busiyi.world/")欢迎提交问题和拉取请求!以下是一些潜在的改进方向:
本项目采用 MIT 许可证。