HotNews MCP Server

repository·main·Indexed 41 days ago

https://github.com/wopal-cn/mcp-hotnews-server

A Model Context Protocol (MCP) server version 0.2.0 that provides real-time trending topics from 9 major Chinese social platforms and news sites, including Zhihu, Weibo, Bilibili, and Baidu. It features the `get_hot_news` tool to retrieve formatted news lists with titles, URLs, and heat scores for integration with AI models.

Tokens
1.5K
Snippets
8
Records
8
Agent score
51%

What's inside HotNews MCP Server

  1. Install the HotNews MCP Server via NPX

    main

    To use the HotNews MCP server in an MCP-compatible client (like Claude Desktop), add the following configuration to your mcpServers settings. This method uses npx to run the package directly without a manual local installation.

    {
      "mcpServers": {
        "mcp-server-hotnews": {
          "command": "npx",
          "args": [
            "-y",
            "@wopal/mcp-server-hotnews"
          ]
        }
      }
    }
  2. Develop the HotNews MCP Server

    main

    If you are contributing to or modifying the server, use the following commands to manage the development lifecycle:

    • npm install: Install project dependencies.
    • npm run watch: Run in watch mode for development.
    • npm run build: Build the project.
    • npm run test:urls: Run tests against the source URLs.
    # Install dependencies
    npm install
    
    # Watch mode
    npm run watch
    
    # Build
    npm run build
    
    # Test URLs
    npm run test:urls
  3. Install the HotNews MCP Server via Docker

    main

    If you prefer running the server in a container, you must first build the image locally as it is not currently hosted on Docker Hub.

    1. Build the image:

    docker build -t wopal/mcp-server-hotnews:latest -f Dockerfile .

    2. Configure your MCP client:

    {
      "mcpServers": {
        "mcp-server-hotnews": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "wopal/mcp-server-hotnews"
          ]
        }
      }
    }
  4. How to select HotNews sources

    main

    When interacting with the MCP server tools, you can specify one or multiple sources using their numeric IDs.

    Usage Patterns:

    • Single Source: Use a single ID (e.g., 3 for Baidu).
    • Multiple Sources: Provide a list of IDs (e.g., [1, 3, 7] to get news from Zhihu, Baidu, and Hupu).
    Example usage:
    - [3]: Get Baidu Hot Discussion only
    - [1,3,7]: Get hot lists from zhihuHot, Baidu, and huPu
    - [1,2,3,4]: Get hot lists from zhihuHot, 36Kr, Baidu, and Bilibili
  5. Use the get_hot_news tool

    main

    The get_hot_news tool retrieves real-time trending topics from various Chinese social platforms. It requires a sources argument, which is a list of Platform IDs.

    Supported Platform IDs:

    1. Zhihu Hot List (知乎热榜)
    2. 36Kr Hot List (36氪热榜)
    3. Baidu Hot Discussion (百度热点)
    4. Bilibili Hot List (B站热榜)
    5. Weibo Hot Search (微博热搜)
    6. Douyin Hot List (抖音热点)
    7. Hupu Hot List (虎扑热榜)
    8. Douban Hot List (豆瓣热榜)
    9. IT News (IT新闻)

    Example Tool Calls:

    • Get Baidu Hot Discussion only: get_hot_news([3])
    • Get hot lists from Zhihu, Baidu, and Hupu: get_hot_news([1,3,7])
    • Get hot lists from Zhihu, 36Kr, Baidu, and Bilibili: get_hot_news([1,2,3,4])
    get_hot_news([1,3,7])
  6. Use the get_hot_news tool

    main

    The get_hot_news tool allows you to retrieve trending news lists from various platforms. It accepts an array of source IDs as input. Each ID corresponds to a specific news platform configured in the server.

    Input Parameters:

    • sources (array of numbers): A list of valid source IDs. Each ID must be between 1 and the maximum supported source ID (determined by getMaxSourceId()).

    Output: Returns a formatted markdown string containing:

    • The news source name and subtitle.
    • The last update timestamp.
    • A list of news items, each including its index, title (as a link), URL, and heat/trending score if available.
    {
      "name": "get_hot_news",
      "arguments": {
        "sources": [1, 2, 3]
      }
    }
  7. Available HotNews source IDs and platforms

    main

    The HotNews MCP Server supports several news platforms, each identified by a unique numeric ID. When using tools that require a source selection, use the following ID mapping:

    IDPlatform NameDescription
    1zhihuHotZhihu Hot List (知乎热榜)
    236Ke36Kr Hot List (36氪热榜)
    3baiduRDBaidu Hot Discussion (百度热点)
    4biliBilibili Hot List (B站热榜)
    5wbHotWeibo Hot Search (微博热搜)
    6douyinHotDouyin Hot List (抖音热点)
    7huPuHupu Hot List (虎扑热榜)
    8doubanDouban Hot List (豆瓣热榜)
    9itNewsIT News (IT新闻)
    1: { name: "zhihuHot", description: "Zhihu Hot List (知乎热榜)" }
    2: { name: "36Ke", description: "36Kr Hot List (36氪热榜)" }
    3: { name: "baiduRD", description: "Baidu Hot Discussion (百度热点)" }
    4: { name: "bili", description: "Bilibili Hot List (B站热榜)" }
    5: { name: "wbHot", description: "微博热搜" }
    6: { name: "douyinHot", description: "抖音热点" }
    7: { name: "huPu", description: "虎扑热榜" }
    8: { name: "douban", description: "豆瓣热榜" }
    9: { name: "itNews", description: "IT新闻" }
  8. HotNewsItem data structure

    main

    When the get_hot_news tool successfully fetches data, the underlying data items follow this structure:

    • index (number): The position of the item in the list.
    • title (string): The headline of the news item.
    • url (string): The direct link to the news article.
    • hot (string | number, optional): The trending or 'heat' score for the item.
    interface HotNewsItem {
      index: number;
      title: string;
      url: string;
      hot?: string | number;
    }