Hacker News MCP
黑客新闻 MCP 服务器
一个模型上下文协议 (MCP) 服务器,提供从 Hacker News 获取新闻的工具。该服务器解析来自 news.ycombinator.com 的 HTML 内容,并为不同类型的新闻(热门、最新、咨询、展示、招聘)提供结构化数据。
特征
获取不同类型的故事(热门、新、询问、展示、工作)
获取结构化数据,包括标题、URL、点数、作者、时间戳和评论数
可配置返回故事数量的限制
清理错误处理和验证
Related MCP server: Hacker News MCP Server
安装
克隆存储库:
git clone https://github.com/pskill9/hn-server
cd hn-server安装依赖项:
npm install构建服务器:
npm run build添加到您的 MCP 设置配置文件(位置取决于您的系统):
对于 VSCode Claude 扩展:
{
"mcpServers": {
"hacker-news": {
"command": "node",
"args": ["/path/to/hn-server/build/index.js"]
}
}
}用法
该服务器提供了一个名为get_stories的工具,可用于从 Hacker News 获取故事。
工具:get_stories
参数:
type(字符串):要获取的故事类型选项:‘顶部’、‘新’、‘询问’、‘显示’、‘工作’
默认值:'top'
limit(数字):要返回的故事数量范围:1-30
默认值:10
使用示例:
use_mcp_tool with:
server_name: "hacker-news"
tool_name: "get_stories"
arguments: {
"type": "top",
"limit": 5
}示例输出:
[
{
"title": "Example Story Title",
"url": "https://example.com/story",
"points": 100,
"author": "username",
"time": "2024-12-28T00:03:05",
"commentCount": 50,
"rank": 1
},
// ... more stories
]与克劳德整合
要将此 MCP 服务器与 Claude 一起使用,您需要:
已安装 Claude 桌面应用程序或 VSCode Claude 扩展
在您的设置中配置 MCP 服务器
使用 Claude 的自然语言界面与 Hacker News 进行交互
配置
对于 Claude 桌面应用程序,将服务器配置添加到:
// ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
// %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"hacker-news": {
"command": "node",
"args": ["/path/to/hn-server/build/index.js"]
}
}
}对于 VSCode Claude 扩展,添加:
// VSCode Settings JSON
{
"mcpServers": {
"hacker-news": {
"command": "node",
"args": ["/path/to/hn-server/build/index.js"]
}
}
}交互示例
配置完成后,您可以使用自然语言与 Claude 互动,获取 Hacker News 报道。示例:
“向我展示 Hacker News 的五大新闻”
“Ask HN 的最新帖子是什么?”
“获取今天最热门的 Show HN 提交内容”
Claude 会自动使用适当的参数来获取您想要的故事。

故事对象结构
每个故事对象包含:
title(字符串):故事标题url(字符串,可选):故事的 URL(可能是文本帖子的内部 HN URL)points(数字):赞同数author(字符串):发帖人的用户名time(字符串):故事发布的时间戳commentCount(数字):评论数rank(数字):列表中的位置
发展
该服务器使用以下方式构建:
TypeScript
模型上下文协议 SDK
用于 HTTP 请求的 Axios
Cheerio 用于 HTML 解析
修改服务器:
修改
src/index.ts重建:
npm run build错误处理
该服务器包括强大的错误处理功能:
无效的故事类型
网络故障
HTML 解析错误
参数值无效
错误将通过适当的错误代码和描述性消息返回。
贡献
欢迎贡献代码!欢迎提交 Pull 请求。
执照
MIT 许可证 - 请随意在您自己的项目中使用它。
Available Tools
1 toolget_storiesC
Get stories from Hacker News
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of stories to return (max 30) | |
| type | No | Type of stories to fetch (top, new, ask, show, jobs) | top |
TDQS
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 stories' implies a read operation, but the description doesn't mention rate limits, authentication requirements, pagination behavior, or what format the stories are returned in. For a tool with no annotation coverage, this leaves the agent with insufficient information about how the tool behaves in practice.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise - just four words that directly state the tool's purpose. Every word earns its place, and there's no wasted language. The structure is front-loaded with the essential information, making it immediately clear what the tool does.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given that there's no output schema and no annotations, the description should provide more context about what the tool returns and how it behaves. 'Get stories from Hacker News' doesn't indicate whether this fetches current stories, historical data, or what fields are included in the response. For a tool with rich parameter options but no output documentation, the description is insufficiently complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with both parameters ('limit' and 'type') fully documented in the schema itself. The description adds no additional parameter information beyond what's already in the structured schema. According to the scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Get') and resource ('stories from Hacker News'), making the purpose immediately understandable. It lacks sibling differentiation, but since there are no sibling tools on this server, that's not a deficiency. The description is specific enough to distinguish this from other potential tools like 'get_comments' or 'search_stories'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, timing considerations, or contextual factors that would help an agent decide when this is the appropriate tool. With no sibling tools, the absence of differentiation isn't problematic, but the complete lack of usage context is a significant gap.
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 tool update
v1.0.0- First observed
get_stories
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool 'get_stories' has a clearly distinct and singular purpose.
The naming is trivially consistent as there is only one tool. The tool name 'get_stories' follows a clear verb_noun pattern, which would be consistent if more tools were added.
A single tool is too few for a server named 'Hacker News MCP', which implies broader functionality. While 'get_stories' is a core operation, the server lacks tools for other common actions like getting comments, user profiles, or posting, making it feel thin and incomplete.
The tool surface is severely incomplete for a Hacker News API. It only provides 'get_stories', missing essential operations such as retrieving comments, user details, search functionality, or any write operations, which are typical for such a domain.
Maintenance
Related MCP Connectors
Scrape Hacker News stories, comments and user profiles as clean JSON with points, author…
Browse Hacker News feeds, threads, and user profiles with full-text search.
Hacker News front page and search: stories, points, comments, and which stories link to your domain.
Hacker News MCP — search and retrieve stories from Hacker News
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables access to Hacker News data including top stories, new stories, specific story details, and search functionality. Integrates with Poke to provide Hacker News content through natural language interactions.1-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to access Hacker News content through 9 comprehensive tools for fetching stories, comments, user profiles, and job postings. Supports flexible output formats, pagination, and various story categories (top, new, best, Ask HN, Show HN).-
- AlicenseAqualityBmaintenanceProvides AI agents with access to Hacker News data including top stories, story details, comment threads, and full-text search for content research and trend monitoring.5MIT
- AlicenseNot gradedqualityBmaintenanceEnables searching and retrieving top stories and individual items from Hacker News, with access to scores, comments, authors, and timestamps.15 npmMIT