Логотип hn-mcp-server

hn-mcp-server

Спільнота
cyanheads

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

Видавецьcyanheads
Репозиторійhn-mcp-server
МоваTypeScript
Форки
1
Зірки
4
Доступні інструменти
4
Тип транспортуstdio
Категорії
ЛіцензіяApache-2.0
Посилання
  • Підключайте інструменти до робочих процесів із ШІ

    hn-mcp-server надає можливості MCP, які можуть використовувати сумісні клієнтські ШІ-застосунки та агенти.

  • Доступні інструменти: 4

    Перегляньте нижче дії, які можна викликати, з назвами й описами, якщо сервер їх надає.

  • Готова конфігурація для копіювання

    Скористайтеся прикладами конфігурації, щоб налаштувати цей сервер у вибраному клієнті MCP.

  • Показники інтересу до відкритого коду

    Зірки: 4, форки: 1 — у пов’язаному репозиторії.

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.

Встановлення

TypingMind
Передумови:

Node.js 18+

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

Доступні інструменти

  • 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

Використовуйте MCP hn-mcp-server з різними моделями ШІ

TypingMind підключає інструменти MCP на рівні робочого простору, тож після підключення hn-mcp-server ви можете використовувати їх із різними моделями ШІ в TypingMind, а не налаштовувати окремо для кожної моделі. Ця інтеграція MCP працює локально через конектор MCP TypingMind на вашому пристрої.

Інструкція з налаштування локального конектора

Виберіть цей варіант, якщо серверу MCP потрібен доступ до локальних файлів, програм або приватних ресурсів на вашому комп’ютері.

1

Відкрийте налаштування MCP

У TypingMind перейдіть до розділу «Налаштування», відкрийте «Розширені налаштування», потім «Протокол контексту моделі» й виберіть «Параметри конектора».

  1. Відкрийте TypingMind у браузері.
  2. Натисніть значок налаштувань.
  3. Перейдіть до розділу «Розширені налаштування».
  4. Відкрийте розділ «Протокол контексту моделі».
  5. Натисніть «Параметри конектора» й виберіть «Цей пристрій».
Екран налаштування конектора MCP у TypingMind з вибраним варіантом «Цей пристрій»
2

Виконайте команду конектора

Виберіть «Цей пристрій», скопіюйте команду з TypingMind і виконайте її в терміналі. Не зупиняйте процес, поки користуєтеся MCP.

  1. Скопіюйте команду налаштування, показану в TypingMind.
  2. Відкрийте «Термінал» у macOS або Windows Terminal у Windows.
  3. Вставте й виконайте команду.
  4. Підтвердьте встановлення пакета, якщо термінал запитає дозволу продовжити.
  5. Не закривайте вікно термінала й не зупиняйте процес, поки користуєтеся інструментами MCP.
3

Додайте hn-mcp-server як сервер

Коли статус конектора зміниться на «Готово», натисніть «Змінити сервери» та вставте конфігурацію сервера MCP.

  1. Зачекайте, доки статус конектора зміниться на «Готово».
  2. Натисніть «Змінити сервери».
  3. Вставте конфігурацію сервера MCP hn-mcp-server.
  4. Збережіть список серверів.
  5. Оновіть дані, щоб переконатися, що конектор досі готовий до роботи.
Налаштування MCP у TypingMind з активним сервером і кнопкою «Змінити сервери»
{
  "mcpServers": {
    "hn-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@cyanheads/hn-mcp-server"
      ]
    }
  }
}
4

Використовуйте підключення з різними моделями

Збережіть список серверів, відкрийте «Плагіни», увімкніть інструменти MCP для hn-mcp-server, а потім виберіть будь-яку підтримувану модель ШІ в TypingMind і використовуйте інструменти в чаті або призначте їх агенту ШІ.

  1. Відкрийте сторінку «Плагіни» в TypingMind.
  2. Увімкніть інструменти MCP для hn-mcp-server.
  3. Почніть чат і виберіть модель ШІ, яку хочете використовувати.
  4. Використовуйте інструменти MCP у чаті або призначте їх агенту ШІ.
  5. За потреби перемикайтеся на іншу модель ШІ без повторного підключення MCP.
Чат TypingMind із використанням увімкнених інструментів MCP і вибраної моделі ШІ
Допоможете з цим завданням через hn-mcp-server?
hn-mcp-server
Звісно. Я це прочитав.
Ось що я знайшов за допомогою hn-mcp-server.

Поширені запитання

Для чого використовується сервер MCP hn-mcp-server?

hn-mcp-server — це сервер MCP, який дає змогу сумісним клієнтам ШІ підключатися до зовнішніх інструментів і контексту. У TypingMind ви можете додати цей сервер MCP один раз і зробити його інструменти доступними у своєму робочому просторі ШІ.

Чи можу я використовувати MCP hn-mcp-server з кількома моделями ШІ в TypingMind?

Так. TypingMind підключає інструменти MCP на рівні робочого простору, тому ви можете використовувати hn-mcp-server з різними моделями ШІ, як-от Claude, ChatGPT, Gemini або іншими моделями, які ви налаштували в TypingMind, без окремого налаштування сервера MCP для кожної моделі.

Навіщо використовувати MCP hn-mcp-server із TypingMind?

TypingMind — один із найкращих інтерфейсів для чату з великими мовними моделями, адже він об’єднує різні моделі ШІ, промпти, плагіни, агентів ШІ, ключі API та інструменти MCP в одному робочому просторі. Підключивши hn-mcp-server, ви зможете використовувати його інструменти MCP з вибраними моделями та впорядковано працювати з чатами в TypingMind.

Як підключити MCP hn-mcp-server до TypingMind?

hn-mcp-server працює через локальний конектор MCP TypingMind. Це найкращий варіант, коли серверу MCP потрібен доступ до локальних файлів, настільних застосунків, інструментів командного рядка або приватних ресурсів на вашому комп’ютері.

Які інструменти надає MCP hn-mcp-server у TypingMind?

hn-mcp-server надає інструменти MCP (4), які можна ввімкнути на сторінці «Плагіни» в TypingMind і використовувати в чаті або призначати агентам ШІ.

Чи потрібно передавати свої ключі API в TypingMind, щоб використовувати MCP hn-mcp-server?

Ні. TypingMind орієнтований насамперед на локальну роботу й дає змогу зберігати контроль над постачальниками моделей, ключами API, промптами та конфігурацією MCP. Якщо hn-mcp-server потребує автентифікації, під час створення підключення додайте потрібні заголовки, налаштування OAuth або локальну конфігурацію для цього сервера MCP.

Схожі сервери MCP

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇