
hkn mcp server
Hacker news MCP server
Repository Info
About This Server
Hacker news MCP server
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Hacker News MCP Server
A Spring Boot-based MCP (Model-Controller-Provider) server that provides a RESTful API interface to the Hacker News API. This server is designed to work seamlessly with MCP clients like Windsurf.
Features
- RESTful API endpoints for Hacker News content
- Caching support using Caffeine
- Non-blocking WebClient implementation
- Comprehensive test coverage
- Easy integration with MCP clients
Prerequisites
- Java 17 or higher
- Gradle 8.5 or higher (included via Gradle Wrapper)
Building the Project
-
Clone the repository:
git clone <repository-url> cd hkn-mcp-server -
Build the project:
./gradlew build -
Run the tests:
./gradlew test -
Run the application:
./gradlew bootRun
The server will start on port 8080 by default.
API Endpoints
Get Item by ID
GET /api/v1/news/item/{id}
Retrieves a specific Hacker News item by its ID.
Get Top Stories
GET /api/v1/news/top?limit={limit}
Retrieves the top stories. Default limit is 30.
Get New Stories
GET /api/v1/news/new?limit={limit}
Retrieves the newest stories. Default limit is 30.
Get Best Stories
GET /api/v1/news/best?limit={limit}
Retrieves the best stories. Default limit is 30.
Using with MCP Clients
Windsurf Integration
-
Configure your Windsurf client to point to this MCP server:
{ "mcp": { "server": "http://localhost:8080" } } -
The MCP server exposes the following resource types:
hn_item: Individual Hacker News items (stories, comments, etc.)hn_top: Top stories feedhn_new: New stories feedhn_best: Best stories feed
-
Example Windsurf queries:
// Get a specific item GET mcp://hn_item/12345 // Get top stories GET mcp://hn_top?limit=10 // Get new stories GET mcp://hn_new?limit=20 // Get best stories GET mcp://hn_best?limit=15
Caching
The server implements caching using Caffeine with the following configuration:
- Maximum cache size: 1000 entries
- Cache expiry: 5 minutes after write
- Separate caches for items and story lists
Development
Project Structure
src/
├── main/
│ ├── java/
│ │ └── com/mount/rainier/hkn/mcp/
│ │ ├── config/
│ │ ├── controller/
│ │ ├── model/
│ │ └── service/
│ └── resources/
└── test/
└── java/
└── com/mount/rainier/hkn/mcp/
├── config/
├── controller/
├── model/
└── service/
Running Tests
# Run all tests
./gradlew test
# Run specific test class
./gradlew test --tests "com.mount.rainier.hkn.mcp.service.HackerNewsServiceTest"
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Quick Start
Clone the repository
git clone https://github.com/vishgupt/hkn-mcp-serverInstall dependencies
cd hkn-mcp-server
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.