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.
Install • CLI • MCP server • Skill • Contributing
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b6ede27dd62f8e0ab5884597a37a2fca93c39c846e4246dbf26c33853409d96
|
|
| MD5 |
1272a492824800c6826fa21c76e59cc4
|
|
| BLAKE2b-256 |
a8be166d37bd1c3e6a736de9a87acdd7077935f146a33a908a79fb615341375c
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hackernews_mcp_cli-0.2.0.tar.gz -
Subject digest:
2b6ede27dd62f8e0ab5884597a37a2fca93c39c846e4246dbf26c33853409d96 - Sigstore transparency entry: 2712918273
- Sigstore integration time:
-
Permalink:
Riddhimaan-Senapati/unofficial-HackerNews-MCP-CLI@8a0feb4a3d359e9fed346ec7e4138a478cf5bee1 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Riddhimaan-Senapati
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8a0feb4a3d359e9fed346ec7e4138a478cf5bee1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hackernews_mcp_cli-0.2.0-py3-none-any.whl.
File metadata
- Download URL: hackernews_mcp_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46e5f9fd334b52f82b79f7dbcb5683725f8a738ca56a180623107f5111a3ac75
|
|
| MD5 |
67ffe0de1859e72cea28757c68817dc5
|
|
| BLAKE2b-256 |
a1ffa27c6bb113ef9a90dca4fe47bc650cd1f57a647316ec6056e3f514b952c9
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hackernews_mcp_cli-0.2.0-py3-none-any.whl -
Subject digest:
46e5f9fd334b52f82b79f7dbcb5683725f8a738ca56a180623107f5111a3ac75 - Sigstore transparency entry: 2712918330
- Sigstore integration time:
-
Permalink:
Riddhimaan-Senapati/unofficial-HackerNews-MCP-CLI@8a0feb4a3d359e9fed346ec7e4138a478cf5bee1 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Riddhimaan-Senapati
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8a0feb4a3d359e9fed346ec7e4138a478cf5bee1 -
Trigger Event:
push
-
Statement type: