Hacker News MCP
Okay, I understand. You want me to translate the following English description into Chinese: "Parses the HTML content from news.ycombinator.com (Hacker News) and provides structured data for different types of stories (top, new, ask, show, jobs)." Here's the translation: **中文翻译:** “解析来自 news.ycombinator.com (Hacker News) 的 HTML 内容,并为不同类型的故事(热门、最新、提问、展示、招聘)提供结构化数据。” **Explanation of the translation choices:** * **解析 (jiěxī):** "Parses" - This is the most common and accurate translation for parsing in a technical context. * **来自 (láizì):** "From" - Simple and direct. * **的 (de):** Possessive particle, connecting phrases. * **HTML 内容 (HTML nèiróng):** "HTML content" - Standard translation. * **并 (bìng):** "And" - Connects the two actions. * **为 (wèi):** "For" - Indicates the purpose of providing the data. * **不同类型的故事 (bùtóng lèixíng de gùshì):** "Different types of stories" - Clear and understandable. * **热门 (rèmén):** "Top" - Meaning popular or trending. * **最新 (zuìxīn):** "New" - Meaning the most recent. * **提问 (tíwèn):** "Ask" - Directly translates to "ask a question." * **展示 (zhǎnshì):** "Show" - Meaning to showcase or demonstrate. * **招聘 (zhāopìn):** "Jobs" - Meaning recruitment or hiring. * **提供 (tígōng):** "Provides" - Meaning to offer or supply. * **结构化数据 (jiégòuhuà shùjù):** "Structured data" - Standard translation. This translation is accurate and uses common technical terms in Chinese. It should be easily understood by anyone familiar with programming or web development.
Tools
get_stories
Get stories from Hacker News
README
Hacker News MCP 服务器
一个模型上下文协议 (MCP) 服务器,提供从 Hacker News 获取新闻的工具。此服务器解析来自 news.ycombinator.com 的 HTML 内容,并为不同类型的新闻(热门、最新、提问、展示、招聘)提供结构化数据。
<a href="https://glama.ai/mcp/servers/oge85xl22f"><img width="380" height="200" src="https://glama.ai/mcp/servers/oge85xl22f/badge" alt="Hacker News MCP server" /></a>
功能
- 获取不同类型的新闻(热门、最新、提问、展示、招聘)
- 获取结构化数据,包括标题、URL、积分、作者、时间戳和评论数
- 可配置返回的新闻数量限制
- 清晰的错误处理和验证
安装
- 克隆存储库:
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', 'new', 'ask', 'show', 'jobs'
- 默认: 'top'
limit
(数字): 要返回的新闻数量- 范围: 1-30
- 默认: 10
用法示例:
use_mcp_tool with:
server_name: "hacker-news"
tool_name: "get_stories"
arguments: {
"type": "top",
"limit": 5
}
示例输出:
[
{
"title": "示例新闻标题",
"url": "https://example.com/story",
"points": 100,
"author": "username",
"time": "2024-12-28T00:03:05",
"commentCount": 50,
"rank": 1
},
// ... 更多新闻
]
与 Claude 集成
要将此 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 新闻。 例子:
- "Show me the top 5 stories from Hacker News" (显示 Hacker News 上排名前 5 的新闻)
- "What are the latest Ask HN posts?" (最新的 Ask HN 帖子是什么?)
- "Get me the top Show HN submissions from today" (获取今天最热门的 Show HN 提交)
Claude 将自动使用适当的参数来获取您想要的新闻。
新闻对象结构
每个新闻对象包含:
title
(字符串): 新闻标题url
(字符串, 可选): 新闻的 URL(对于文本帖子,可能是内部 HN URL)points
(数字): 赞成票数author
(字符串): 发布者的用户名time
(字符串): 新闻发布的时间戳commentCount
(数字): 评论数rank
(数字): 在列表中的位置
开发
该服务器使用以下技术构建:
- TypeScript
- 模型上下文协议 SDK
- Axios 用于 HTTP 请求
- Cheerio 用于 HTML 解析
要修改服务器:
- 对
src/index.ts
进行更改 - 重新构建:
npm run build
错误处理
该服务器包括强大的错误处理,用于:
- 无效的新闻类型
- 网络故障
- HTML 解析错误
- 无效的参数值
错误将返回适当的错误代码和描述性消息。
贡献
欢迎贡献! 请随时提交 Pull Request。
许可证
MIT 许可证 - 随意在您自己的项目中使用它。
推荐服务器
mult-fetch-mcp-server
一个多功能的、符合 MCP 规范的网页内容抓取工具,支持多种模式(浏览器/Node)、格式(HTML/JSON/Markdown/文本)和智能代理检测,并提供双语界面(英语/中文)。
Knowledge Graph Memory Server
为 Claude 实现持久性记忆,使用本地知识图谱,允许 AI 记住用户的信息,并可在自定义位置存储,跨对话保持记忆。
Hyperbrowser
欢迎来到 Hyperbrowser,人工智能的互联网。Hyperbrowser 是下一代平台,旨在增强人工智能代理的能力,并实现轻松、可扩展的浏览器自动化。它专为人工智能开发者打造,消除了本地基础设施和性能瓶颈带来的麻烦,让您能够:
Exa MCP Server
一个模型上下文协议服务器,它使像 Claude 这样的人工智能助手能够以安全和受控的方式,使用 Exa AI 搜索 API 执行实时网络搜索。
mcp-perplexity
Perplexity API 的 MCP 服务器。
MCP Web Research Server
一个模型上下文协议服务器,使 Claude 能够通过集成 Google 搜索、提取网页内容和捕获屏幕截图来进行网络研究。
PubMedSearch MCP Server
一个模型内容协议(Model Content Protocol)服务器,提供从 PubMed 数据库搜索和检索学术论文的工具。

YouTube Translate MCP
一个模型上下文协议服务器,可以通过文字稿、翻译、摘要和各种语言的字幕生成来访问 YouTube 视频内容。
mcp-codex-keeper
作为开发知识的守护者,为 AI 助手提供精心策划的最新文档和最佳实践访问权限。
Perplexity Deep Research MCP
一个服务器,它允许 AI 助手使用 Perplexity 的 sonar-deep-research 模型进行网络搜索,并提供引用支持。