Skip to main content

unofficial-HackerNews-MCP-CLI

An unofficial HackerNews MCP server and CLI. Reads the top, new, best, Ask, Show, and job story lists, individual items, threaded comments, and user profiles through one shared async client. Built with FastMCP and Typer.

PyPI version PyPI downloads CI Release workflow skills.sh license Python 3.10+

InstallCLIMCP serverSkillContributing

This project wraps the official HackerNews API behind one shared async client and exposes it two ways:

  • hn, a Typer CLI that renders Rich tables in the terminal.
  • hn-mcp, a FastMCP server that exposes the same operations as MCP tools for Claude and other MCP clients.

The API is read-only, needs no authentication, and has no rate limit.

Install

Requires Python 3.10+ and uv.

uv sync                    # create the venv and install
uv run hn stories top     # run the CLI without installing scripts
# or install the console scripts (hn, hn-mcp) into the environment:
uv pip install -e .

CLI

hn stories top             # front-page (top) stories
hn stories top --limit 10  # -n 10
hn stories new             # newest stories
hn stories best            # best recent stories
hn stories ask             # latest Ask HN
hn stories show            # latest Show HN
hn stories job             # latest job postings

hn item 8863               # a single story, comment, job, or poll
hn comments 8863           # threaded comment tree (--depth, --limit)
hn user pg                 # a user's profile (case-sensitive name)

hn max-item                # id of the most recently created item
hn updates                 # recently changed items and profiles

hn --version               # print the installed version

Add --json to any command to get raw JSON instead of a table, for scripting:

hn stories top -n 5 --json | jq -r '.[] | "\(.title) (\(.url // .hn_url))"'
hn user pg --json | jq .karma

Run hn --help for the full command list, or hn <command> --help for that command's options and examples.

MCP server

Run over stdio, the default transport for MCP clients:

hn-mcp

Or over HTTP:

hn-mcp --http --host 127.0.0.1 --port 8000

Register it with an MCP client such as Claude Desktop or Claude Code:

{
  "mcpServers": {
    "hackernews": { "command": "hn-mcp" }
  }
}

Tools

Tool Description
get_stories(category, limit) A list of stories; category is one of top, new, best, ask, show, or job
get_item(item_id) A single story, comment, job, or poll
get_comments(item_id, max_depth, max_per_level) Threaded comment tree
get_user(username) A user's public profile
get_max_item_id() id of the most recently created item
get_updates() Items and profiles that changed most recently

Skill

skills/hackernews/SKILL.md is an Agent Skill that teaches an agent how and when to use the hn CLI and the hn-mcp MCP server. It is published on skills.sh. Install it with the skills CLI, or add the console scripts and let your agent load it from this directory:

npx skills add Riddhimaan-Senapati/unofficial-HackerNews-MCP-CLI

Project layout

src/hn/
  client.py   # shared async HackerNews API client (httpx)
  models.py   # Pydantic models for items and users
  server.py   # FastMCP server (hn-mcp)
  cli.py      # Typer CLI (hn)
skills/hackernews/SKILL.md
tests/        # pytest + respx (mocked API)

Development

uv run ruff check .          # lint
uv run ruff format --check . # formatting
uv run pytest                # test suite (API calls are mocked)

CI runs lint, formatting, and the test suite on Python 3.10 through 3.13 via GitHub Actions. See CONTRIBUTING.md for the full workflow.

License

MIT. See LICENSE. This is an unofficial project and is not affiliated with Hacker News or Y Combinator.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hackernews_mcp_cli-0.2.0.tar.gz (118.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hackernews_mcp_cli-0.2.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file hackernews_mcp_cli-0.2.0.tar.gz.

File metadata

  • Download URL: hackernews_mcp_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 118.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hackernews_mcp_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2b6ede27dd62f8e0ab5884597a37a2fca93c39c846e4246dbf26c33853409d96
MD5 1272a492824800c6826fa21c76e59cc4
BLAKE2b-256 a8be166d37bd1c3e6a736de9a87acdd7077935f146a33a908a79fb615341375c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hackernews_mcp_cli-0.2.0.tar.gz:

Publisher: release.yml on Riddhimaan-Senapati/unofficial-HackerNews-MCP-CLI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hackernews_mcp_cli-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hackernews_mcp_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46e5f9fd334b52f82b79f7dbcb5683725f8a738ca56a180623107f5111a3ac75
MD5 67ffe0de1859e72cea28757c68817dc5
BLAKE2b-256 a1ffa27c6bb113ef9a90dca4fe47bc650cd1f57a647316ec6056e3f514b952c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for hackernews_mcp_cli-0.2.0-py3-none-any.whl:

Publisher: release.yml on Riddhimaan-Senapati/unofficial-HackerNews-MCP-CLI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page