Hacker News

Hacker News

Parses the HTML content from news.ycombinator.com (Hacker News) and provides structured data for different types of stories (top, new, ask, show, jobs).

pskill9

Content Fetching
Visit Server

Tools

get_stories

Get stories from Hacker News

README

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

  1. Clone the repository:
git clone https://github.com/pskill9/hn-server
cd hn-server
  1. Install dependencies:
npm install
  1. Build the server:
npm run build
  1. 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:

  1. Have the Claude desktop app or VSCode Claude extension installed
  2. Configure the MCP server in your settings
  3. 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.

Claude using the Hacker News MCP server

Story Object Structure

Each story object contains:

  • title (string): The story title
  • url (string, optional): URL of the story (may be internal HN URL for text posts)
  • points (number): Number of upvotes
  • author (string): Username of the poster
  • time (string): Timestamp of when the story was posted
  • commentCount (number): Number of comments
  • rank (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:

  1. Make changes to src/index.ts
  2. 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.

Recommended Servers

Mult Fetch MCP Server

Mult Fetch MCP Server

A versatile MCP-compliant web content fetching tool that supports multiple modes (browser/node), formats (HTML/JSON/Markdown/Text), and intelligent proxy detection, with bilingual interface (English/Chinese).

Featured
Local
Persistent Knowledge Graph

Persistent Knowledge Graph

An implementation of persistent memory for Claude using a local knowledge graph, allowing the AI to remember information about users across conversations with customizable storage location.

Featured
Local
Hyperbrowser MCP Server

Hyperbrowser MCP Server

Welcome to Hyperbrowser, the Internet for AI. Hyperbrowser is the next-generation platform empowering AI agents and enabling effortless, scalable browser automation. Built specifically for AI developers, it eliminates the headaches of local infrastructure and performance bottlenecks, allowing you to

Featured
Local
Exa MCP

Exa MCP

A Model Context Protocol server that enables AI assistants like Claude to perform real-time web searches using the Exa AI Search API in a safe and controlled manner.

Featured
Perplexity Chat MCP Server

Perplexity Chat MCP Server

MCP Server for the Perplexity API.

Featured
Web Research Server

Web Research Server

A Model Context Protocol server that enables Claude to perform web research by integrating Google search, extracting webpage content, and capturing screenshots.

Featured
PubMedSearch

PubMedSearch

A Model Content Protocol server that provides tools to search and retrieve academic papers from PubMed database.

Featured
Youtube Translate

Youtube Translate

A Model Context Protocol server that enables access to YouTube video content through transcripts, translations, summaries, and subtitle generation in various languages.

Featured
Aindreyway Codex Keeper

Aindreyway Codex Keeper

Serves as a guardian of development knowledge, providing AI assistants with curated access to latest documentation and best practices.

Featured
Perplexity Deep Research

Perplexity Deep Research

A server that allows AI assistants to perform web searches using Perplexity's sonar-deep-research model with citation support.

Featured