{
  "markdown": "<div align=\"center\">\n  <h1>@cyanheads/hn-mcp-server</h1>\n  <p><b>Browse Hacker News feeds, threads, and user profiles with full-text search via MCP. STDIO or Streamable HTTP.</b>\n  <div>4 Tools</div>\n  </p>\n</div>\n\n<div align=\"center\">\n\n[![Version](https://img.shields.io/badge/Version-0.5.15-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/hn-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/hn-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/hn-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun->=1.3.0-f9f1e1.svg?style=flat-square)](https://bun.sh/)\n\n</div>\n\n<div align=\"center\">\n\n[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/hn-mcp-server/releases/latest/download/hn-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=hn-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvaG4tbWNwLXNlcnZlciJdfQ==) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22hn-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads/hn-mcp-server%22%5D%7D)\n\n[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)\n\n</div>\n\n<div align=\"center\">\n\n**Public Hosted Server:** [https://hn.caseyjhand.com/mcp](https://hn.caseyjhand.com/mcp)\n\n</div>\n\n---\n\n## Tools\n\nFour read-only tools for accessing Hacker News data:\n\n| Tool Name | Description |\n|:----------|:------------|\n| `hn_get_stories` | Fetch stories from an HN feed (top, new, best, ask, show, jobs) with pagination. |\n| `hn_get_thread` | Get an item and its comment tree as a threaded discussion with depth/count controls. |\n| `hn_get_user` | Fetch a user profile with karma, about, and optionally a page of their submissions. |\n| `hn_search_content` | Search stories and comments via Algolia with type, author, date, and score filters. |\n\n### `hn_get_stories`\n\nFetch stories from any HN feed with pagination support.\n\n- Six feed types: `top`, `new`, `best`, `ask`, `show`, `jobs`\n- Configurable count (1–100, default 30) and offset for pagination\n- Returns enriched story objects with title, URL, score, author, comment count, and body text\n\n---\n\n### `hn_get_thread`\n\nRetrieve an item and its full comment tree via ranked breadth-first traversal.\n\n- Depth control (0–10, default 3) — depth 0 doubles as a single-item lookup\n- Comment limit (1–200, default 50) caps total comments across all levels\n- Breadth-first traversal preserves HN's ranking order\n- Flat comment list with `depth`/`parentId` for tree reconstruction\n\n---\n\n### `hn_get_user`\n\nFetch a user profile with optional submission resolution.\n\n- Profile includes karma, creation date, and about text (HTML stripped)\n- Optionally resolves submissions into full items, up to 50 per page\n- `submissionOffset` pages through a long history; enrichment echoes the applied offset and the offset to request next\n- Submission resolution filters out dead/deleted items\n\n---\n\n### `hn_search_content`\n\nFull-text search via the Algolia HN Search API.\n\n- Filter by content type: `story`, `comment`, `ask_hn`, `show_hn`, `front_page`\n- Filter by author, date range (ISO 8601), and minimum points\n- Sort by relevance or date\n- Pagination with page/count controls\n- `view: \"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 body\n\n## Features\n\nBuilt on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core):\n\n- Declarative tool definitions — single file per tool, framework handles registration and validation\n- Unified error handling across all tools\n- Structured logging with request correlation\n- Runs locally (stdio/HTTP) from the same codebase\n\nHN-specific:\n\n- Server-level `instructions` orientation forwarded to LLM clients on `initialize` — item types, ID reuse across tools, case-sensitive usernames, and field sparsity expectations\n- Concurrent batch fetching with configurable parallelism for item resolution\n- HTML entity decoding and tag stripping with code block and link preservation\n- No API keys required — HN APIs are public\n\n## Getting Started\n\n### Public Hosted Instance\n\nA public instance is available at `https://hn.caseyjhand.com/mcp` — no installation required. Point any MCP client at it via Streamable HTTP:\n\n```json\n{\n  \"mcpServers\": {\n    \"hn-mcp-server\": {\n      \"type\": \"streamable-http\",\n      \"url\": \"https://hn.caseyjhand.com/mcp\"\n    }\n  }\n}\n```\n\n### Self-Hosted / Local\n\nAdd to your MCP client configuration file:\n\n```json\n{\n  \"mcpServers\": {\n    \"hn-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/hn-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\"\n      }\n    }\n  }\n}\n```\n\nOr with npx (no Bun required):\n\n```json\n{\n  \"mcpServers\": {\n    \"hn-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cyanheads/hn-mcp-server\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\"\n      }\n    }\n  }\n}\n```\n\nOr with Docker:\n\n```json\n{\n  \"mcpServers\": {\n    \"hn-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"-e\", \"MCP_TRANSPORT_TYPE=stdio\",\n        \"ghcr.io/cyanheads/hn-mcp-server:latest\"\n      ]\n    }\n  }\n}\n```\n\n### Prerequisites\n\n- [Bun v1.3.0](https://bun.sh/) or higher (or Node.js >= 24)\n\n### Installation\n\n```sh\ngit clone https://github.com/cyanheads/hn-mcp-server.git\ncd hn-mcp-server\nbun install\n```\n\n## Configuration\n\nAll configuration is via environment variables. No API keys required — HN APIs are public.\n\n| Variable | Description | Default |\n|:---------|:------------|:--------|\n| `HN_CONCURRENCY_LIMIT` | Max concurrent HTTP requests for batch item fetches (integer, 1–50). | `10` |\n| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |\n| `MCP_HTTP_PORT` | HTTP server port. | `3010` |\n| `MCP_HTTP_HOST` | HTTP server host. | `localhost` |\n| `MCP_SESSION_MODE` | HTTP session handling: `auto`, `stateful`, or `stateless`. `auto` resolves to `stateful`. The published Docker image and `.env.example` pin `stateless`. | `auto` |\n| `MCP_LOG_LEVEL` | Log level: `debug`, `info`, `notice`, `warning`, `error`. | `info` |\n| `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |\n\n## Running the Server\n\n### Local Development\n\n```sh\nMCP_TRANSPORT_TYPE=stdio bun --watch src/index.ts   # Dev mode (stdio, auto-reload)\nMCP_TRANSPORT_TYPE=http bun --watch src/index.ts    # Dev mode (HTTP, auto-reload)\nbun run test                                         # Run test suite\nbun run devcheck                                     # Lint + format + typecheck + audit\n```\n\n### Production\n\n```sh\nbun run build\nbun run start:stdio     # or start:http\n```\n\n### Docker\n\n```sh\ndocker build -t hn-mcp-server .\ndocker run -p 3010:3010 hn-mcp-server\n```\n\n## Project Structure\n\n| Directory | Purpose |\n|:----------|:--------|\n| `src/index.ts` | `createApp()` entry point. |\n| `src/config/` | Server-specific env var parsing with Zod. |\n| `src/services/hn/` | HN Firebase + Algolia API client and domain types. |\n| `src/mcp-server/tools/definitions/` | Tool definitions (`*.tool.ts`). |\n\n## Development Guide\n\nSee [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:\n\n- Handlers throw, framework catches — no `try/catch` in tool logic\n- Use `ctx.log` for request-scoped logging\n- All tools are read-only — no auth scopes required\n\n## Contributing\n\nIssues and pull requests are welcome. Run checks before submitting:\n\n```sh\nbun run devcheck\nbun run test\n```\n\n## License\n\nApache-2.0 — see [LICENSE](LICENSE) for details.\n",
  "bytes": 8678,
  "sha": "67e7c8eb2b4a4e4ca8cf778d20ebed25dc897eccc9c734129a4a198c5ee26334",
  "repo_slug": "cyanheads/hn-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cyanheads_hn_mcp_server_a69adc86/readme"
}