Back to MCP directory
publicPublicdnsLocal runtime

GeekNews-MCP-Server

该项目是一个从GeekNews获取文章的MCP服务器,使用Python和BeautifulSoup实现网页抓取,具有每日自动缓存功能以减少服务器负载。

article

README

🚀 极客新闻 MCP 服务器

此项目是一个基于 Model Context Protocol (MCP) 的服务器,使用 Python 实现,借助 BeautifulSoup 进行网络爬虫,可从 GeekNews 获取文章。为减轻服务器负载,该项目提供了每日自动解析数据并存储于缓存的功能。

🚀 快速开始

通过 Smithery 安装

点击下方链接进行安装:
🚀 geeknews-mcp-server

在 MCP 配置文件中添加服务器信息

{
    "mcpServers": {
        "geeknews-mcp-server": {
            "command": "npx",
            "args": [
                "-y",
                "@smithery/cli@latest",
                "run",
                "@the0807/geeknews-mcp-server",
                "--key",
                "在 smithery 获取的密钥"
            ]
        }
    }
}

本地安装

1. Git 克隆

git clone https://github.com/the0807/GeekNews-MCP-Server
cd GeekNews-MCP-Server

2. 使用 uv 设置环境

uv sync

3. 安装依赖

pip install -r requirements.txt

4. 启动服务器

python main.py

✨ 主要特性

工具展示

|工具1|工具2| |:---------------------:|:---------------------:| |示例|示例|

get_articles 工具

该工具用于从 GeekNews 获取文章,具备以下特点:

  • 可指定文章类型(top, new, ask, show)和返回的文章数量。
  • 每个响应包含标题、URL、点数、作者、时间、评论数、排名信息。
  • 使用缓存数据以减少服务器负载。

get_weekly_news 工具

此工具用于从 GeekNews 获取周报,支持以下操作:

  • 可指定特定周报 ID 或获取最新周报。
  • 提供周报的标题、编号、ID、内容、URL、项目列表等信息。
  • 每个项目包含标题、URL、排名信息。
  • 使用缓存数据以减少服务器负载。

缓存功能

  • 每天自动解析数据并存储在缓存中。
  • 在缓存数据有效期内直接使用缓存数据,无需访问 GeekNews 服务器。
  • 缓存数据有效期为 24 小时,之后自动更新。
  • 定时器定期检查缓存有效性,并在需要时进行更新。

⚠️ 重要提示

  • 该项目依赖于 GeekNews 网站的结构,如果网站结构发生变化,可能需要调整爬虫逻辑。
  • 缓存数据存储在用户主目录下的 .cache/geeknews-mcp 文件夹中。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client