konapalask/Question-to-HeadlinesMCP-server
If you are the rightful owner of Question-to-HeadlinesMCP-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 dayong@mcphub.com.
The FastMCP News Aggregator is a Model Context Protocol (MCP) server that integrates with NewsAPI.org to provide real-time news data to AI clients.
#BuildWithPuch
📰 FastMCP News Aggregator
A Model Context Protocol (MCP) server built with FastMCP and NewsAPI.org.
This MCP server allows AI clients to fetch top headlines, search all articles, and list available news sources in real time.
🚀 Features
- Top Headlines: Get the latest headlines filtered by category, source, or keyword.
- Everything Search: Search historical and current news articles with date range and sorting.
- News Sources: List available news publishers and sources.
- Built with Python and FastMCP for quick integration into AI workflows.
- Uses the official
newsapi-pythonclient.
📦 Installation
- Clone this repository
git clone https://github.com/konapalask/Question-to-HeadlinesMCP-server cd Question-to-HeadlinesMCP-server
2. **Install dependencies**
```bash
pip install fastmcp newsapi-python
-
Get an API key from https://newsapi.org/register (Free tier available).
-
Set your API key in
.envNEWS_API_KEY=your_api_key
🖥 Usage
Run the MCP server:
python news_server.py
This server exposes three MCP tools:
get_top_headlines→ Fetch the latest news headlinesget_everything→ Search all news articlesget_sources→ List available news sources
📌 Example Calls
1️⃣ Get Top Headlines
{
"query": "bitcoin",
"sources": "bbc-news,the-verge",
"category": "business",
"country": "us"
}
2️⃣ Search All Articles
{
"query": "artificial intelligence",
"from_param": "2025-08-01",
"to": "2025-08-09",
"sort_by": "publishedAt"
}
3️⃣ Get Sources
{
"category": "technology",
"country": "us"
}
📂 Project Structure
fastmcp-news-aggregator/
│── news_server.py # Main MCP server code
│── README.md # Project documentation
🛠 Requirements
- Python 3.8+
fastmcpnewsapi-python
Install all requirements:
pip install -r requirements.txt
⚠️ Limitations
- The free tier of NewsAPI does not support
get_everythingfor historical data older than 30 days. - Rate limits apply (check NewsAPI pricing).
📜 License
This project is licensed under the MIT License. Feel free to modify and use it for your own projects.
🙌 Acknowledgements
- NewsAPI.org for providing the news data
- FastMCP for the MCP server framework