hn-mcp
Uses the Algolia Hacker News API to fetch live comment threads and recent stories, complementing the local historical index with current HN data.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@hn-mcp What has HN said about Bun since 2022? Summarize the top threads."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
hn-mcp
Hacker News as a knowledge base for AI agents. An MCP server that gives Claude Code (or any MCP client) about 4.8 million HN stories since 2006 in a local DuckDB index, plus live access to comment threads and this week's stories.
把 Hacker News 二十年的帖子变成 AI Agent 的知识库:本地 DuckDB 索引(约 480 万条 story)
实时评论树和最新帖子。适合技术选型调研、趋势分析、内容选题。
Tools
Tool | What it does | Source |
| Title search (whole words, | local index |
| Mentions of up to 8 terms per year/month, normalized per 1,000 stories | local index |
| A site's HN track record: volume by year, score stats, best stories | local index |
| Top stories posted on this calendar day in every year | local index |
| One sandboxed, read-only DuckDB | local index |
| A story's comment tree in HN ranking order, as plain text | live (Algolia + HN API) |
| Stories from the last N days | live (Algolia) |
| What the local index covers | local index |
Example prompts once it is installed:
"Before I adopt Bun, what has HN said about it since 2022? Summarize the top 3 threads."
"Chart rust vs go vs zig on HN per year."
"How does substack.com perform on HN compared to medium.com?"
"What were the top HN stories on this day 10 and 15 years ago?"
Related MCP server: HackerNews MCP Server
Install
Requires uv.
git clone https://github.com/lokih1028/hn-mcp && cd hn-mcp
uv sync
uv run hn-mcp sync # builds the story index (~400 MB) in ~/.hn-mcp/stories/On a first run sync downloads the prebuilt index from the latest GitHub release
(hn-index.zip). Without one (or with --no-snapshot) it builds the index itself:
it reads only the story columns from the
open-index/hacker-news
Parquet archive (12 GB in full), one file per month, in about 20 minutes.
Either way it then tops up from the Algolia HN API,
one file per day in stories/live/, up to today. Keep it fresh with a daily
uv run hn-mcp sync --live-only # re-fetches missing days and the last 3 daysfrom cron or Task Scheduler. Set HN_MCP_DATA to keep the index somewhere else.
Register with Claude Code:
claude mcp add hn -s user -- uv --directory /path/to/hn-mcp run hn-mcpOr in any MCP client config:
{
"mcpServers": {
"hn": {
"command": "uv",
"args": ["--directory", "/path/to/hn-mcp", "run", "hn-mcp"],
"env": { "HN_MCP_DATA": "/path/to/data" }
}
}
}Notes
Deleted and dead (flagged/spam) stories are left out of the index.
The archive stopped updating on 2026-08-23, and from 2025-12 on it holds each story's score as of posting time (average ~2 points instead of ~19). Stories from 2025-12-01 on therefore come from Algolia with current scores; the archive covers everything older.
index_statusshows where the local index ends;search_recentcovers anything newer.run_sqlruns on a DuckDB connection that can only read the index folder: no other file access, no extensions, oneSELECTstatement per call.Comments are not stored locally;
get_threadfetches them live, so it needs network.
Development
uv run pytest
uv run hn-mcp pack hn-index.zip # snapshot of the local index, to attach to a releaseLicense and data
Code: MIT. Data: the open-index/hacker-news dataset is published under ODC-BY; content belongs to its Hacker News authors. Attribute the dataset if you republish derived data.
Available Tools
8 toolsdomain_reportB
Track record of a website on HN: volume per year, score stats, best stories.
Subdomains are included (e.g. 'github.com' also counts 'gist.github.com').
Useful to judge a source, blog, product or competitor.
Inputs: domain (required), top.
get_threadA
Fetch a story and its comment tree live from HN, in HN's ranking order.
Each comment has its depth (0 = top level), author, direct reply count and
plain text cut to max_chars. Use it to summarize a discussion or find the
strongest arguments on each side.
Inputs: story_id (required), max_chars, max_depth, max_comments.
index_statusB
What the local index covers: story count, first and last story time, data folder.
Inputs: no named parameters.
on_this_dayB
The top stories posted on this calendar day in every year of HN history.
date: 'MM-DD' (defaults to today, UTC). per_year: how many stories per year.
Handy for "10 years ago today" content.
Inputs: date, per_year, min_score. Returns: result
run_sqlA
Run one read-only DuckDB SELECT over the stories table for custom analysis.
Columns: id UINTEGER, author VARCHAR, time TIMESTAMP (UTC), title VARCHAR,
url VARCHAR, domain VARCHAR (no 'www.'), score INTEGER, comments INTEGER
(total descendants), text VARCHAR (HTML body of Ask/Show HN posts, else NULL).
Comments themselves are not in the index; use get_thread for those.
Inputs: sql (required), limit. Returns: result
search_recentB
Search stories from the last N days live (Algolia HN Search).
Use for anything newer than the local index (see index_status).
Inputs: query (required), days, sort, limit, +1 more. Returns: result
search_storiesA
Search archived HN stories by title words (all must match, case-insensitive).
query: space-separated whole words; quote phrases, e.g. 'rust "memory safety"';
end a word with * for prefix match ('agent*'). Empty query lists top
stories for the period.
since/until: 'YYYY', 'YYYY-MM' or 'YYYY-MM-DD' (inclusive).
include_text: also match the body of Ask/Show HN posts.
Inputs: sort, limit, query, since, +4 more. Returns: result
topic_trendB
How often each term appears in story titles over time (whole-word match, trailing * for prefix match).
Returns a per-term summary plus a compact table: one row per period with
the period's story total, then each term's matching-story count and that
count per 1,000 stories (comparable across periods).
Good for "rise and fall" charts, e.g. terms=["rust", "go", "zig"].
Inputs: terms (required), since, until, granularity.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct use case: archived search, live search, term trends, domain stats, on-this-day, thread fetching, raw SQL, and index status. The only real overlap is search_stories vs search_recent (clarified by the 'newer than the local index' note) and run_sql, which can replicate almost any other tool's output but is framed as a custom-analysis escape hatch.
All names are snake_case, but conventions are mixed: verb_noun (search_stories, run_sql, get_thread) alongside noun_noun or descriptive phrases (topic_trend, domain_report, index_status, on_this_day). Still readable and fairly predictable in intent.
Eight tools is well-scoped for an HN analysis server, with each tool covering a genuinely different query shape (keyword, trend, domain, date, SQL, live thread, live search, index health). No filler tools.
The surface covers search, trends, sources, date-based browsing, threads, and raw SQL for custom work. The main gap is an author/user report analogous to domain_report (authors are only reachable via run_sql), plus comments aren't searchable in the index, though get_thread mitigates that.
Maintenance
Related MCP Connectors
Store, query, and update structured data from any AI agent
Memory, reflection and safety for AI agents. Hosted or local, no vector database.
The system of record for AI agents — open-source (MIT) database where agents and people share data.
Versioned agent memory in your own Postgres: portable context, permissioned, audit trail.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables browsing Hacker News, searching discussions, analyzing users, and tracking tech trends with zero setup required—no API keys or authentication needed.533 npm6MIT
- AlicenseAqualityNot gradedmaintenanceEnables AI agents and developers to search, retrieve, and analyze HackerNews content including advanced post search, front page access, full comment trees, and user profile lookups through the Model Context Protocol.4MIT
- AlicenseAqualityCmaintenanceProvides AI agents with access to Hacker News data including top stories, story details, comment threads, and full-text search for content research and trend monitoring.5MIT
- AlicenseNot gradedqualityDmaintenanceProvides AI agents with Hacker News data including front-page lists, full-text search via Algolia, and recent Show HN launches.MIT