Skip to main content
Glama

Hacker News MCP

by pskill9

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

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

特徴

  • さまざまな種類のストーリー(トップ、新着、質問、表示、求人)を取得します
  • タイトル、URL、ポイント、著者、タイムスタンプ、コメント数などの構造化データを取得します
  • 返されるストーリーの数の設定可能な制限
  • クリーンなエラー処理と検証

インストール

  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
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

news.ycombinator.com (Hacker News) からの HTML コンテンツを解析し、さまざまな種類のストーリー (トップ、新着、質問、表示、求人) の構造化データを提供します。

  1. 特徴
    1. インストール
      1. 使用法
        1. ツール: get\_stories
      2. クロードとの統合
        1. 構成
        2. やり取りの例
        3. ストーリーオブジェクト構造
      3. 発達
        1. エラー処理
          1. 貢献
            1. ライセンス

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                Provides tools to fetch and search news from The Verge's RSS feed, allowing users to get today's news, retrieve random articles from the past week, and search for specific keywords in recent Verge content.
                Last updated -
                3
                1
                TypeScript
                MIT License
                • Apple
              • A
                security
                A
                license
                A
                quality
                Enables extracting data from websites using natural language prompts, allowing users to specify exactly what content they want in plain English and returning structured JSON data.
                Last updated -
                1
                1,379
                4
                TypeScript
                MIT License
                • Apple
                • Linux
              • A
                security
                A
                license
                A
                quality
                Adds powerful Hacker News integration to LLM clients, allowing users to access stories, comments, user profiles, and search functionality through the Model Context Protocol.
                Last updated -
                9
                25
                4
                JavaScript
                MIT License
              • -
                security
                F
                license
                -
                quality
                Provides functionality to fetch web content in various formats, including HTML, JSON, plain text, and Markdown.
                Last updated -
                125,855
                1

              View all related MCP servers

              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