Skip to main content
Glama
mcp-claude-hackernews

mcp-claude-hackernews

MCP Claude 黑客新闻

铁匠徽章

特征

  • 浏览 Hacker News 的最新报道

  • 查看热门和评分最高的故事

  • 获取故事详情

  • 阅读故事评论

  • 清理 Hacker News 内容的格式以提高可读性

Related MCP server: MCP Hacker News

演示

要求

  • Node.js 16 或更高版本

  • 克劳德桌面

  • 互联网连接以访问 Hack News API

安装

手动安装

  1. 克隆或下载此存储库:

git clone https://github.com/imprvhub/mcp-claude-hackernews
cd mcp-claude-hackernews
  1. 安装依赖项:

npm install
  1. 构建项目:

npm run build

运行 MCP 服务器

运行 MCP 服务器有两种方式:

选项 1:手动运行

  1. 打开终端或命令提示符

  2. 导航到项目目录

  3. 直接运行服务器:

node build/index.js

使用 Claude Desktop 时,请保持此终端窗口打开。服务器将一直运行,直到您关闭终端。

选项 2:使用 Claude Desktop 自动启动(建议定期使用)

Claude Desktop 可以在需要时自动启动 MCP 服务器。设置方法如下:

配置

Claude Desktop 配置文件位于:

  • macOS : ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows : %APPDATA%\Claude\claude_desktop_config.json

  • Linux : ~/.config/Claude/claude_desktop_config.json

编辑此文件以添加 Hacker News MCP 配置。如果该文件不存在,请创建:

{
  "mcpServers": {
    "hackerNews": {
      "command": "node",
      "args": ["ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-hackernews/build/index.js"]
    }
  }
}

重要提示:将ABSOLUTE_PATH_TO_DIRECTORY替换为您安装 MCP 的完整绝对路径

  • macOS/Linux 示例: /Users/username/mcp-claude-hackernews

  • Windows 示例: C:\\Users\\username\\mcp-claude-hackernews

如果您已配置其他 MCP,只需在“mcpServers”对象中添加“hackerNews”部分即可。以下是包含多个 MCP 的配置示例:

{
  "mcpServers": {
    "otherMcp1": {
      "command": "...",
      "args": ["..."]
    },
    "otherMcp2": {
      "command": "...",
      "args": ["..."]
    },
    "hackerNews": {
      "command": "node",
      "args": [
        "ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-hackernews/build/index.js"
      ]
    }
  }
}

根据claude_desktop_config.json文件中的配置,当 Claude Desktop 需要时,MCP 服务器将自动启动。

用法

  1. 修改配置后重启Claude Desktop

  2. 在 Claude 中,使用hn命令与 Hacker News 进行交互

  3. MCP 服务器作为 Claude Desktop 管理的子进程运行

可用命令

Hacker News MCP 提供了一个名为hn的工具,其中包含几个命令:

命令

描述

参数

例子

latest

获取 Hacker News 的最新报道

param :可选故事数量(默认值:10,最大值:50)

hn latest --50

top

获取 Hacker News 的头条新闻

param :可选故事数量(默认值:10,最大值:50)

hn top --20

best

获取 Hacker News 的最佳新闻

param :可选故事数量(默认值:10,最大值:50)

hn best --30

history

获取有关特定故事的详细信息

param :必填 故事 ID

hn history --12345678

comments

获取故事评论

param :最后一个列表的必需索引或故事 ID

hn comments --3或hn comments --12345678

示例用法

以下是如何与 Claude 一起使用 Hacker News MCP 的各种示例:

直接命令:

hn latest --50
hn top --20
hn best --30
hn history --29384756
hn comments --5

自然语言查询:

您还可以使用自然语言与 MCP 进行交互。Claude 会解析这些请求并使用相应的命令:

  • “向我展示今天 Hacker News 上的 30 大新闻”

  • “Hacker News 上最新的 40 篇文章是什么?”

  • “我想看看 Hacker News 的 20 篇最佳文章”

  • “你能从 Hacker News 上帮我找到 30 条最新科技新闻吗?”

  • “告诉我 Hacker News 上最热门的 50 个话题是什么”

  • “向我展示 20 个有关机器学习的 Hacker News 故事”

  • “获取最新的 40 条 Hacker News 头条新闻”

  • “目前 Hacker News 上最活跃的 30 个讨论是什么?”

  • “我有兴趣阅读本周最受欢迎的 40 篇 Hacker News 文章”

  • “向我展示 Hacker News 上 20 篇最佳编程文章的列表”

语言翻译要求:

您可以请求将 Hacker News 内容翻译成不同的语言:

  • “显示 Hacker News 今日西班牙语版的 30 大新闻”

  • “获取 20 条最新的 Hacker News 文章并将其翻译成法语”

  • “我想看看 Hacker News 德语版的 40 篇最佳文章”

  • “向我展示 30 篇最近翻译成日语的 Hacker News 报道”

  • “获取 Hacker News 排名前 20 的文章,并用葡萄牙语呈现”

故障排除

“服务器断开连接”错误

如果您在 Claude Desktop 中看到错误“MCP Hacker News:服务器已断开连接”:

  1. 验证服务器正在运行:

    • 打开终端并从项目目录手动运行node build/index.js

    • 如果服务器启动成功,则使用 Claude 并保持此终端打开

  2. 检查您的配置:

    • 确保claude_desktop_config.json中的绝对路径对于您的系统来说是正确的

    • 仔细检查 Windows 路径是否使用了双反斜杠 ( \\ )

    • 验证您使用的文件系统根目录的完整路径

  3. 尝试自动启动选项:

    • 按照“设置自动启动脚本”部分中的说明为您的操作系统设置自动启动脚本

    • 这确保服务器在您需要时始终运行

Claude 中未出现的工具

如果 Hacker News 工具没有出现在 Claude 中:

  • 确保配置后重新启动 Claude Desktop

  • 检查 Claude Desktop 日志中是否存在任何 MCP 通信错误

  • 确保 MCP 服务器进程正在运行(手动运行以确认)

  • 验证 MCP 服务器是否已在 Claude Desktop MCP 注册表中正确注册

检查服务器是否正在运行

检查服务器是否正在运行:

  • Windows :打开任务管理器,转到“详细信息”选项卡,然后查找“node.exe”

  • macOS/Linux :打开终端并运行ps aux | grep node

如果您没有看到服务器运行,请手动启动它或使用自动启动方法。

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

执照

该项目根据 Mozilla 公共许可证 2.0 获得许可 - 有关详细信息,请参阅LICENSE文件。

相关链接

Available Tools

6 tools
hn_bestC

Get the best stories from Hacker News

Inputs: limit.

hn_commentsB

Get top-level comments for a story (by story ID or index from the last story list)

Inputs: limit, story_id, story_index.

hn_latestB

Get the latest/newest stories from Hacker News

Inputs: limit.

hn_storyA

Get details for a specific story by ID

Inputs: story_id (required).

hn_topB

Get the top-ranked stories from Hacker News

Inputs: limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 6 tools

    Disambiguation5/5

    hn_latest, hn_top, and hn_best target distinct Hacker News ranking feeds, while hn_search, hn_comments, and hn_story have clearly separate roles. There is no meaningful overlap or ambiguity in purpose.

    Naming Consistency5/5

    All tools use the same hn_ prefix and snake_case convention. The suffixes vary semantically (feeds, search, comments, story) but the naming pattern is predictable and consistent.

    Tool Count5/5

    Six tools are well-scoped for a read-only Hacker News server covering feeds, search, story details, and comments. Each tool earns its place without unnecessary duplication.

    Completeness4/5

    The surface covers the core HN read workflows: latest/top/best feeds, search, story details, and top-level comments. Minor gaps exist, such as nested comment retrieval and dedicated Ask/Show/Jobs feeds, but agents can work around them with search or story IDs.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI tools like Claude and Cursor to fetch and interact with live Hacker News data (posts, comments, users) via standardized MCP endpoints.
      11
      105 npm
      35
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to fetch top, new, best, Ask HN, Show HN, and job stories, as well as specific posts, comments, and user information from Hacker News through the Model Context Protocol.
      1
      -