News MCP Server
A Model Context Protocol (MCP) server that provides news information from various RSS feeds, designed to integrate with AI assistants like Claude.
Features
- Get the latest news from various categories (tech, business, science, etc.)
- Search for news articles matching specific terms
- View articles from specific feeds
- Get detailed information about individual articles
- Caching to improve performance and reduce load on RSS sources
- Configurable via environment variables
Installation
Prerequisites
- Python 3.10 or higher
- MCP SDK 1.2.0 or higher
Setup
- Clone this repository:
git clone https://github.com/ltejedor/newsfeed-mcp.git
cd news-mcp
- Create a virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
- Run the server:
python news_mcp.py
Docker Installation
To run the server using Docker:
docker-compose up -d
Configuration
The server can be configured using environment variables:
NEWS_MCP_CUSTOM_FEEDS
: Additional RSS feeds in the formatname1:url1;name2:url2
LOG_LEVEL
: Set logging level (INFO, DEBUG, WARNING, ERROR)
Usage with Claude for Desktop
Make sure you have Claude for Desktop installed and updated.
Open your Claude for Desktop App configuration:
- On macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- On Windows:
%APPDATA%\Claude\claude_desktop_config.json
- On macOS:
Add your news server to the configuration:
{
"mcpServers": {
"news": {
"command": "python",
"args": [
"/ABSOLUTE/PATH/TO/news_mcp.py"
]
}
}
}
Restart Claude for Desktop.
Look for the hammer icon (🔨) in Claude for Desktop to access your tools.
Available Tools
The server provides the following tools:
health_check()
Check if the server is running properly and get basic stats.
list_available_feeds()
Get a list of all available feeds and categories.
Example usage in Claude:
What news feeds do you have available?
get_latest_news(category, limit)
Get recent news articles, optionally filtered by category.
Parameters:
category
: Optional - Filter by category (tech, general, business, science, travel, politics)limit
: Optional - Maximum number of articles to return (default: 5, max: 20)
Example usage in Claude:
Show me the latest tech news
search_news(query, limit)
Search for news articles matching a specific term.
Parameters:
query
: Search term to look for in news articleslimit
: Optional - Maximum number of articles to return (default: 5, max: 20)
Example usage in Claude:
Search for news about climate change
get_feed_content(feed_name, limit)
Get articles from a specific feed.
Parameters:
feed_name
: Name of the feed to fetchlimit
: Optional - Maximum number of articles to return (default: 5, max: 20)
Example usage in Claude:
Get articles from the NASA feed
get_article_details(url)
Get detailed information about an article by URL.
Parameters:
url
: The URL of the article to retrieve details for
Example usage in Claude:
Tell me more about this article: https://www.example.com/article
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.