Labsco
cyanheads logo

hn-mcp-server

β˜… 4

from cyanheads

Hacker News feeds and search

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup
<div align="center"> <h1>@cyanheads/hn-mcp-server</h1> <p><b>Browse Hacker News feeds, threads, and user profiles with full-text search via MCP. STDIO or Streamable HTTP.</b> <div>4 Tools</div> </p> </div> <div align="center">

Version License Docker MCP SDK npm TypeScript Bun

</div> <div align="center">

Install in Claude Desktop Install in Cursor Install in VS Code

Framework

</div> <div align="center">

Public Hosted Server: https://hn.caseyjhand.com/mcp

</div>

Tools

Four read-only tools for accessing Hacker News data:

Tool NameDescription
hn_get_storiesFetch stories from an HN feed (top, new, best, ask, show, jobs) with pagination.
hn_get_threadGet an item and its comment tree as a threaded discussion with depth/count controls.
hn_get_userFetch a user profile with karma, about, and optionally their recent submissions.
hn_search_contentSearch stories and comments via Algolia with type, author, date, and score filters.

hn_get_stories

Fetch stories from any HN feed with pagination support.

  • Six feed types: top, new, best, ask, show, jobs
  • Configurable count (1–100, default 30) and offset for pagination
  • Returns enriched story objects with title, URL, score, author, comment count, and body text

hn_get_thread

Retrieve an item and its full comment tree via ranked breadth-first traversal.

  • Depth control (0–10, default 3) β€” depth 0 doubles as a single-item lookup
  • Comment limit (1–200, default 50) caps total comments across all levels
  • Breadth-first traversal preserves HN's ranking order
  • Flat comment list with depth/parentId for tree reconstruction

hn_get_user

Fetch a user profile with optional recent submission resolution.

  • Profile includes karma, creation date, and about text (HTML stripped)
  • Optionally resolves up to 50 most recent submissions into full items
  • Submission resolution filters out dead/deleted items

hn_search_content

Full-text search via the Algolia HN Search API.

  • Filter by content type: story, comment, ask_hn, show_hn, front_page
  • Filter by author, date range (ISO 8601), and minimum points
  • Sort by relevance or date
  • Pagination with page/count controls

Features

Built on @cyanheads/mcp-ts-core:

  • Declarative tool definitions β€” single file per tool, framework handles registration and validation
  • Unified error handling across all tools
  • Structured logging with request correlation
  • Runs locally (stdio/HTTP) from the same codebase

HN-specific:

  • Server-level instructions orientation forwarded to LLM clients on initialize β€” item types, ID reuse across tools, case-sensitive usernames, and field sparsity expectations
  • Concurrent batch fetching with configurable parallelism for item resolution
  • HTML entity decoding and tag stripping with code block and link preservation
  • No API keys required β€” HN APIs are public

Project Structure

DirectoryPurpose
src/index.tscreateApp() entry point.
src/config/Server-specific env var parsing with Zod.
src/services/hn/HN Firebase + Algolia API client and domain types.
src/mcp-server/tools/definitions/Tool definitions (*.tool.ts).

Development Guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches β€” no try/catch in tool logic
  • Use ctx.log for request-scoped logging
  • All tools are read-only β€” no auth scopes required

Contributing

Issues and pull requests are welcome. Run checks before submitting:

Copy & paste β€” that's it
bun run devcheck
bun run test

License

Apache-2.0 β€” see LICENSE for details.