A Model Context Protocol (MCP) server that provides tools for fetching stories from Hacker News. This server parses the HTML content from news.ycombinator.com and provides structured data for different types of stories (top, new, ask, show, jobs). - Fetch different types of stories (top, new, ask, show, jobs) - Get structured data including titles, URLs, points, authors, timestamps, and comment co
Add this skill
npx mdskills install pskill9/hn-serverWell-documented MCP server with clear tool descriptions and setup, but over-scoped permissions
1# Hacker News MCP Server23A Model Context Protocol (MCP) server that provides tools for fetching stories from Hacker News. This server parses the HTML content from news.ycombinator.com and provides structured data for different types of stories (top, new, ask, show, jobs).45<a href="https://glama.ai/mcp/servers/oge85xl22f"><img width="380" height="200" src="https://glama.ai/mcp/servers/oge85xl22f/badge" alt="Hacker News MCP server" /></a>67## Features89- Fetch different types of stories (top, new, ask, show, jobs)10- Get structured data including titles, URLs, points, authors, timestamps, and comment counts11- Configurable limit on number of stories returned12- Clean error handling and validation1314## Installation15161. Clone the repository:17```bash18git clone https://github.com/pskill9/hn-server19cd hn-server20```21222. Install dependencies:23```bash24npm install25```26273. Build the server:28```bash29npm run build30```31324. Add to your MCP settings configuration file (location depends on your system):3334For VSCode Claude extension:35```json36{37 "mcpServers": {38 "hacker-news": {39 "command": "node",40 "args": ["/path/to/hn-server/build/index.js"]41 }42 }43}44```4546## Usage4748The server provides a tool called `get_stories` that can be used to fetch stories from Hacker News.4950### Tool: get_stories5152Parameters:53- `type` (string): Type of stories to fetch54 - Options: 'top', 'new', 'ask', 'show', 'jobs'55 - Default: 'top'56- `limit` (number): Number of stories to return57 - Range: 1-3058 - Default: 105960Example usage:61```typescript62use_mcp_tool with:63server_name: "hacker-news"64tool_name: "get_stories"65arguments: {66 "type": "top",67 "limit": 568}69```7071Sample output:72```json73[74 {75 "title": "Example Story Title",76 "url": "https://example.com/story",77 "points": 100,78 "author": "username",79 "time": "2024-12-28T00:03:05",80 "commentCount": 50,81 "rank": 182 },83 // ... more stories84]85```8687## Integrating with Claude8889To use this MCP server with Claude, you'll need to:90911. Have the Claude desktop app or VSCode Claude extension installed922. Configure the MCP server in your settings933. Use Claude's natural language interface to interact with Hacker News9495### Configuration9697For the Claude desktop app, add the server configuration to:98```json99// ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)100// %APPDATA%\Claude\claude_desktop_config.json (Windows)101{102 "mcpServers": {103 "hacker-news": {104 "command": "node",105 "args": ["/path/to/hn-server/build/index.js"]106 }107 }108}109```110111For the VSCode Claude extension, add to:112```json113// VSCode Settings JSON114{115 "mcpServers": {116 "hacker-news": {117 "command": "node",118 "args": ["/path/to/hn-server/build/index.js"]119 }120 }121}122```123124### Example Interactions125126Once configured, you can interact with Claude using natural language to fetch Hacker News stories. Examples:127128- "Show me the top 5 stories from Hacker News"129- "What are the latest Ask HN posts?"130- "Get me the top Show HN submissions from today"131132Claude will automatically use the appropriate parameters to fetch the stories you want.133134135136### Story Object Structure137138Each story object contains:139- `title` (string): The story title140- `url` (string, optional): URL of the story (may be internal HN URL for text posts)141- `points` (number): Number of upvotes142- `author` (string): Username of the poster143- `time` (string): Timestamp of when the story was posted144- `commentCount` (number): Number of comments145- `rank` (number): Position in the list146147## Development148149The server is built using:150- TypeScript151- Model Context Protocol SDK152- Axios for HTTP requests153- Cheerio for HTML parsing154155To modify the server:1561571. Make changes to `src/index.ts`1582. Rebuild:159```bash160npm run build161```162163## Error Handling164165The server includes robust error handling for:166- Invalid story types167- Network failures168- HTML parsing errors169- Invalid parameter values170171Errors are returned with appropriate error codes and descriptive messages.172173## Contributing174175Contributions are welcome! Please feel free to submit a Pull Request.176177## License178179MIT License - feel free to use this in your own projects.180
Full transparency — inspect the skill content before installing.