Hacker News MCP Server avatar

Hacker News MCP Server

Pricing

Pay per event

Go to Apify Store
Hacker News MCP Server

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

Stas Persiianenko

Maintained by Community

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:

ToolWhat it returns
search_storiesFull-text search across all HN stories with optional date range
get_top_storiesCurrent front-page/trending stories
get_ask_hnRecent Ask HN threads
get_show_hnRecent Show HN posts
get_jobsLatest HN job listings
get_story_commentsFull comment tree for any story
get_user_profileUser 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)

FieldDescription
objectIDHN item ID
titleStory title
urlLink URL (external article or HN thread)
authorHN username
pointsUpvotes
num_commentsComment count
created_atISO 8601 timestamp
textStory body text (Ask HN / Show HN)
tagsAlgolia tags (story, ask_hn, show_hn, job, etc.)

Comments (get_story_comments)

FieldDescription
typecomment
textComment body (may include HTML tags)
parent_idID of parent comment or story
story_idRoot story ID
authorCommenter username
created_atTimestamp

Users (get_user_profile)

FieldDescription
karmaKarma points
aboutBio/about text
created_atAccount creation date
submission_countNumber of submissions
comment_countNumber of comments

How much does it cost to query Hacker News data?

This actor uses pay-per-event (PPE) pricing:

EventFree tierPaid 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

  1. Go to Hacker News MCP Server on Apify Store
  2. Click Try for free
  3. Set the Tool dropdown to your desired action (e.g., search_stories)
  4. Fill in the relevant parameters (e.g., query: "Rust programming")
  5. Click Start and wait 2–5 seconds
  6. 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

ParameterTypeRequiredDefaultDescription
toolstring✅ YesTool to invoke (see 7 tool names above)
querystringFor search_storiesSearch keyword or phrase
dateFromstringNoISO 8601 start date for search_stories filter
dateTostringNoISO 8601 end date for search_stories filter
storyIdintegerFor get_story_commentsHN story ID (numeric, from the item URL)
usernamestringFor get_user_profileHN username
maxResultsintegerNo20Max results to return (1–100)
sortBystringNorelevanceSort 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" with dateFrom for 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 to maxResults comments from the top of the tree — the API uses BFS ordering
  • 💡 Story IDs appear in HN URLs: https://news.ycombinator.com/item?id=39234738storyId: 39234738
  • 💡 Schedule daily with get_top_stories to build a trending-story feed
  • 💡 Combine tools: first call search_stories to find a story ID, then get_story_comments to 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 ApifyClient
client = 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.

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