Hacker News Mcp Server
Panoramica
Che cos'è hn-server?
Il ### hn-server è un repository pubblico creato dall'utente ### pskill9 su GitHub. Funziona come un'implementazione server per Hacker News, un popolare sito web di notizie sociali che si concentra su informatica e imprenditorialità. Questo progetto consente agli utenti di interagire con Hacker News tramite un'applicazione lato server, abilitando funzionalità come il recupero di articoli di notizie, la sottomissione di storie e i commenti, il tutto rispettando l'API di Hacker News.
Caratteristiche di hn-server
- Accesso Pubblico: Il repository è aperto al pubblico, consentendo a chiunque di visualizzare, forkare o contribuire al progetto.
- Licenza MIT: Il progetto è concesso in licenza sotto la licenza MIT, che consente agli utenti di utilizzare, copiare, modificare e distribuire il software.
- Comunità Attiva: Il repository ha attirato attenzione con 35 stelle e 8 fork, indicando un crescente interesse e coinvolgimento della comunità.
- Integrazione Facile: Il server può essere facilmente integrato con varie applicazioni, fornendo un'esperienza fluida per gli sviluppatori che desiderano utilizzare i dati di Hacker News.
- Documentazione: È disponibile una documentazione completa per aiutare gli utenti a capire come configurare e utilizzare il server in modo efficace.
Come Usare hn-server
-
Clona il Repository: Inizia clonando il repository hn-server sulla tua macchina locale utilizzando il comando:
git clone https://github.com/pskill9/hn-server.git
-
Installa le Dipendenze: Naviga nella directory del progetto e installa le dipendenze necessarie. Questo può essere fatto tipicamente utilizzando un gestore di pacchetti come npm o yarn, a seconda della configurazione del progetto.
-
Esegui il Server: Dopo aver installato le dipendenze, puoi eseguire il server utilizzando il comando specificato nella documentazione (di solito qualcosa come
npm start
). -
Interagisci con l'API: Una volta che il server è in esecuzione, puoi interagire con gli endpoint dell'API di Hacker News per recuperare articoli di notizie, sottomettere storie e altro.
-
Contribuisci: Se desideri contribuire al progetto, sentiti libero di forkare il repository, apportare le tue modifiche e inviare una pull request.
Domande Frequenti
Quali tecnologie sono utilizzate in hn-server?
hn-server è tipicamente costruito utilizzando JavaScript e Node.js, sfruttando varie librerie e framework per facilitare le operazioni lato server.
Posso contribuire al progetto hn-server?
Sì! Le contribuzioni sono benvenute. Puoi forkare il repository, apportare modifiche e inviare una pull request per la revisione.
C'è un modo per eseguire hn-server localmente?
Assolutamente! Puoi clonare il repository e seguire le istruzioni di configurazione nella documentazione per eseguirlo sulla tua macchina locale.
Qual è lo scopo della licenza MIT?
La licenza MIT consente agli utenti di utilizzare liberamente, modificare e distribuire il software, promuovendo la collaborazione e l'innovazione open-source.
Come posso segnalare problemi o bug?
Puoi segnalare problemi navigando nella scheda "Issues" nel repository GitHub di hn-server e inviando un nuovo problema con dettagli sul problema che stai riscontrando.
Dettaglio
Hacker News MCP Server
A Model Context Protocol (MCP) server that provides tools for fetching stories from Hacker News. This server parses the HTML content from news.ycombinator.com and provides structured data for different types of stories (top, new, ask, show, jobs).
<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>
Features
- Fetch different types of stories (top, new, ask, show, jobs)
- Get structured data including titles, URLs, points, authors, timestamps, and comment counts
- Configurable limit on number of stories returned
- Clean error handling and validation
Installation
- Clone the repository:
git clone https://github.com/pskill9/hn-server
cd hn-server
- Install dependencies:
npm install
- Build the server:
npm run build
- Add to your MCP settings configuration file (location depends on your system):
For VSCode Claude extension:
{
"mcpServers": {
"hacker-news": {
"command": "node",
"args": ["/path/to/hn-server/build/index.js"]
}
}
}
Usage
The server provides a tool called get_stories
that can be used to fetch stories from Hacker News.
Tool: get_stories
Parameters:
type
(string): Type of stories to fetch- Options: 'top', 'new', 'ask', 'show', 'jobs'
- Default: 'top'
limit
(number): Number of stories to return- Range: 1-30
- Default: 10
Example usage:
use_mcp_tool with:
server_name: "hacker-news"
tool_name: "get_stories"
arguments: {
"type": "top",
"limit": 5
}
Sample output:
[
{
"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
]
Integrating with Claude
To use this MCP server with Claude, you'll need to:
- Have the Claude desktop app or VSCode Claude extension installed
- Configure the MCP server in your settings
- Use Claude's natural language interface to interact with Hacker News
Configuration
For the Claude desktop app, add the server configuration to:
// ~/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"]
}
}
}
For the VSCode Claude extension, add to:
// VSCode Settings JSON
{
"mcpServers": {
"hacker-news": {
"command": "node",
"args": ["/path/to/hn-server/build/index.js"]
}
}
}
Example Interactions
Once configured, you can interact with Claude using natural language to fetch Hacker News stories. Examples:
- "Show me the top 5 stories from Hacker News"
- "What are the latest Ask HN posts?"
- "Get me the top Show HN submissions from today"
Claude will automatically use the appropriate parameters to fetch the stories you want.
Story Object Structure
Each story object contains:
title
(string): The story titleurl
(string, optional): URL of the story (may be internal HN URL for text posts)points
(number): Number of upvotesauthor
(string): Username of the postertime
(string): Timestamp of when the story was postedcommentCount
(number): Number of commentsrank
(number): Position in the list
Development
The server is built using:
- TypeScript
- Model Context Protocol SDK
- Axios for HTTP requests
- Cheerio for HTML parsing
To modify the server:
- Make changes to
src/index.ts
- Rebuild:
npm run build
Error Handling
The server includes robust error handling for:
- Invalid story types
- Network failures
- HTML parsing errors
- Invalid parameter values
Errors are returned with appropriate error codes and descriptive messages.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - feel free to use this in your own projects.
Configurazione Server
{
"mcpServers": {
"hn-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--pskill9--hn-server--hn-server",
"node ./build/index.js"
],
"env": {}
}
}
}