# HackerNews MCP Server - Usage Examples
This directory contains example usage scenarios for the HackerNews MCP Server.
## Example 1: Search for Python Posts
Search for Python-related stories with at least 50 points:
```json
{
"tool": "search_posts",
"arguments": {
"query": "Python",
"tags": ["story"],
"minPoints": 50,
"sortByDate": true,
"hitsPerPage": 10
}
}
```
## Example 2: Get Front Page
Retrieve the current HackerNews front page:
```json
{
"tool": "get_front_page",
"arguments": {
"page": 0,
"hitsPerPage": 30
}
}
```
## Example 3: Get Post Details with Comments
Retrieve a specific post with its full comment tree:
```json
{
"tool": "get_post",
"arguments": {
"postId": "123456"
}
}
```
## Example 4: Get User Profile
Retrieve user profile information:
```json
{
"tool": "get_user",
"arguments": {
"username": "pg"
}
}
```
## Example 5: Advanced Search - Show HN Posts by Date
Search for "Show HN" posts from a specific time period:
```json
{
"tool": "search_posts",
"arguments": {
"tags": ["show_hn"],
"dateAfter": "2024-01-01T00:00:00Z",
"dateBefore": "2024-12-31T23:59:59Z",
"minPoints": 10,
"sortByDate": true,
"hitsPerPage": 20
}
}
```
## Example 6: Search Comments by Author
Find all comments by a specific author:
```json
{
"tool": "search_posts",
"arguments": {
"author": "dang",
"tags": ["comment"],
"hitsPerPage": 50
}
}
```
## Example 7: Ask HN Posts with High Engagement
Search for "Ask HN" posts with many comments:
```json
{
"tool": "search_posts",
"arguments": {
"tags": ["ask_hn"],
"minComments": 100,
"sortByDate": true
}
}
```
## Example 8: Combined Filters
Search with multiple filters combined:
```json
{
"tool": "search_posts",
"arguments": {
"query": "artificial intelligence",
"tags": ["story"],
"minPoints": 100,
"minComments": 50,
"dateAfter": "2024-10-01T00:00:00Z",
"sortByDate": false,
"hitsPerPage": 20
}
}
```
## Testing with MCP Inspector
You can test these examples using the MCP Inspector:
```bash
npx @modelcontextprotocol/inspector node dist/index.js
```
This will open a web interface where you can manually invoke tools and see responses.
## Natural Language Examples (Claude/Copilot)
When using with Claude Desktop or GitHub Copilot, you can use natural language:
- "Search HackerNews for recent TypeScript articles"
- "Show me the front page of HackerNews"
- "Get details for post 38881131"
- "Look up user profile for pg"
- "Find Show HN posts from this month with at least 50 points"
- "Search for comments by dang about moderation"