Skip to main content
Glama
21omk21

MCP News Server

by 21omk21
README.md
# MCP News Server

A Model Context Protocol (MCP) server that fetches news from trusted global sources.

## 🗞️ Supported News Sources

| Source | ID |
|--------|-------|
| Reuters | `reuters` |
| BBC News | `bbc` |
| Associated Press | `associated-press` |
| Al Jazeera | `al-jazeera` |
| The Hindu | `the-hindu` |
| Times of India | `times-of-india` |
| CNN | `cnn` |
| The Guardian | `the-guardian` |
| New York Times | `nytimes` |
| Washington Post | `washington-post` |

## 🛠️ Available Tools

### 1. `search_news`
Search for news articles by keywords.
```
Keywords: "iran israel" or "climate change"
Sources: Optional filter (e.g., ["reuters", "bbc"])
Max Results: Up to 25 articles
```

### 2. `get_top_headlines`
Get latest headlines from trusted sources.

### 3. `list_news_sources`
List all available news sources.

## 📦 Installation

### Step 1: Install Dependencies

```bash
cd mcp-news-server
pip install -r requirements.txt
```

### Step 2: Get NewsAPI Key (Recommended)

1. Go to https://newsapi.org/register
2. Sign up for a free account
3. Copy your API key

### Step 3: Configure API Key

```bash
# Copy example env file
copy .env.example .env

# Edit .env and add your API key
NEWS_API_KEY=your_actual_api_key
```

**Note:** The server works without an API key using RSS feeds, but NewsAPI provides better search results.

## ⚙️ Configuration for VS Code (Copilot)

Add this to your VS Code `settings.json`:

```json
{
    "mcp": {
        "servers": {
            "news-server": {
                "command": "python",
                "args": ["c:\\Users\\om.katyarmal.NEUREALM\\Desktop\\New folder (5)\\mcp-news-server\\server.py"],
                "env": {
                    "NEWS_API_KEY": "your_api_key_here"
                }
            }
        }
    }
}
```

## ⚙️ Configuration for Claude Desktop

Add to `%APPDATA%\Claude\claude_desktop_config.json`:

```json
{
    "mcpServers": {
        "news-server": {
            "command": "python",
            "args": ["c:\\Users\\om.katyarmal.NEUREALM\\Desktop\\New folder (5)\\mcp-news-server\\server.py"],
            "env": {
                "NEWS_API_KEY": "your_api_key_here"
            }
        }
    }
}
```

## 🚀 Usage Examples

Once configured, you can use these tools in your conversations:

**Search for specific news:**
> "Search news about iran israel conflict"

**Get headlines from specific sources:**
> "Get top headlines from reuters and bbc"

**List available sources:**
> "What news sources are available?"

## 🔄 How It Works

1. **Primary Method**: Uses NewsAPI.org for comprehensive search across sources
2. **Fallback Method**: If NewsAPI is unavailable, fetches from RSS feeds directly

The server automatically filters results from only trusted, reputable news sources.

## 📝 License

MIT License - Free to use and modify.