Skip to main content
Glama

MCP Hot News Server

by wudalu

MCP Hot News Server

PyPI version Python Support License: MIT

一个基于 FastMCP 的现代化多平台热点新闻聚合服务器,支持实时获取各大平台热点数据。

A modern multi-platform hot news aggregation server based on FastMCP, supporting real-time hot topics data from major platforms.

✨ 特性 Features

  • 🚀 基于 FastMCP:原生 MCP 协议支持,标准化的工具接口

  • 🌐 多平台支持:知乎、微博、百度、哔哩哔哩、抖音等 13+ 平台

  • 智能缓存:TTL 缓存机制,提高响应速度

  • 🔄 异步并发:高性能异步数据获取

  • 📊 趋势分析:自动提取热门关键词和趋势话题

  • 🛡️ 降级机制:API 失效时自动切换到模拟数据

  • 🔧 LangChain 集成:完美适配 LangChain 工具生态

🚀 快速开始 Quick Start

安装 Installation

pip install mcp-hot-news

基础使用 Basic Usage

1. 启动 MCP 服务器

# 启动服务器(STDIO 模式) mcp-hot-news # 或者 HTTP 模式 mcp-hot-news --transport http --host 0.0.0.0 --port 8001

2. Python 代码调用

import asyncio from mcp_hot_news.client import HotNewsClient async def main(): async with HotNewsClient() as client: # 获取微博热搜 weibo_news = await client.get_hot_news("weibo", limit=10) print(weibo_news) # 获取所有平台新闻 all_news = await client.get_all_platforms_news(limit=5) print(all_news) # 分析热点趋势 trends = await client.analyze_trends(limit=10) print(trends) asyncio.run(main())

3. LangChain 集成

from mcp_hot_news.langchain import HotNewsToolAdapter from langchain.agents import initialize_agent # 创建工具适配器 hot_news_tools = HotNewsToolAdapter() # 获取 LangChain 工具 tools = await hot_news_tools.get_langchain_tools() # 集成到 Agent agent = initialize_agent(tools, llm, agent="zero-shot-react-description")

📋 支持的平台 Supported Platforms

平台 Platform

支持状态 Status

API 来源 API Source

知乎 Zhihu

vvhan API

微博 Weibo

⚠️

vvhan API (不稳定)

百度 Baidu

⚠️

vvhan API (不稳定)

哔哩哔哩 Bilibili

vvhan API

抖音 Douyin

vvhan API

快手 Kuaishou

vvhan API

今日头条 Toutiao

vvhan API

虎扑 Hupu

⚠️

vvhan API (不稳定)

豆瓣 Douban

vvhan API

IT之家 ITHome

⚠️

vvhan API (不稳定)

⚠️ 注:部分平台 API 可能不稳定,会自动降级到模拟数据

🛠️ API 接口 API Reference

MCP 工具 MCP Tools

get_hot_news

获取指定平台的热点新闻

参数 Parameters:

  • platform (str): 平台名称

  • limit (int): 获取数量,默认 20

get_all_platforms_news

获取所有平台的热点新闻汇总

参数 Parameters:

  • limit (int): 每个平台获取数量,默认 10

analyze_trends

分析当前热点趋势和关键词

参数 Parameters:

  • limit (int): 分析数量,默认 10

get_server_health

获取服务器健康状态

clear_cache

清空所有缓存数据

数据模型 Data Models

class NewsItem: title: str # 新闻标题 url: str # 新闻链接 hot_value: Optional[Union[str, int]] # 热度值 rank: Optional[int] # 排名 platform: str # 平台名称 timestamp: str # 获取时间 class PlatformNews: platform: str # 平台名称 news_list: List[NewsItem] # 新闻列表 update_time: str # 更新时间 total_count: int # 新闻总数 class TrendAnalysis: hot_keywords: List[str] # 热门关键词 trending_topics: List[str] # 趋势话题 platform_summary: Dict[str, int] # 各平台热点数量 analysis_time: str # 分析时间

🔧 配置 Configuration

环境变量

# 缓存TTL(秒) export MCP_CACHE_TTL=3600 # API请求超时(秒) export MCP_REQUEST_TIMEOUT=10 # 日志级别 export MCP_LOG_LEVEL=INFO

自定义配置

from mcp_hot_news.server import HotNewsProvider # 自定义配置 provider = HotNewsProvider() provider.cache_manager.default_ttl = 7200 # 2小时缓存

🧪 开发和测试 Development & Testing

安装开发依赖

pip install -e ".[dev]"

运行测试

pytest

代码格式化

black src/ tests/ flake8 src/ tests/ mypy src/

📝 使用场景 Use Cases

  1. AI Agent 工具:为 LangChain/LangGraph Agent 提供实时热点数据

  2. 内容创作:获取热点话题进行内容创作

  3. 舆情监控:监控各平台热点趋势变化

  4. 数据分析:分析跨平台热点数据相关性

  5. API 服务:作为微服务提供热点数据接口

🤝 贡献 Contributing

欢迎贡献代码!请阅读 CONTRIBUTING.md 了解详细信息。

Welcome contributions! Please read CONTRIBUTING.md for details.

📄 许可证 License

MIT License - 详见 LICENSE 文件。

🙏 致谢 Acknowledgments

📞 联系我们 Contact


⭐ 如果这个项目对你有帮助,请给个 Star!

⭐ If this project helps you, please give it a Star!

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

A modern multi-platform hot news aggregation server based on FastMCP that supports real-time hot topics data collection from 13+ major platforms including Zhihu, Weibo, Baidu, and Bilibili.

  1. ✨ 特性 Features
    1. 🚀 快速开始 Quick Start
      1. 安装 Installation
      2. 基础使用 Basic Usage
    2. 📋 支持的平台 Supported Platforms
      1. 🛠️ API 接口 API Reference
        1. MCP 工具 MCP Tools
        2. 数据模型 Data Models
      2. 🔧 配置 Configuration
        1. 环境变量
        2. 自定义配置
      3. 🧪 开发和测试 Development & Testing
        1. 安装开发依赖
        2. 运行测试
        3. 代码格式化
      4. 📝 使用场景 Use Cases
        1. 🤝 贡献 Contributing
          1. 📄 许可证 License
            1. 🙏 致谢 Acknowledgments
              1. 📞 联系我们 Contact

                Related MCP Servers

                • A
                  security
                  F
                  license
                  A
                  quality
                  A Model Context Protocol server that provides real-time hot trending topics from major Chinese social platforms and news sites.
                  Last updated -
                  1
                  403
                  174
                • A
                  security
                  F
                  license
                  A
                  quality
                  A MCP server that aggregates hot trends and rankings from various Chinese websites and platforms including Weibo, Zhihu, Bilibili, and more.
                  Last updated -
                  21
                  303
                  162
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that provides AI models with real-time trending content from 18 major Chinese internet platforms, including Weibo, Zhihu, and Bilibili.
                  Last updated -
                  7
                • -
                  security
                  A
                  license
                  -
                  quality
                  A FastMCP-based server that provides tools for discovering RSS feeds, fetching and processing news content, searching articles by keyword, and generating summaries across multiple news sources and categories.

                View all related MCP servers

                MCP directory API

                We provide all the information about MCP servers via our MCP API.

                curl -X GET 'https://glama.ai/api/mcp/v1/servers/wudalu/mcp-hot-news-server'

                If you have feedback or need assistance with the MCP directory API, please join our Discord server