an1604/news-mcp-server
If you are the rightful owner of news-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The GenAI News Assistant MCP Server is a template for building a Model Context Protocol server that integrates news fetching and analysis using NewsAPI.org and a Large Language Model.
GenAI News Assistant MCP Server
This repository contains a template for building a Model Context Protocol (MCP) server that provides tools for fetching and analyzing news information using NewsAPI.org and a Large Language Model.
Project Structure
.
āāā python/ # Python implementation
ā āāā Dockerfile # Python Docker configuration
ā āāā src/ # Python source code
āāā typescript/ # TypeScript implementation
ā āāā Dockerfile # TypeScript Docker configuration
ā āāā src/ # TypeScript source code
āāā README.md # This file
Prerequisites
- Docker installed on your system
- NewsAPI.org API key (register for free at https://newsapi.org/)
- OpenAI API key (for LLM functionality)
Environment Variables
The following environment variables are required:
NEWS_API_KEY
: Your NewsAPI.org API keyOPENAI_API_KEY
: Your OpenAI API key
Building and Running
Python Version
# Build the Docker image
cd python
docker build -t news-assistant-python .
# Run the container
docker run -p 3000:3000 \
-e NEWS_API_KEY=your_news_api_key \
-e LLM_API_KEY=your_llm_api_key \
news-assistant-python
TypeScript Version
# Build the Docker image
cd typescript
docker build -t news-assistant-typescript .
# Run the container
docker run -p 3000:3000 \
-e NEWS_API_KEY=your_news_api_key \
-e LLM_API_KEY=your_llm_api_key \
news-assistant-typescript
Testing
You can validate that the server works as intended in development using the MCP Inspector https://github.com/modelcontextprotocol/inspector
MCP Tools
The server should implement the following MCP tools:
search_news
: Search for recent news articles matching a specific queryextract_information_from_article
: Extract structured information from a news articleextract_key_info_and_sentiment
: Analyze news articles for key entities and sentiment
For detailed specifications of each tool, please refer to the assignment documentation.
Development
Choose either the Python or TypeScript implementation based on your preference. Both implementations provide the same functionality through the MCP interface.
License
This is a private repository for take-home assignment purposes only.