Provides access to the Hacker News API, enabling retrieval of stories, comments, user profiles, job postings, and other Hacker News content through comprehensive tools for browsing top stories, new posts, Ask HN, Show HN, and user information.
Hacker News MCP Server
A Model Context Protocol (MCP) server that provides access to the Hacker News API. This server allows AI assistants like Claude to fetch stories, comments, user profiles, and other content from Hacker News.
Created with Claude Code using Claude skill mcp-builder.
Features
9 Comprehensive Tools for accessing Hacker News data:
hn_get_item
- Get any item (story, comment, job, poll) by IDhn_get_top_stories
- Get current front page storieshn_get_new_stories
- Get newest storieshn_get_best_stories
- Get best stories of all timehn_get_ask_stories
- Get Ask HN postshn_get_show_stories
- Get Show HN postshn_get_job_stories
- Get job postingshn_get_user
- Get user profile informationhn_get_max_item_id
- Get the latest item ID
Flexible Output Formats: Both Markdown (human-readable) and JSON (machine-readable)
Pagination Support: Efficiently browse large result sets
Detail Levels: Choose between concise summaries or detailed information
Rate Limit Handling: Graceful error handling with helpful messages
Character Limits: Automatic truncation for large responses
Parallel Fetching: Efficient batch requests for multiple items
Requirements
Python 3.8+ (tested on Python 3.10+)
Windows 10/11 (compatible with PowerShell and Git Bash)
Installation
Step 1: Install Python
If you don't have Python installed:
Download Python from python.org
Important: During installation, check "Add Python to PATH"
Verify installation:
python --version
Step 2: Create a Virtual Environment (Recommended)
Using a virtual environment keeps dependencies isolated:
PowerShell:
Git Bash:
You should see (venv)
in your terminal prompt after activation.
Step 3: Install Dependencies
Verify installation:
Step 4: Test the Server
Verify the server can run:
You should see FastMCP help output. The server will appear to hang - this is normal! Press Ctrl+C
to stop it.
Configuration
For Claude Desktop (Windows)
Locate your Claude Desktop config file:
%APPDATA%\Claude\claude_desktop_config.jsonOpen it in a text editor and add the Hacker News MCP server:
PowerShell users:
Git Bash users:
Important Notes:
Use double backslashes (
\\
) in the JSON file pathsUse the full absolute paths to both
python.exe
andhackernews_mcp.py
If you have other MCP servers, add this as another entry in
mcpServers
Restart Claude Desktop
Verify the connection:
Open Claude Desktop
Look for a "hammer" or "tools" icon indicating MCP servers are connected
Ask Claude: "What Hacker News tools do you have available?"
For Other MCP Clients
The server uses stdio transport by default. Configure your MCP client to run:
Usage Examples
Once configured, you can ask Claude to use the Hacker News tools:
Get Top Stories
Get Story Details
Search for User
Get Ask HN Posts
Browse Job Postings
Tool Reference
hn_get_item
Get complete details for any HN item (story, comment, job, poll).
Parameters:
item_id
(required): The item ID numberresponse_format
: "markdown" (default) or "json"detail_level
: "detailed" (default) or "concise"
Example:
hn_get_top_stories
Get current front page stories.
Parameters:
limit
: Max stories to return (1-100, default: 30)offset
: Skip this many stories (default: 0)response_format
: "markdown" (default) or "json"detail_level
: "concise" (default) or "detailed"
hn_get_new_stories
Get newest stories in chronological order.
Parameters: Same as hn_get_top_stories
hn_get_best_stories
Get best stories by HN's algorithm.
Parameters: Same as hn_get_top_stories
hn_get_ask_stories
Get latest Ask HN posts.
Parameters: Same as hn_get_top_stories
hn_get_show_stories
Get latest Show HN posts.
Parameters: Same as hn_get_top_stories
hn_get_job_stories
Get latest job postings.
Parameters: Same as hn_get_top_stories
hn_get_user
Get user profile information.
Parameters:
username
(required): Case-sensitive usernameresponse_format
: "markdown" (default) or "json"include_submissions
: Include full submission list (default: false)
Example:
hn_get_max_item_id
Get the current maximum item ID.
Parameters: None
Troubleshooting
"python: command not found"
Solution: Python is not in your PATH.
PowerShell:
Git Bash:
"No module named 'mcp'"
Solution: Install dependencies in the virtual environment:
"Permission denied" when activating virtual environment (PowerShell)
Solution: Enable script execution:
Server appears to hang when running
This is normal behavior! MCP servers are long-running processes that wait for requests over stdio. They don't exit immediately. To test if it's working:
Run
python hackernews_mcp.py --help
- should show helpConfigure it in Claude Desktop and use it through Claude
Use
Ctrl+C
to stop the server if running it manually
Claude Desktop doesn't show HN tools
Checklist:
Verify JSON syntax in
claude_desktop_config.json
(use a JSON validator)Use double backslashes in Windows paths:
C:\\Users\\...
Use full absolute paths, not relative paths
Restart Claude Desktop after config changes
Check Claude Desktop logs (usually in
%APPDATA%\Claude\logs
)
"Rate limit exceeded" errors
The Hacker News API has no official rate limit, but if you're making too many requests:
Use
limit
parameter to fetch fewer itemsUse
detail_level: "concise"
to reduce API callsAdd delays between requests if needed
API Documentation
This server uses the official Hacker News Firebase API:
Base URL:
https://hacker-news.firebaseio.com/v0/
Documentation: See
docs/README.md
in this repositorySource: Hacker News API on GitHub
Architecture
Framework: FastMCP (official MCP Python SDK)
HTTP Client: httpx (async)
Validation: Pydantic v2
Transport: stdio (standard input/output)
Key Features:
Async/await for all I/O operations
Parallel batch fetching for efficiency
Comprehensive error handling
Character limit enforcement (25,000 chars)
Pagination support
Input validation with detailed constraints
Development
Running Tests
Code Structure
License
This MCP server is provided as-is for use with the Hacker News API. The Hacker News API is provided by Y Combinator.
Credits
Hacker News API: Y Combinator
MCP Protocol: Anthropic
Server Implementation: Created with Claude Code with skill mcp-builder
Support
For issues or questions:
Check the Troubleshooting section above
Review the API documentation in
docs/README.md
Verify your Python and dependency versions
Check Claude Desktop logs for detailed error messages
Version
Version: 1.0.0 Last Updated: 2025-10-18
This server cannot be installed
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.
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).