Hacker News Server
БесплатноНе проверенEnables AI assistants to fetch top, new, best, Ask HN, Show HN, and job stories, as well as specific posts, comments, and user information from Hacker News thro
Описание
Enables AI assistants to fetch top, new, best, Ask HN, Show HN, and job stories, as well as specific posts, comments, and user information from Hacker News through the Model Context Protocol.
README
This is a Model Context Protocol (MCP) server that integrates with the official Hacker News API, designed to be deployed to Netlify. The MCP server exposes tools and resources that enable AI assistants to access and interact with Hacker News content through the Model Context Protocol.
This project also includes a FastAPI client that provides a REST API for interacting with the MCP server, making it easy to test and integrate with other applications.
Features
MCP Server
- Serverless MCP server implementation integrating with the Hacker News API
- Deployed on Netlify
- Includes tools to fetch top, new, best, Ask HN, Show HN, and job stories
- Provides tools to get specific posts, comments, and user information
- Includes resources with documentation on using the Hacker News API
MCP Client
- FastAPI REST API for interacting with the MCP server
- Interactive API documentation (Swagger UI)
- Easy testing and integration
- Python script for automated testing
Getting Started
Local Development
- Clone this repository
- Install dependencies:
npm install - Start the development server:
npm run dev
The MCP server will be available locally at http://localhost:8888/mcp
Testing Your MCP Server
You can test your MCP server using either the MCP Inspector or directly with curl commands.
Using MCP Inspector
While the development server is running, you can test your MCP server using the MCP inspector:
npx @modelcontextprotocol/inspector npx mcp-remote@next http://localhost:8888/mcp
After deployment, you can test your deployed version:
npx @modelcontextprotocol/inspector npx mcp-remote@next https://your-site-name.netlify.app/mcp
Then open http://localhost:6274/ in your browser to interact with the MCP inspector.
Using curl
You can also test the MCP server directly using curl commands:
Initialize the MCP server:
curl -X POST http://localhost:8888/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"mcp/init","params":{},"id":"1"}'List available tools:
curl -X POST http://localhost:8888/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"mcp/listTools","params":{},"id":"2"}'Call a tool to get top Hacker News stories:
curl -X POST http://localhost:8888/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"mcp/callTool","params":{"name":"hn-get-top-stories","args":{"limit":5}},"id":"3"}'Call a tool to get a specific Hacker News item:
curl -X POST http://localhost:8888/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"mcp/callTool","params":{"name":"hn-get-item","args":{"id":8863}},"id":"3"}'List available resources:
curl -X POST http://localhost:8888/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"mcp/listResources","params":{},"id":"4"}'Read a resource about the Hacker News API:
curl -X POST http://localhost:8888/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"mcp/readResource","params":{"uri":"docs://hacker-news-api-overview"},"id":"5"}'
Deployment
Deploying to Netlify
- Push this repository to GitHub
- Connect your repository to Netlify
- Configure the build settings:
- Build command: leave empty (no build required)
- Publish directory:
public
After deployment, your MCP server will be available at https://your-site-name.netlify.app/mcp
Using with Claude Desktop
To use this Hacker News MCP server with Claude Desktop:
- Go to Claude Desktop settings
- Enable the MCP Server configuration
- Edit the configuration file:
{ "mcpServers": { "hacker-news": { "command": "npx", "args": [ "mcp-remote@next", "https://your-site-name.netlify.app/mcp" ] } } } - Restart Claude Desktop
Once configured, you can ask Claude to interact with Hacker News content, for example:
- "Show me the top 5 stories from Hacker News right now"
- "Get me the details of a specific Hacker News post"
- "Search for Ask HN posts about programming"
- "Find information about a specific Hacker News user"
Using the MCP Client
The MCP client provides a REST API interface for interacting with the MCP server. It's built with FastAPI and offers a clean, modern API with automatic documentation.
Starting the Client
cd mcp-client
pip install -r requirements.txt
uvicorn main:app --reload
This will start the FastAPI server at http://localhost:8001. You can access the API documentation at http://localhost:8001/docs.
Managing the MCP Server and FastAPI Client
The template includes several scripts to manage both the MCP server and FastAPI client:
cd mcp-client
./start.sh # Start both services in the background
./stop.sh # Stop both services gracefully
./check_status.sh # Check if services are running and view logs
./test_client.py # Test the FastAPI client endpoints
These scripts ensure processes keep running in the background even after you close your terminal, properly manage log files, and provide clear status information.
Testing the Client
You can test the client using the provided test script:
cd mcp-client
./test_client.py
This will run a series of tests against the API endpoints and display the results.
API Endpoints
GET /server- Get server informationGET /tools- List available toolsPOST /tools/call- Call a toolGET /resources- List available resourcesPOST /resources/read- Read a resource
For more details, refer to the MCP Client README.
Hacker News API Tools
This MCP server provides the following tools for interacting with the Hacker News API:
hn-get-top-stories: Fetches the current top stories from Hacker News- Parameters:
limit(optional, number of stories to return, default: 10, max: 500)
- Parameters:
hn-get-new-stories: Fetches the newest stories from Hacker News- Parameters:
limit(optional, number of stories to return, default: 10, max: 500)
- Parameters:
hn-get-best-stories: Fetches the best stories from Hacker News- Parameters:
limit(optional, number of stories to return, default: 10, max: 500)
- Parameters:
hn-get-ask-stories: Fetches Ask HN stories from Hacker News- Parameters:
limit(optional, number of stories to return, default: 10, max: 200)
- Parameters:
hn-get-show-stories: Fetches Show HN stories from Hacker News- Parameters:
limit(optional, number of stories to return, default: 10, max: 200)
- Parameters:
hn-get-job-stories: Fetches job stories from Hacker News- Parameters:
limit(optional, number of stories to return, default: 10, max: 200)
- Parameters:
hn-get-item: Fetches a specific item (story, comment, job, poll, etc.) from Hacker News by ID- Parameters:
id(required, the ID of the item to fetch)
- Parameters:
hn-get-user: Fetches information about a specific user from Hacker News by username- Parameters:
id(required, the username of the user to fetch)
- Parameters:
Documentation Resources
The MCP server provides the following documentation resources:
docs://hacker-news-api-overview: Overview of the Hacker News API and the tools available in this MCP serverdocs://hacker-news-item-types: Information about the different types of items in the Hacker News API and their propertiesdocs://hacker-news-usage-examples: Examples of how to use the Hacker News MCP tools with sample requests and responses
Extending
Extending the MCP Server
You can extend this MCP server by adding more tools and resources to the getServer function in netlify/functions/mcp-server.js. Follow the existing examples and refer to the Model Context Protocol documentation for more information.
Extending the MCP Client
To add new endpoints to the MCP client, edit the main.py file in the mcp-client directory. The client is built with FastAPI, which makes it easy to add new routes and functionality.
Learn More
Установка Hacker News Server
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/davidvgilmore/hn-mcp-serverFAQ
Hacker News Server MCP бесплатный?
Да, Hacker News Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Hacker News Server?
Нет, Hacker News Server работает без API-ключей и переменных окружения.
Hacker News Server — hosted или self-hosted?
Доступен hosted-вариант: Unyly запускает сервер в облаке, локальная установка не обязательна.
Как установить Hacker News Server в Claude Desktop, Claude Code или Cursor?
Открой Hacker News Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare Hacker News Server with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
