Browse Hacker News feeds, threads, and user profiles with full-text search.
Browse Hacker News feeds, threads, and user profiles with full-text search via MCP. STDIO or Streamable HTTP.
Public Hosted Server: https://hn.caseyjhand.com/mcp
Feeds, threads, and profiles from the Hacker News Firebase API and Algolia Search API. Browse ranked feeds, read full comment threads, look up user profiles, and search stories and comments by type, author, date, or score. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
| Tool | Description |
|---|---|
hn_get_stories | Fetch stories from an HN feed (top, new, best, ask, show, jobs), with title, URL, score, author, and comment count |
hn_get_thread | Get an item and its comment tree as a threaded discussion, with depth and comment-count controls |
hn_get_user | Fetch a user profile with karma, about, and optionally a page of resolved submissions |
hn_search_content | Search stories and comments via Algolia, filterable by type, author, date range, and minimum points |
hn_get_stories tooltop, new, best, ask, show, jobs; count (1–100, default 30) and offset for paginationtotal, offset, hasMore, and a notice explaining empty pages (empty feed, offset past end, or every item on the page deleted/flagged)hn_get_thread toolitemId plus depth (0–10, default 3; 0 returns the item with no comments) and maxComments (1–200, default 50) capping the total across all levelsdepth/parentId for tree reconstruction, plus childCount and an isOp flag when the comment author matches the root item's authornotice reports deleted/dead comments omitted during traversal and, when totalLoaded is below totalAvailable, the hint to raise maxComments/depthhn_get_user toolusername is case-sensitive and trimmed; includeSubmissions (default false) resolves recent submissions, with submissionCount (1–50, default 10) and submissionOffset paging through a long historysubmissionOffset and the offset to send next, or a notice when the requested offset is past the end of the historyhn_search_content toolquery plus tags (story/comment/ask_hn/show_hn/front_page), author, dateRange (ISO 8601), and minPoints filters; sort by relevance or date; count (1–50, default 30) and page for paginationview: "compact" drops the two body-text fields (text, highlights.text), which otherwise repeat a long comment twice per hit — pass a hit id to hn_get_thread to read the bodyhighlights.title, highlights.text, matchedWords) shows which terms matched and wheretotalHits, page, and the actual reachable totalPages — not derived from totalHits, since broad queries report far more hits than Algolia will serveBuilt on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
HN-specific:
HN_CONCURRENCY_LIMIT)instructions forwarded to LLM clients on initialize — item types, ID reuse across tools, case-sensitive usernames, field sparsityAgent-friendly output:
hn_get_thread counts deleted and dead comments dropped during traversal and surfaces the count in notice rather than silently shrinking the result; hn_get_stories and hn_get_user filter dead/deleted items the same wayitem_not_found, upstream_rate_limited, upstream_html, …) with per-reason recovery text, and a depth/parentId pair on every comment so callers reconstruct the tree without guessing nestingoffset, submissionOffset, page) plus the exact next-offset value in notice, so an agent can resume a listing without recomputing statehn_search_content's view: "compact" drops the two body-text fields that otherwise duplicate a hit's full textA public instance is available at https://hn.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"hn-mcp-server": {
"type": "streamable-http",
"url": "https://hn.caseyjhand.com/mcp"
}
}
}
Add to your MCP client configuration file:
{
"mcpServers": {
"hn-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/hn-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"hn-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/hn-mcp-server"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}
Or with Docker:
{
"mcpServers": {
"hn-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/hn-mcp-server:latest"
]
}
}
}
git clone https://github.com/cyanheads/hn-mcp-server.git
cd hn-mcp-server
bun install
All configuration is via environment variables. No API keys required — HN APIs are public.
| Variable | Description | Default |
|---|---|---|
HN_CONCURRENCY_LIMIT | Max concurrent HTTP requests for batch item fetches (integer, 1–50). | 10 |
MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
MCP_HTTP_PORT | HTTP server port. | 3010 |
MCP_HTTP_HOST | HTTP server host. | localhost |
MCP_SESSION_MODE | HTTP session handling: stateful, stateless, or auto (resolves to stateful). The server declares stateless in source, and the published Docker image and .env.example set it too; a meaningful env value still overrides. | stateless |
MCP_LOG_LEVEL | Log level: debug, info, notice, warning, error. | info |
LOGS_DIR | Directory for log files (Node.js only). | <project-root>/logs |
See .env.example for the full list of optional overrides.
Dev mode (auto-reload):
MCP_TRANSPORT_TYPE=stdio bun --watch src/index.ts # stdio
MCP_TRANSPORT_TYPE=http bun --watch src/index.ts # HTTP
Build and run:
bun run rebuild
bun run start:stdio # or start:http
Run checks and tests:
bun run devcheck # Lint, format, typecheck, security
bun run test # Vitest test suite
docker build -t hn-mcp-server .
docker run --rm -p 3010:3010 hn-mcp-server
The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/hn-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
| Directory | Purpose |
|---|---|
src/index.ts | createApp() entry point — registers tools and inits the HN service. |
src/config/ | Server-specific environment variable parsing and validation with Zod. |
src/mcp-server/tools/definitions/ | Tool definitions (*.tool.ts). |
src/services/hn/ | HN Firebase + Algolia API client and domain types. |
tests/ | Unit and integration tests mirroring src/. |
See CLAUDE.md for development guidelines and architectural rules. The short version:
try/catch in tool logicctx.log for request-scoped loggingIssues are welcome. Run checks before submitting:
bun run devcheck
bun run test
Apache-2.0 — see LICENSE for details.
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
npx -y @cyanheads/hn-mcp-serverMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-cyanheads-hn-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/hn-mcp-server"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referenceio.github.cyanheads/hn-mcp-server works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.