聚合新闻 MCP 服务器是一个基于模型上下文协议(Model Context Protocol)的服务器,其核心功能是为大型语言模型(LLMs)提供当前最新的热点新闻头条及详细内容信息。新闻类型丰富多样,涵盖推荐、国内、科技、体育等多个领域。
该服务器需要 Python 3.10 或更高版本,你可以选择以下两种方式安装依赖项:
当使用 uv 时,无需进行特定安装。我们将使用 uvx 直接运行 jnews-mcp-server。
uvx jnews-mcp-server
你也可以通过 pip 安装 jnews-mcp-server:
pip install jnews-mcp-server
安装完成后,可以通过以下命令运行它作为脚本:
python -m jnews_mcp_server
服务器实现了两个工具,以下是它们的使用示例:
get_news_list
根据新闻类型获取今日热点新闻头条,需要传入 "type"(新闻类型)作为可选的字符串参数。
async def get_news_list(type: str = "top", page: int = 1, page_size: int = 20) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
get_news_content
根据新闻类型获取今日热点新闻头条,需要传入 "uniquekey"(新闻id)作为必需的字符串参数。
async def get_news_content(uniquekey: str) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
JUHE_NEWS_API_KEY
是聚合数据的新闻头条 API 密钥,你可以从 https://www.juhe.cn/docs/api/id/235 获取该密钥。
JUHE_NEWS_API_KEY=your_api_key
~/Library/Application\ Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
"mcpServers": {
"jnews-mcp-server": {
"command": "uvx",
"args": [
"jnews-mcp-server"
],
"env": {
"JUHE_NEWS_API_KEY": "your_api_key"
}
}
}
"mcpServers": {
"jnews-mcp-server": {
"command": "python",
"args": [
"-m",
"jnews_mcp_server"
],
"env": {
"JUHE_NEWS_API_KEY": "your_api_key"
}
}
}
你可以使用 MCP 检查器来调试服务器。对于 uvx 安装:
npx @modelcontextprotocol/inspector uvx jnews-mcp-server
或者如果你在特定目录安装了该包或正在开发它:
cd path/to/servers/src/jnews-mcp-server
npx @modelcontextprotocol/inspector uv run jnews-mcp-server
你可以向服务器提出以下示例问题: