Skip to main content
Glama
imprvhub

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

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of items to fetch (1-50, default: 10)

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden. It conveys only that this is a read of stories; it says nothing about ordering semantics ('best' by what ranking?), result freshness, or pagination, which matters most given the hn_top sibling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with zero waste. It is appropriately sized, though its brevity is part of why key distinctions are missing.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter list tool this is minimally adequate, and the schema covers the input. However, with no output schema and no annotation coverage, the unresolved 'best' vs 'top' ambiguity and lack of ordering information leave a meaningful gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and the single 'limit' parameter is fully documented in the schema (range, default), so the baseline of 3 applies. The description adds no additional meaning about the parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a clear verb+resource ('Get the best stories from Hacker News'), but the sibling hn_top makes 'best' ambiguous — an agent cannot tell from the description how 'best' differs from 'top' or 'latest'. The purpose is understandable but not differentiated from its siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to choose this over hn_top, hn_latest, or hn_search. There is no statement of context, prerequisites, or exclusions, leaving selection between four similarly-named story-fetching tools to guesswork.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

hn_commentsB

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

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of items to fetch (1-50, default: 20)
story_idNoThe ID of the story to get comments for
story_indexNoThe index (1-based) of the story from the last fetched list

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. 'Top-level comments' is a useful behavioral nuance (excludes nested replies), but the description omits return format, pagination, whether the call is safe/read-only, and any rate or auth context for a tool that hits an external API.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single compact sentence with the resource front-loaded and input modes in a parenthetical. Efficient, though the parenthetical is dense and slightly compressed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and no annotations, the description should explain the return shape and the mutual exclusivity of story_id vs story_index for a 0-required-param tool. It covers purpose adequately but leaves these gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description names story ID and index as inputs but does not clarify that these are alternative selectors or which takes precedence when both are omitted (0 required params).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (Get) and resource (top-level comments for a story), which differentiates it from siblings like hn_story and hn_latest. The parenthetical clarifies input modes but the description doesn't explicitly contrast with siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The parenthetical implies usage context ('index from the last story list'), suggesting it's meant to be called after a list tool, but no explicit when-to-use or alternatives are stated. Usage is inferred rather than directed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

hn_latestB

Get the latest/newest stories from Hacker News

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of items to fetch (1-50, default: 10)

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Get' implies a read-only retrieval, but the description does not mention authentication, rate limits, pagination, return format, or any other operational behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no wasted words. It communicates the core purpose immediately and is appropriately sized for a simple retrieval tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one optional parameter and no output schema, the description is minimally adequate. However, it omits any indication of the return shape and does not help the agent choose between this and similar sibling tools like hn_top or hn_best.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, fully documenting the single 'limit' parameter with its default and range. The description itself adds no additional parameter meaning, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: getting latest/newest stories from Hacker News. It distinguishes itself somewhat from hn_top and hn_best by emphasizing recency rather than ranking, but it does not explicitly name or differentiate against those sibling tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives such as hn_top, hn_best, or hn_search. The agent can infer that it is for recent stories, but no conditions, exclusions, or alternatives are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

hn_storyA

Get details for a specific story by ID

ParametersJSON Schema
NameRequiredDescriptionDefault
story_idYesThe ID of the story to fetch

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description is the sole source. It indicates a read operation ('get details'), but does not disclose error behavior, rate limits, or response structure. Basic transparency is achieved.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence with no extraneous words or filler. It is optimally concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool with no output schema, the description provides minimal but sufficient context. It lacks detail on what 'details' includes, which is acceptable for a simple fetch.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% as the only parameter 'story_id' has a description. The description 'by ID' aligns with the parameter, adding no new meaning. Baseline score applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('get details'), the resource ('story'), and the identification method ('by ID'). It distinctly differentiates from sibling tools (lists like hn_best, hn_top) which fetch multiple items.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when a specific story ID is known, but does not explicitly exclude cases like fetching stories in bulk or provide alternatives. Sibling tool names indirectly suggest other use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

hn_topB

Get the top-ranked stories from Hacker News

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of items to fetch (1-50, default: 10)

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden, and it discloses almost nothing beyond the implied read-only nature of 'Get'. It does not say whether results are live-fetched from the HN API, cached, paginated, or what the return structure looks like for a tool with no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with no filler or redundancy. Every word earns its place, and the core purpose is stated immediately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-optional-parameter list tool with no output schema and no annotations, the description is minimally adequate: it identifies the resource but not what 'top-ranked' means (score? front page?) or what a returned item contains. Enough to attempt a call, not enough to predict the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for the single 'limit' parameter, including range and default, so the description need not restate it. The description adds no meaning beyond the schema, which is the expected baseline here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource ('Get the top-ranked stories from Hacker News'), which is more informative than the bare name hn_top. However, it offers no differentiation from close siblings like hn_best and hn_latest, leaving 'top-ranked' nearly synonymous with 'best' and forcing the agent to guess which ranking endpoint to use.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to choose this tool over hn_best, hn_latest, or hn_search, and no stated prerequisites or context. The agent must infer selection purely from the tool names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updatesv0.2.0
    • Changedhn_best1 field changed
      • changedInput schema / properties / limit / description
        Previous value: -"Number of stories to fetch (1-50, default: 10)"New value: +"Number of items to fetch (1-50, default: 10)"
    • Changedhn_comments1 field changed
      • addedInput schema / properties / limit
        Added value: +{
        +  "default": 20,
        +  "description": "Number of items to fetch (1-50, default: 20)",
        +  "maximum": 50,
        +  "minimum": 1,
        +  "type": "number"
        +}
    • Changedhn_latest1 field changed
      • changedInput schema / properties / limit / description
        Previous value: -"Number of stories to fetch (1-50, default: 10)"New value: +"Number of items to fetch (1-50, default: 10)"
    • Addedhn_search
    • Changedhn_top1 field changed
      • changedInput schema / properties / limit / description
        Previous value: -"Number of stories to fetch (1-50, default: 10)"New value: +"Number of items to fetch (1-50, default: 10)"
  2. 5 tool updatesv1.0.0
    • First observedhn_best
    • First observedhn_comments
    • First observedhn_latest
    • First observedhn_story
    • First observedhn_top

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

ActivityMaintained
ResponsivenessNo 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
    109 npm
    34
    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
    -