Hacker News MCP Server
Pricing
Pay per event
Hacker News MCP Server
Query Hacker News data programmatically: search stories, get top posts, Ask HN, Show HN, jobs, comments, and user profiles via the free HN Algolia API.
Pricing
Pay per event
Rating
0.0
(0)
Developer
Stas Persiianenko
Actor stats
0
Bookmarked
1
Total users
0
Monthly active users
8 hours ago
Last modified
Categories
Share
Query Hacker News programmatically using the free HN Algolia API. Search stories, fetch top/front-page posts, Ask HN threads, Show HN projects, job listings, story comments, and user profiles — all without scraping, without a browser, and without an API key.
Designed as an MCP-first actor: AI agents and LLM workflows can call it as a tool. Human users can run it directly on Apify with a simple JSON input.
What does the Hacker News MCP Server do?
🔧 It exposes 7 tools wrapping the HN Algolia API:
| Tool | What it returns |
|---|---|
search_stories | Full-text search across all HN stories with optional date range |
get_top_stories | Current front-page/trending stories |
get_ask_hn | Recent Ask HN threads |
get_show_hn | Recent Show HN posts |
get_jobs | Latest HN job listings |
get_story_comments | Full comment tree for any story |
get_user_profile | User karma, bio, and account info |
No proxy is needed — the Algolia API is public and free. Each run typically completes in under 3 seconds.
Who is this for?
AI agent developers building research pipelines that need live HN data. Feed trending stories into your LLM workflow, extract what tech topics are trending today, or pull discussion threads for analysis — all via a single tool call.
Researchers and analysts tracking tech discourse. Pull Ask HN threads on a topic, compare what developers are discussing week over week, or find everyone who worked on a project from Show HN.
Recruiters and job seekers monitoring HN hiring. The get_jobs tool pulls the latest "Who is Hiring?" thread posts and HN Startups listings without any browser automation.
Developers building with Apify who want a reliable, cost-predictable HN data source with structured JSON output, scheduling, and webhook support.
Why use Hacker News MCP Server?
- ✅ No API key or login required — wraps the free public HN Algolia API
- ✅ 7 distinct tools in one actor — search, browse, comments, and users, all from one place
- ✅ MCP-native design — call individual tools from Claude, Cursor, or any MCP client
- ✅ Structured JSON output — consistent field names across all tools, ready for downstream processing
- ✅ Date range filtering — search stories within specific time windows
- ✅ HTTP-only, no browser — fast, cheap, and reliable (256 MB, ~2s average runtime)
- ✅ No scraping — uses the official Algolia search index, so no anti-bot risk
What data can you extract?
Stories (all story tools)
| Field | Description |
|---|---|
objectID | HN item ID |
title | Story title |
url | Link URL (external article or HN thread) |
author | HN username |
points | Upvotes |
num_comments | Comment count |
created_at | ISO 8601 timestamp |
text | Story body text (Ask HN / Show HN) |
tags | Algolia tags (story, ask_hn, show_hn, job, etc.) |
Comments (get_story_comments)
| Field | Description |
|---|---|
type | comment |
text | Comment body (may include HTML tags) |
parent_id | ID of parent comment or story |
story_id | Root story ID |
author | Commenter username |
created_at | Timestamp |
Users (get_user_profile)
| Field | Description |
|---|---|
karma | Karma points |
about | Bio/about text |
created_at | Account creation date |
submission_count | Number of submissions |
comment_count | Number of comments |
How much does it cost to query Hacker News data?
This actor uses pay-per-event (PPE) pricing:
| Event | Free tier | Paid tiers |
|---|---|---|
| Run start (one-time) | $0.005 | $0.0025–$0.005 |
| Tool invocation | $0.002 | $0.0008–$0.002 |
Real-world cost examples:
- Search for 20 stories: ~$0.007 total
- Fetch front-page stories (20 results): ~$0.007
- Pull 100 comments from a story: ~$0.007 (one tool call)
- Run 100 searches per day: ~$0.70/day
With the free $5 credit on Apify's Free plan, you can run approximately 700 tool invocations — enough to prototype any HN data workflow.
How to query Hacker News data
- Go to Hacker News MCP Server on Apify Store
- Click Try for free
- Set the Tool dropdown to your desired action (e.g.,
search_stories) - Fill in the relevant parameters (e.g.,
query: "Rust programming") - Click Start and wait 2–5 seconds
- View results in the Dataset tab as structured JSON
Example inputs for each tool:
// Search recent stories about AI{"tool": "search_stories","query": "LLM inference","maxResults": 20,"sortBy": "date","dateFrom": "2025-01-01T00:00:00Z"}
// Get today's top HN stories{"tool": "get_top_stories","maxResults": 30}
// Pull comments from a specific story{"tool": "get_story_comments","storyId": 39234738,"maxResults": 50}
// Look up a user profile{"tool": "get_user_profile","username": "pg"}
Input parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
tool | string | ✅ Yes | — | Tool to invoke (see 7 tool names above) |
query | string | For search_stories | — | Search keyword or phrase |
dateFrom | string | No | — | ISO 8601 start date for search_stories filter |
dateTo | string | No | — | ISO 8601 end date for search_stories filter |
storyId | integer | For get_story_comments | — | HN story ID (numeric, from the item URL) |
username | string | For get_user_profile | — | HN username |
maxResults | integer | No | 20 | Max results to return (1–100) |
sortBy | string | No | relevance | Sort order: relevance or date |
Output examples
search_stories / get_top_stories output item:
{"type": "story","objectID": "46990729","title": "An AI agent published a hit piece on me","url": "https://theshamblog.com/an-ai-agent-published-a-hit-piece-on-me/","author": "scottshambaugh","points": 2346,"num_comments": 951,"created_at": "2026-02-12T16:23:24Z","text": null,"tags": ["story", "front_page"]}
get_story_comments output item:
{"type": "comment","objectID": "47679234","author": "throweraway","text": "This is exactly why we need better tooling for...","created_at": "2026-04-07T19:12:00.000Z","parent_id": 47679121,"story_id": 47679121}
get_user_profile output item:
{"type": "user","objectID": "pg","author": "pg","karma": 157316,"about": "Bug fixer.","created_at": "2006-10-09T18:21:51Z"}
Tips for best results
- 💡 Use
sortBy: "date"withdateFromfor real-time monitoring (e.g., past 24 hours) - 💡 Keep
maxResults≤ 20 for fast runs; increase to 100 only when you need volume - 💡 For
get_story_comments: very large threads (500+ comments) return up tomaxResultscomments from the top of the tree — the API uses BFS ordering - 💡 Story IDs appear in HN URLs:
https://news.ycombinator.com/item?id=39234738→storyId: 39234738 - 💡 Schedule daily with
get_top_storiesto build a trending-story feed - 💡 Combine tools: first call
search_storiesto find a story ID, thenget_story_commentsto pull the discussion
Integrations
HN stories → Google Sheets — schedule get_top_stories daily, connect the dataset via Apify's Google Sheets integration to track which stories went viral. Use the built-in dataset export (JSON, CSV, Excel).
HN jobs → Slack — run get_jobs on a schedule, use Apify webhooks to post new listings to a #hiring Slack channel. Never miss a relevant startup job post.
HN search → Make/Zapier — trigger a search_stories run whenever a topic keyword appears, and route results to Notion, Airtable, or a CRM. Useful for competitive monitoring (track mentions of your product or competitors).
AI research pipeline — chain this actor with an LLM summarizer: pull Ask HN threads on a topic, send them to Claude/GPT for summarization, and generate a weekly digest. The structured JSON output maps cleanly to LLM context windows.
Webhooks — configure Apify webhooks on run completion to stream new HN data to your backend in real time.
Using the Apify API
Node.js (Apify client)
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: 'YOUR_TOKEN' });const run = await client.actor('automation-lab/hackernews-mcp-server').call({tool: 'search_stories',query: 'TypeScript 5.0',maxResults: 20,sortBy: 'date',});const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items);
Python
from apify_client import ApifyClientclient = ApifyClient("YOUR_TOKEN")run = client.actor("automation-lab/hackernews-mcp-server").call(run_input={"tool": "get_ask_hn","maxResults": 10,})for item in client.dataset(run["defaultDatasetId"]).iterate_items():print(item["title"], item["points"])
cURL
curl -X POST \"https://api.apify.com/v2/acts/automation-lab~hackernews-mcp-server/runs?token=YOUR_TOKEN" \-H "Content-Type: application/json" \-d '{"tool": "get_show_hn","maxResults": 20}'
Use with AI agents via MCP
Hacker News MCP Server is available as a tool for AI assistants that support the Model Context Protocol (MCP).
Add the Apify MCP server to your AI client — this gives you access to all Apify actors, including this one:
Setup for Claude Code
$claude mcp add --transport http apify "https://mcp.apify.com?tools=automation-lab/hackernews-mcp-server"
Setup for Claude Desktop, Cursor, or VS Code
Add this to your MCP config file:
{"mcpServers": {"apify": {"url": "https://mcp.apify.com?tools=automation-lab/hackernews-mcp-server"}}}
Your AI assistant will use OAuth to authenticate with your Apify account on first use.
Example prompts
Once connected, try asking your AI assistant:
- "Use automation-lab/hackernews-mcp-server to search for HN stories about Rust programming from the last 30 days, sorted by date"
- "Get the current top 20 stories from Hacker News front page and summarize the main themes"
- "Pull the comments from HN story 47679121 and find the most upvoted technical critiques"
Learn more in the Apify MCP documentation.
Is it legal to query Hacker News data?
Yes. This actor uses the official HN Algolia API (https://hn.algolia.com/api/v1/) which is a public, free, rate-limit-free API provided explicitly for programmatic access to Hacker News data. There is no scraping involved.
Hacker News content is user-submitted and governed by Y Combinator's terms of service. Respect the API's fair-use spirit: don't hammer it with thousands of requests per second, and attribute content to original authors when appropriate.
This actor does not bypass any authentication, rate limiting, or access controls.
FAQ
How fast is it?
Most runs complete in 1–3 seconds. The HN Algolia API is fast and globally distributed. The actor uses Node.js fetch() with no browser overhead.
How much does it cost for 100 searches? About $0.70 ($0.005 start + $0.002 × 100 tool calls). With Apify's free $5 credit you can run roughly 700 tool invocations before needing a paid plan.
How is this different from the official HN Firebase API? The official HN Firebase API requires fetching each item individually and has no search. The Algolia API (used here) supports full-text search, tag filtering, date range queries, and returns full hit lists in a single request. Much more practical for programmatic use.
Why do some stories have no url field?
Ask HN and some Show HN posts are self-posts (text only). For these, the URL points back to the HN thread itself. The text field contains the body.
Why did get_story_comments return only 1 item?
The story may be very old (pre-2012) or have been indexed without its comment tree by Algolia. The actor returns the story itself plus all comments it could retrieve. For older stories, the Algolia /items/{id} endpoint may have no children array.
The search returned fewer results than maxResults. Why?
The HN Algolia index may have fewer matching results than your limit, or the story was submitted very recently and not yet indexed. Try again in a few minutes for very fresh content.
Other developer tools you might like
- 🔗 Bing Search Scraper — scrape Bing web search results for any query
- 🔗 Bing News Scraper — track news coverage on any topic
- 🔗 arXiv Scraper — search and extract research papers from arXiv
- 🔗 JSON Schema Generator — generate JSON schemas from sample data
- 🔗 AI Tools Directory Scraper — discover new AI tools and products