Skip to main content
This example shows how to create an MCP server for Hacker News, a popular tech news aggregator. This is a great first example because it doesn’t require authentication.

What You’ll Build

An MCP server that enables AI assistants to:
  • View articles from the homepage
  • Read comments on posts
  • Navigate different sections (new, best, ask, show)
  • Search for posts
  • Submit new posts
  • View user profiles

Generate the Server

Create the MCP server with a single command:
1

URL Analysis

MCPKit analyzes the Hacker News homepage and discovers available actions.
2

Action Discovery

The AI discovers 6 main actions:
3

Server Generation

A complete MCP server is generated:
Your Hacker News MCP server is ready!

Available Tools

The generated server includes these tools:

1. view_article

View a specific article from the homepage. Parameters:
string
required
The title of the article to view
Example usage:

2. view_comments

View the comments for a specific article. Parameters:
string
required
The title of the article whose comments to view
Example usage:

3. navigate_section

Navigate to different sections of Hacker News. Parameters:
string
required
The section to navigate to (e.g., “new”, “best”, “ask”, “show”, “jobs”)
Example usage:

4. search_posts

Search Hacker News for posts matching a query. Parameters:
string
required
The search query
Example usage:

5. submit_post

Submit a new post to Hacker News (requires authentication). Parameters:
string
required
The title of the post
string
The URL of the post (optional)
string
The text content (optional, if no URL)
This tool requires authentication. You’ll need to create an authenticated context first.

6. view_user_profile

View the profile of a specific Hacker News user. Parameters:
string
required
The username of the profile to view
Example usage:

Setup and Testing

Build the Server

Test with MCP Inspector

This opens a web interface where you can test each tool:
MCP Inspector showing Hacker News tools

Add to Claude Code

Example Prompts

Once your server is connected, try these prompts:
Prompt: “Search Hacker News for articles about LLMs from the past week”What happens:
  1. Uses search_posts with query “LLMs”
  2. Filters results by date
  3. Returns summaries of relevant articles
Prompt: “What are the top 3 posts on Hacker News right now and what are people saying about them?”What happens:
  1. Navigates to homepage
  2. Extracts top 3 article titles
  3. Uses view_comments for each
  4. Summarizes discussion themes
Prompt: “Show me what patio11 has been posting about lately”What happens:
  1. Uses view_user_profile with username “patio11”
  2. Extracts recent submissions and comments
  3. Summarizes activity
Prompt: “Find Ask HN posts about career advice”What happens:
  1. Uses navigate_section with “ask”
  2. Uses search_posts with “career advice”
  3. Returns relevant discussions

How It Works

Under the Hood

The generated tools use Stagehand’s AI-powered browser automation:

Context Management

The server automatically manages Browserbase contexts:
  1. Check for saved context - Looks for ~/.mcpkit/contexts/news.ycombinator.com.txt
  2. Create new if needed - Creates a fresh Browserbase context
  3. Initialize Stagehand - Connects to the browser session
  4. Execute action - Runs the requested tool
  5. Return results - Sends structured data back to the AI

Customization Ideas

Add More Tools

Extend the generated server with custom tools:

Improve Extraction

Enhance data extraction with better schemas:

Add Caching

Cache frequently accessed data:

Common Use Cases

Use the Hacker News MCP to research technical topics:
The AI will:
  • Search for relevant posts
  • Read comment threads
  • Extract key points from discussions
  • Provide a balanced summary

Troubleshooting

Hacker News is usually fast, but if tools timeout:
  1. Check internet connection
  2. Verify Browserbase quota - Make sure you haven’t hit limits
  3. Try again - HN can occasionally be slow
If view_article can’t find an article:
  1. Check exact title - Use the exact title from HN
  2. Article may have fallen off front page - Try navigating to “new” first
  3. Use search instead - Try search_posts for more flexibility
To submit posts, you need authentication:

Next Steps

Try More Examples

See other example MCP servers

Customize Tools

Learn to extend generated servers

Add Authentication

Add authenticated features

Use with AI Tools

Integrate with your AI assistant