Skip to main content

Unofficial HackerNews MCP server and CLI, built with FastMCP and Typer

Project description

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 license Python 3.10+

InstallCLIMCP serverSkillContributing

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

  • hn, a Typer command-line client with Rich-formatted output.
  • 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 top              # run the CLI without installing scripts
# or install the console scripts (hn, hn-mcp) into the environment:
uv pip install -e .

CLI

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

hn item 8863           # a single story/comment/job/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

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

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

Run hn --help for the full command list.

MCP server

Run over stdio, which is the transport MCP clients use by default:

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, 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 Claude how and when to use the hn CLI and MCP server.

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.

Project details


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.1.0.tar.gz (116.5 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.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hackernews_mcp_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 116.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hackernews_mcp_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ecc2626b245bd28a08602654b5affb7fffc72ff5948ab883f893c05161d4af08
MD5 a20e7ec4677105a1de0ffc1bedc89c5b
BLAKE2b-256 eea7090c6e6b753698058fb1449402113a7ef73537a793c136179708d438e73e

See more details on using hashes here.

Provenance

The following attestation bundles were made for hackernews_mcp_cli-0.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hackernews_mcp_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bc47146c02ad44a23cc13b946ec494f2bc54f6ece5fc8659107971f805bed02
MD5 7e37581e512ab0460b656c5b67724139
BLAKE2b-256 238ba1892efedb22eb5f7760c2b1342b65a7d24c513771cdb592451e01bc7d47

See more details on using hashes here.

Provenance

The following attestation bundles were made for hackernews_mcp_cli-0.1.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.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page