hn-mcp-server logo

hn-mcp-server

Community
cyanheads

Browse Hacker News feeds, threads, and user profiles with full-text search via MCP. STDIO or Streamable HTTP.

Publishercyanheads
Repositoryhn-mcp-server
LanguageTypeScript
Forks
1
Stars
4
Available tools
4
Transport typestdio
Categories
LicenseApache-2.0
Links
  • Connect tools to AI workflows

    hn-mcp-server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 4 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    4 stars and 1 forks from the linked repository.

Version License Docker MCP SDK npm TypeScript Bun

Install in Claude Desktop Install in Cursor Install in VS Code

Framework

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


Overview

Feeds, threads, and profiles from the Hacker News Firebase API and Algolia Search API. Browse ranked feeds, read full comment threads, look up user profiles, and search stories and comments by type, author, date, or score. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.

Tools

ToolDescription
hn_get_storiesFetch stories from an HN feed (top, new, best, ask, show, jobs), with title, URL, score, author, and comment count
hn_get_threadGet an item and its comment tree as a threaded discussion, with depth and comment-count controls
hn_get_userFetch a user profile with karma, about, and optionally a page of resolved submissions
hn_search_contentSearch stories and comments via Algolia, filterable by type, author, date range, and minimum points

Capability reference

hn_get_stories tool

  • Six feed types: top, new, best, ask, show, jobs; count (1–100, default 30) and offset for pagination
  • Returns id, type, title, url, domain, score, author, timestamp, comment count, and body text — each field omitted (not null) when HN doesn't provide it
  • Enrichment reports total, offset, hasMore, and a notice explaining empty pages (empty feed, offset past end, or every item on the page deleted/flagged)

hn_get_thread tool

  • itemId plus depth (0–10, default 3; 0 returns the item with no comments) and maxComments (1–200, default 50) capping the total across all levels
  • Breadth-first traversal ranked like HN — top-ranked top-level comments resolve first, replies fill in only after the level above is exhausted
  • Flat comment list carries depth/parentId for tree reconstruction, plus childCount and an isOp flag when the comment author matches the root item's author
  • notice reports deleted/dead comments omitted during traversal and, when totalLoaded is below totalAvailable, the hint to raise maxComments/depth

hn_get_user tool

  • username is case-sensitive and trimmed; includeSubmissions (default false) resolves recent submissions, with submissionCount (1–50, default 10) and submissionOffset paging through a long history
  • Profile includes karma, creation date, and about text (HTML stripped); submissions filter out dead/deleted items
  • Enrichment echoes submissionOffset and the offset to send next, or a notice when the requested offset is past the end of the history

hn_search_content tool

  • Free-text query plus tags (story/comment/ask_hn/show_hn/front_page), author, dateRange (ISO 8601), and minPoints filters; sort by relevance or date; count (1–50, default 30) and page for pagination
  • view: "compact" drops the two body-text fields (text, highlights.text), which otherwise repeat a long comment twice per hit — pass a hit id to hn_get_thread to read the body
  • Highlight metadata (highlights.title, highlights.text, matchedWords) shows which terms matched and where
  • Enrichment reports totalHits, page, and the actual reachable totalPages — not derived from totalHits, since broad queries report far more hits than Algolia will serve

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

HN-specific:

  • Two upstream APIs: HN's Firebase API for feeds, items, and users; Algolia's HN Search API for full-text search
  • Concurrent batch fetching with configurable parallelism for item resolution (HN_CONCURRENCY_LIMIT)
  • HTML entity decoding and tag stripping, preserving code blocks and links
  • Server-level instructions forwarded to LLM clients on initialize — item types, ID reuse across tools, case-sensitive usernames, field sparsity
  • No API keys required — both upstream APIs are public

Agent-friendly output:

  • Graceful partial failure — hn_get_thread counts deleted and dead comments dropped during traversal and surfaces the count in notice rather than silently shrinking the result; hn_get_stories and hn_get_user filter dead/deleted items the same way
  • Discriminated output contracts — typed error reasons (item_not_found, upstream_rate_limited, upstream_html, …) with per-reason recovery text, and a depth/parentId pair on every comment so callers reconstruct the tree without guessing nesting
  • Pagination provenance — every paged tool echoes the offset it used (offset, submissionOffset, page) plus the exact next-offset value in notice, so an agent can resume a listing without recomputing state
  • Response shaping — HTML stripping, URL normalization, and domain extraction remove upstream markup noise; hn_search_content's view: "compact" drops the two body-text fields that otherwise duplicate a hit's full text

Getting started

Public Hosted Instance

A public instance is available at https://hn.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:

json
{
  "mcpServers": {
    "hn-mcp-server": {
      "type": "streamable-http",
      "url": "https://hn.caseyjhand.com/mcp"
    }
  }
}

Self-Hosted / Local

Add to your MCP client configuration file:

json
{
  "mcpServers": {
    "hn-mcp-server": {
      "type": "stdio",
      "command": "bunx",
      "args": ["@cyanheads/hn-mcp-server@latest"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio",
        "MCP_LOG_LEVEL": "info"
      }
    }
  }
}

Or with npx (no Bun required):

json
{
  "mcpServers": {
    "hn-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@cyanheads/hn-mcp-server"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio",
        "MCP_LOG_LEVEL": "info"
      }
    }
  }
}

Or with Docker:

json
{
  "mcpServers": {
    "hn-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "MCP_TRANSPORT_TYPE=stdio",
        "ghcr.io/cyanheads/hn-mcp-server:latest"
      ]
    }
  }
}

Prerequisites

Installation

sh
git clone https://github.com/cyanheads/hn-mcp-server.git
cd hn-mcp-server
bun install

Configuration

All configuration is via environment variables. No API keys required — HN APIs are public.

VariableDescriptionDefault
HN_CONCURRENCY_LIMITMax concurrent HTTP requests for batch item fetches (integer, 1–50).10
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTHTTP server port.3010
MCP_HTTP_HOSTHTTP server host.localhost
MCP_SESSION_MODEHTTP session handling: stateful, stateless, or auto (resolves to stateful). The server declares stateless in source, and the published Docker image and .env.example set it too; a meaningful env value still overrides.stateless
MCP_LOG_LEVELLog level: debug, info, notice, warning, error.info
LOGS_DIRDirectory for log files (Node.js only).<project-root>/logs

See .env.example for the full list of optional overrides.

Running the server

Local development

  • Dev mode (auto-reload):

    sh
    MCP_TRANSPORT_TYPE=stdio bun --watch src/index.ts   # stdio
    MCP_TRANSPORT_TYPE=http bun --watch src/index.ts    # HTTP
  • Build and run:

    sh
    bun run rebuild
    bun run start:stdio   # or start:http
  • Run checks and tests:

    sh
    bun run devcheck   # Lint, format, typecheck, security
    bun run test       # Vitest test suite

Docker

sh
docker build -t hn-mcp-server .
docker run --rm -p 3010:3010 hn-mcp-server

The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/hn-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point — registers tools and inits the HN service.
src/config/Server-specific environment variable parsing and validation with Zod.
src/mcp-server/tools/definitions/Tool definitions (*.tool.ts).
src/services/hn/HN Firebase + Algolia API client and domain types.
tests/Unit and integration tests mirroring src/.

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
  • Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields

Contributing

Issues are welcome. Run checks before submitting:

sh
bun run devcheck
bun run test

License

Apache-2.0 — see LICENSE for details.

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "hn-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@cyanheads/hn-mcp-server"
      ]
    }
  }
}

Available Tools

  • hn_get_stories

    Fetch stories from an HN feed (top, new, best, ask, show, jobs) with pagination

  • hn_get_thread

    Get an item and its comment tree as a threaded discussion with depth/count controls

  • hn_get_user

    Fetch a user profile with karma, about, and optionally their recent submissions

  • hn_search_content

    Search stories and comments via Algolia with type, author, date, and score filters

Use hn-mcp-server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once hn-mcp-server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add hn-mcp-server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the hn-mcp-server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "hn-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@cyanheads/hn-mcp-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the hn-mcp-server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the hn-mcp-server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use hn-mcp-server to help me with this task?
hn-mcp-server
Sure. I read it.
Here is what I found using hn-mcp-server.

Frequently asked questions

What is the hn-mcp-server MCP server used for?

hn-mcp-server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use hn-mcp-server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use hn-mcp-server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use hn-mcp-server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With hn-mcp-server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect hn-mcp-server MCP to TypingMind?

hn-mcp-server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does hn-mcp-server MCP provide in TypingMind?

hn-mcp-server exposes 4 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use hn-mcp-server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If hn-mcp-server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇