Hacker News MCP Server
黑客新闻MCP服务器。
简介
Hacker News MCP 服务器是一个模型上下文协议服务器,能从 Hacker News 获取结构化故事数据(包括热门、最新、Ask HN、Show HN 和工作)。
安装步骤
# 1. 克隆仓库
git clone https://github.com/pskill9/hn-server
cd hn-server
# 2. 安装依赖
npm install
# 3. 构建服务器
npm run build
配置
将服务器添加到您的 MCP 配置文件:
{
"mcpServers": {
"hacker-news": {
"command": "node",
"args": ["/path/to/hn-server/build/index.js"]
}
}
}
📝 配置位置: VSCode Claude 扩展设置或 Claude 桌面应用配置文件
使用方法
服务器提供 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 集成
配置完成后,可以用自然语言与 Claude 交互:
- "显示 Hacker News 的前 5 个故事"
- "最新的 Ask HN 帖子是什么?"
- "获取今天的顶级 Show HN 提交"
错误处理
服务器能处理无效参数、网络故障和解析错误,并返回适当的错误消息。
许可
MIT 许可