trackmcp
Back to directory
GeorgeNance

hackernews-mcp

View on GitHub

Hacker News

3 stars JavaScriptOthers Updated Jun 12, 2026

Documentation

๐Ÿ“ฐ Hacker News MCP Server

CI
License: MIT

A Model Context Protocol (MCP) server that provides tools to fetch and interact with Hacker News content. This server enables AI assistants to access real-time Hacker News data including top stories, story details, comments, and search functionality.

๐Ÿš€ Features

๐Ÿ› ๏ธ Available Tools

  • `get_top_stories` - Fetch the latest top stories from Hacker News
    • `get_story_details` - Get detailed information about a specific story
      • `get_story_comments` - Retrieve popular comments for a story
        • `search_stories` - Search recent stories by keywords
          • Search through story titles, content, and URLs
          • Configurable time range (1-168 hours)
          • Limit results (1-50 stories)

        ๐Ÿ“‹ Prerequisites

        • Node.js 18+
        • npm or yarn
        • An MCP-compatible client (like Claude Desktop)

        ๐Ÿ”ง Installation

        1. Clone the repository

        bash
        git clone https://github.com/yourusername/hackernews-mcp.git
        cd hackernews-mcp

        2. Install dependencies

        bash
        npm install

        3. Build the server

        bash
        npm run build

        ๐ŸŽฏ Usage

        With Claude Desktop

        Add the server to your Claude Desktop configuration:

        macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`

        Windows: `%APPDATA%/Claude/claude_desktop_config.json`

        json
        {
          "mcpServers": {
            "hackernews-mcp": {
              "command": "node",
              "args": ["/path/to/hackernews-mcp/build/index.js"]
            }
          }
        }

        With Other MCP Clients

        The server communicates via stdio and can be used with any MCP-compatible client:

        bash
        node build/index.js

        ๐Ÿ” Example Usage

        Once connected, you can ask your AI assistant things like:

        • "What are the top stories on Hacker News today?"
        • "Get details about Hacker News story 12345678"
        • "Show me comments for that viral AI story"
        • "Search for recent stories about TypeScript"

        ๐Ÿ› ๏ธ Development

        Build the project

        bash
        npm run build

        Watch mode for development

        bash
        npm run watch

        Lint and format the code

        bash
        npm run lint
        npm run format

        Run the MCP Inspector

        For debugging and testing:

        bash
        npm run inspector

        This will start the MCP Inspector, providing a web interface to test the server's tools and inspect the communication.

        ๐Ÿ“ฆ Code Quality & Contributing

        • Code Quality:

        This project enforces code quality and style using ESLint and Prettier. All code is checked in CI (GitHub Actions) and must pass linting and formatting before merging.

        • Type Safety:

        All tool handlers use explicit type guards for runtime argument validation and robust TypeScript types.

        • CI/CD:

        Every push and pull request runs the full build, lint, and (future) test suite via GitHub Actions.

        • How to Contribute:

        1. Fork the repository

        2. Create a feature branch (`git checkout -b feature/amazing-feature`)

        3. Commit your changes (`git commit -m 'Add amazing feature'`)

        4. Run `npm run lint` and `npm run format` before pushing

        5. Push to the branch (`git push origin feature/amazing-feature`)

        6. Open a Pull Request

        ๐Ÿ“š API Reference

        get_top_stories

        typescript
        {
          count?: number;        // Number of stories (1-100, default: 30)
          include_text?: boolean; // Include story text content (default: false)
        }

        get_story_details

        typescript
        {
          story_id: number;           // Required: HN story ID
          include_comments?: boolean; // Include comments (default: false)
          include_markdown?: boolean; // Extract article as markdown (default: false)
        }

        get_story_comments

        typescript
        {
          story_id: number;    // Required: HN story ID
          min_score?: number;  // Minimum comment score (default: 1)
          max_depth?: number;  // Max thread depth (1-10, default: 3)
          limit?: number;      // Max comments (1-100, default: 20)
        }

        search_stories

        typescript
        {
          query: string;              // Required: Search keywords
          limit?: number;             // Max results (1-50, default: 20)
          time_range_hours?: number;  // Hours to search back (1-168, default: 24)
        }

        ๐Ÿ—๏ธ Architecture

        The server is built with:

        • TypeScript for type safety and developer experience
        • @modelcontextprotocol/sdk for MCP protocol implementation
        • axios for HTTP requests to Hacker News API
        • jsdom and turndown for HTML to Markdown conversion
        • private-ip for security (blocks private IP access)

        Key Components

        • `src/index.ts` - Main server implementation with tool handlers
        • `src/fetcher.ts` - Utility class for fetching and converting web content
        • `build/` - Compiled JavaScript output (auto-generated)

        ๐Ÿ”’ Security

        • Blocks requests to private IP addresses to prevent local network access
        • Rate limiting through Hacker News API natural limits
        • Input validation for all tool parameters
        • Error handling and graceful degradation

        ๐Ÿ“œ License

        This project is licensed under the MIT License - see the LICENSE file for details.

        ๐Ÿ™ Acknowledgments

        ๐Ÿ“ž Support

        If you encounter any issues or have questions:

        1. Check the Issues page

        2. Use the MCP Inspector for debugging: `npm run inspector`

        3. Create a new issue with detailed information about your problem


        Made with โค๏ธ for the MCP community

        Frequently asked questions

        What is hackernews-mcp?

        hackernews-mcp is Hacker News

        How do I install hackernews-mcp?

        Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

        Is hackernews-mcp open source?

        Yes โ€” it is hosted on GitHub at https://github.com/GeorgeNance/hackernews-mcp and has 3 stars.

        Related MCP tools

        Run your own MCP server? See who uses it and what to fix.

        Measure it with TrackMCP