Skip to main content
Glama
pskill9

Hacker News MCP

by pskill9

ハッカーニュースMCPサーバー

Hacker Newsから記事を取得するためのツールを提供するModel Context Protocol(MCP)サーバー。このサーバーはnews.ycombinator.comのHTMLコンテンツを解析し、様々なタイプの記事(トップ、新着、質問、ショー、求人)の構造化データを提供します。

特徴

  • さまざまな種類のストーリー(トップ、新着、質問、表示、求人)を取得します

  • タイトル、URL、ポイント、著者、タイムスタンプ、コメント数などの構造化データを取得します

  • 返されるストーリーの数の設定可能な制限

  • クリーンなエラー処理と検証

Related MCP server: Hacker News MCP Server

インストール

  1. リポジトリをクローンします。

git clone https://github.com/pskill9/hn-server
cd hn-server
  1. 依存関係をインストールします:

npm install
  1. サーバーを構築します。

npm run build
  1. MCP 設定構成ファイルに追加します (場所はシステムによって異なります)。

VSCode Claude 拡張機能の場合:

{
  "mcpServers": {
    "hacker-news": {
      "command": "node",
      "args": ["/path/to/hn-server/build/index.js"]
    }
  }
}

使用法

サーバーは、Hacker News から記事を取得するために使用できるget_storiesと呼ばれるツールを提供します。

ツール: get_stories

パラメータ:

  • type (文字列): 取得するストーリーの種類

    • オプション: 「トップ」、「新着」、「質問」、「表示」、「求人」

    • デフォルト: 'top'

  • limit (数値): 返されるストーリーの数

    • 範囲: 1~30

    • デフォルト: 10

使用例:

use_mcp_tool with:
server_name: "hacker-news"
tool_name: "get_stories"
arguments: {
  "type": "top",
  "limit": 5
}

サンプル出力:

[
  {
    "title": "Example Story Title",
    "url": "https://example.com/story",
    "points": 100,
    "author": "username",
    "time": "2024-12-28T00:03:05",
    "commentCount": 50,
    "rank": 1
  },
  // ... more stories
]

クロードとの統合

この MCP サーバーを Claude で使用するには、次のことが必要です。

  1. ClaudeデスクトップアプリまたはVSCode Claude拡張機能がインストールされている

  2. 設定でMCPサーバーを構成する

  3. Claudeの自然言語インターフェースを使用してHacker Newsと対話する

構成

Claude デスクトップ アプリの場合は、次のサーバー構成を追加します。

// ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
// %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
  "mcpServers": {
    "hacker-news": {
      "command": "node",
      "args": ["/path/to/hn-server/build/index.js"]
    }
  }
}

VSCode Claude 拡張機能の場合は、以下を追加します。

// VSCode Settings JSON
{
  "mcpServers": {
    "hacker-news": {
      "command": "node",
      "args": ["/path/to/hn-server/build/index.js"]
    }
  }
}

やり取りの例

設定が完了すると、自然言語を使ってクロードと対話し、Hacker Newsの記事を取得できるようになります。例:

  • 「Hacker Newsのトップ5のニュースを見せてください」

  • 「最新の Ask HN 投稿は何ですか?」

  • 「今日のショーHNのトップ投稿を取得してください」

Claude は適切なパラメータを自動的に使用して、必要なストーリーを取得します。

Hacker News MCPサーバーを使用するクロード

ストーリーオブジェクト構造

各ストーリー オブジェクトには次のものが含まれます。

  • title (文字列): ストーリーのタイトル

  • url (文字列、オプション): ストーリーのURL (テキスト投稿の場合は内部HN URL)

  • points (数値):賛成票の数

  • author (文字列): 投稿者のユーザー名

  • time (文字列): ストーリーが投稿されたときのタイムスタンプ

  • commentCount (数値): コメント数

  • rank (数字):リスト内の位置

発達

サーバーは以下を使用して構築されます:

  • タイプスクリプト

  • モデルコンテキストプロトコルSDK

  • HTTPリクエスト用のAxios

  • HTML解析用のCheerio

サーバーを変更するには:

  1. src/index.tsに変更を加える

  2. 再構築:

npm run build

エラー処理

サーバーには、次の堅牢なエラー処理機能が含まれています。

  • 無効なストーリータイプ

  • ネットワーク障害

  • HTML解析エラー

  • 無効なパラメータ値

エラーは、適切なエラー コードと説明メッセージとともに返されます。

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

ライセンス

MIT ライセンス - ご自身のプロジェクトで自由にご利用ください。

Install Server
A
license - permissive license
B
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    -
    quality
    D
    maintenance
    Enables AI assistants to access Hacker News content through 9 comprehensive tools for fetching stories, comments, user profiles, and job postings. Supports flexible output formats, pagination, and various story categories (top, new, best, Ask HN, Show HN).
  • A
    license
    A
    quality
    A
    maintenance
    Provides AI agents with access to Hacker News data including top stories, story details, comment threads, and full-text search for content research and trend monitoring.
    5
    MIT

View all related MCP servers

Related MCP Connectors

  • Browse Hacker News feeds, threads, and user profiles with full-text search.

  • Hacker News MCP — search and retrieve stories from Hacker News

  • HN front-page, Algolia full-text search, and Show HN launch tracker.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pskill9/hn-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server