
Hn Companion Mcp
MCP for Hacker News 伴侣
概述
Hacker News 伴侣 MCP
一个使用 Claude 总结 Hacker News 讨论的模型上下文协议 (MCP)。
概述
该 MCP 获取并处理 Hacker News 讨论,将其格式化为 Claude 可以用来生成高质量摘要的形式。它处理了评论的层次结构及其元数据(评分、负票数等),以帮助 Claude 理解不同评论之间的相对重要性和关系。
功能
- 处理 Hacker News URL 或帖子 ID
- 下载并分析来自 HN 的评论结构
- 基于社区参与度对评论进行评分
- 格式化优化为 Claude 摘要的数据
安装
通过 Smithery 安装
要通过 Smithery 自动安装 Hacker News 伴侣用于 Claude Desktop:
bash
npx -y @smithery/cli install @georgeck/hn-companion-mcp --client claude
手动安装
-
克隆仓库:
git clone https://github.com/yourusername/hn-companion-mcp.git cd hn-companion-mcp
-
安装依赖:
npm install
使用
CLI
bash
node index.js <post-id-or-url>
示例:
bash
node index.js 43448075
# 或
node index.js https://news.ycombinator.com/item?id=43448075
API 服务器
启动服务器:
bash
npm start
发送请求:
bash
curl -X POST http://localhost:3000/api/summarize \
-H "Content-Type: application/json" \
-d '{"input": "https://news.ycombinator.com/item?id=43448075"}'
API 参考
POST /api/summarize
请求体:
json
{
"input": "https://news.ycombinator.com/item?id=43448075"
}
响应:
json
{
"status": "success",
"data": {
"systemPrompt": "...",
"userPrompt": "...",
"commentPathIdMapping": { ... },
"postTitle": "...",
"postId": "...",
"commentCount": 123
}
}
与 Claude 集成
该 MCP 设计用于为 Claude 提供摘要所需的数据。当用户要求 Claude 总结 Hacker News 讨论时,Claude 可以调用此 MCP 获取格式化的数据,并基于提供的系统和用户提示生成摘要。
json
"hn-companion": {
"command": "node",
"args": ["<full path to src>/hn-companion-mcp/server.js"]
}
}
许可证
MIT