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 ライセンス - ご自身のプロジェクトで自由にご利用ください。

Available Tools

1 tool
get_storiesC

Get stories from Hacker News

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of stories to return (max 30)
typeNoType of stories to fetch (top, new, ask, show, jobs)top

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Get stories' implies a read operation, but the description doesn't mention rate limits, authentication requirements, pagination behavior, or what format the stories are returned in. For a tool with no annotation coverage, this leaves the agent with insufficient information about how the tool behaves in practice.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - just four words that directly state the tool's purpose. Every word earns its place, and there's no wasted language. The structure is front-loaded with the essential information, making it immediately clear what the tool does.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there's no output schema and no annotations, the description should provide more context about what the tool returns and how it behaves. 'Get stories from Hacker News' doesn't indicate whether this fetches current stories, historical data, or what fields are included in the response. For a tool with rich parameter options but no output documentation, the description is insufficiently complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with both parameters ('limit' and 'type') fully documented in the schema itself. The description adds no additional parameter information beyond what's already in the structured schema. According to the scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('stories from Hacker News'), making the purpose immediately understandable. It lacks sibling differentiation, but since there are no sibling tools on this server, that's not a deficiency. The description is specific enough to distinguish this from other potential tools like 'get_comments' or 'search_stories'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, timing considerations, or contextual factors that would help an agent decide when this is the appropriate tool. With no sibling tools, the absence of differentiation isn't problematic, but the complete lack of usage context is a significant gap.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.0.0
    • First observedget_stories

TDQS

B3/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool 'get_stories' has a clearly distinct and singular purpose.

Naming Consistency5/5

The naming is trivially consistent as there is only one tool. The tool name 'get_stories' follows a clear verb_noun pattern, which would be consistent if more tools were added.

Tool Count2/5

A single tool is too few for a server named 'Hacker News MCP', which implies broader functionality. While 'get_stories' is a core operation, the server lacks tools for other common actions like getting comments, user profiles, or posting, making it feel thin and incomplete.

Completeness1/5

The tool surface is severely incomplete for a Hacker News API. It only provides 'get_stories', missing essential operations such as retrieving comments, user details, search functionality, or any write operations, which are typical for such a domain.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    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
    B
    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
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables searching and retrieving top stories and individual items from Hacker News, with access to scores, comments, authors, and timestamps.
    23 npm
    MIT