Skip to main content

MCP server for searching Hacker News stories via Algolia

Project description

Hacker News MCP

MCP server for searching Hacker News stories through the Algolia Hacker News Search API.

The server is read-only and is designed to run through uvx.

The PyPI distribution name is mcp-hacker-news (the name hacker-news-mcp is rejected as too similar to existing projects).

Install and Run

Install from PyPI with pip:

pip install mcp-hacker-news
hacker-news-mcp

(mcp-hacker-news is also installed as a command.)

Or run with uv:

uvx mcp-hacker-news

During local development:

uv run hacker-news-mcp

MCP Configuration

{
  "mcpServers": {
    "hacker-news": {
      "command": "uvx",
      "args": ["mcp-hacker-news"]
    }
  }
}

Running from a Local Source Copy

If you want to run a local copy of this repository instead of resolving the package through uvx, clone the source code and install dependencies:

git clone https://github.com/m-higuchi/hacker-news-mcp
cd hacker-news-mcp
uv sync

Then use the following MCP configuration:

{
  "mcpServers": {
    "hacker-news": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/hacker-news-mcp",
        "run",
        "hacker-news-mcp"
      ]
    }
  }
}

Replace /path/to/hacker-news-mcp with the absolute path to the directory where you cloned this repository (the folder that contains pyproject.toml).

Backend API

This server uses Algolia's Hacker News Search API as the primary backend:

https://hn.algolia.com/api/v1

Story searches always include tags=story. Date range searches call /search_by_date and convert ISO dates into Algolia created_at_i numeric filters.

Tools

search_stories_by_date

Search stories within a date range.

Input:

{
  "query": "AI",
  "start_date": "2026-04-01",
  "end_date": "2026-04-27",
  "limit": 20,
  "page": 0
}

Behavior:

  • start_date and end_date accept YYYY-MM-DD or ISO datetime strings.
  • Date-only start_date is interpreted as 00:00:00Z.
  • Date-only end_date is interpreted as 23:59:59Z.
  • limit defaults to 20 and is capped at 100.
  • page is zero-based.

search_stories

Search stories by relevance or date.

Input:

{
  "query": "AI",
  "sort": "relevance",
  "limit": 20,
  "page": 0
}

sort can be relevance or date.

get_story

Fetch a story by Hacker News item ID.

Input:

{
  "story_id": 123456
}

get_user

Fetch a Hacker News user profile by username.

Input:

{
  "username": "pg"
}

Example Prompts

Once the MCP server is connected, you can ask the AI questions like the following.

Searching by keyword:

  • "Search Hacker News for recent stories about Rust."
  • "Find the most relevant Hacker News stories about LLM fine-tuning."
  • "Show me the latest 5 Hacker News stories mentioning WebAssembly."

Searching by date range:

  • "What were the top Hacker News stories about OpenAI in April 2026?"
  • "Find Hacker News stories about Kubernetes from March 1 to March 31, 2026."

Fetching a specific story:

  • "Get the Hacker News story with ID 12345678."

Looking up a user:

  • "Show me the Hacker News profile of pg."
  • "What is the account info for the user tptacek on Hacker News?"

Development

Dev Container

Open this repository in a Dev Container to get Python 3.12 and uv preinstalled.

The container runs this setup command after creation:

uv sync --extra dev

Tests can be run with:

uv run pytest

Local

uv sync --extra dev
uv run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hacker_news_mcp_py-0.2.0.tar.gz (48.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hacker_news_mcp_py-0.2.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file hacker_news_mcp_py-0.2.0.tar.gz.

File metadata

  • Download URL: hacker_news_mcp_py-0.2.0.tar.gz
  • Upload date:
  • Size: 48.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hacker_news_mcp_py-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8f5821c0121d50a0acd57c01b399a540ca2f4c256664ac7cc268d93cee10b78c
MD5 4ac7d5604e3bf90f9a7c7b1dbb49608f
BLAKE2b-256 65216ae8d4846f011c719dda579e31f3a4200b6a161c2685355d117b0e7c4ec1

See more details on using hashes here.

Provenance

The following attestation bundles were made for hacker_news_mcp_py-0.2.0.tar.gz:

Publisher: publish-pypi.yml on m-higuchi/hacker-news-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hacker_news_mcp_py-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hacker_news_mcp_py-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e94485539c9f8e10fc14d11d74dd80fed748fc9b413d99c248f777d85edcbf64
MD5 48cf29cf00c7ba3fd1798fa543cba45d
BLAKE2b-256 b9166c51d19079f0d17bb70497460c3651f92c78100d894d161cf0f85ea33351

See more details on using hashes here.

Provenance

The following attestation bundles were made for hacker_news_mcp_py-0.2.0-py3-none-any.whl:

Publisher: publish-pypi.yml on m-higuchi/hacker-news-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page