Skip to main content
Glama
sp716
by sp716
README.md
# AI News MCP Server

A local stdio MCP server that fetches recent AI news from curated RSS feeds, summarises it with OpenAI, and can read a private AWS DynamoDB cache.

## MCP Tools

- `list_ai_news_sources`
- `get_latest_ai_news`
- `get_cached_ai_news`

## MCP Prompts

- `daily_ai_news_briefing`
- `topic_watch`
- `compare_ai_sources`
- `executive_ai_digest`

## Local Setup

```powershell
$env:UV_CACHE_DIR = ".uv-cache"
uv sync --python C:\Python311\python.exe
```

Set local OpenAI credentials for live local summaries:

```powershell
$env:OPENAI_API_KEY = "your_api_key_here"
$env:OPENAI_MODEL = "gpt-5.4-mini"
```

Run the local MCP server:

```powershell
uv run news-mcp
```

## Local Tests

```powershell
$env:UV_CACHE_DIR = ".uv-cache"
uv run pytest
```

## AWS Cache Flow

The CDK stack creates:

- DynamoDB table `AiNewsCache`
- Secrets Manager secret `news-mcp/openai-api-key`
- Lambda refresh function
- EventBridge schedule that runs every 3 hours
- IAM permissions for Lambda to read the secret and write DynamoDB

The Lambda writes the latest briefing to:

```text
pk = BRIEFING
sk = LATEST
```

## Build And Deploy AWS Cache

Rebuild the Lambda package after changing `lambda_refresh/handler.py` or `lambda_refresh/requirements.txt`:

```powershell
.\scripts\build_lambda.ps1
```

Synthesize and deploy:

```powershell
$env:UV_CACHE_DIR = ".uv-cache"
$env:JSII_RUNTIME_PACKAGE_CACHE = "C:\Users\arzil\Desktop\news-mcp\.jsii-cache"
$env:NPM_CONFIG_CACHE = "C:\Users\arzil\Desktop\news-mcp\.npm-cache"

npx.cmd aws-cdk synth
npx.cmd aws-cdk deploy
```

After deploy, store the OpenAI key in Secrets Manager:

```powershell
aws secretsmanager put-secret-value `
  --secret-id news-mcp/openai-api-key `
  --secret-string "YOUR_OPENAI_API_KEY_HERE"
```

Invoke the Lambda once to populate the cache:

```powershell
aws lambda list-functions --query "Functions[?contains(FunctionName, 'NewsCacheRefreshFunction')].FunctionName" --output table

aws lambda invoke `
  --function-name "PASTE_FUNCTION_NAME_HERE" `
  --payload "{}" `
  lambda-output.json
```

## Test AWS-Backed MCP Tool

Inspector can be awkward on Windows, so this script tests the MCP protocol directly:

```powershell
$env:AI_NEWS_CACHE_TABLE = "AiNewsCache"
$env:AWS_DEFAULT_REGION = "eu-west-2"
uv run python scripts\test_mcp_cached.py
```

You should see the available tools and a cached news result with:

```text
"cache_error": null
```

## Source Configuration

RSS sources live in `sources.toml`. Disable a source by setting:

```toml
enabled = false
```

TDQS

C2.1/5.0

Scored across 3 tools

Disambiguation5/5

Each tool targets a distinct action: one retrieves cached news, one gets latest news, one lists sources. No overlap.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case: get_cached_ai_news, get_latest_ai_news, list_ai_news_sources.

Tool Count5/5

Three tools is appropriate for a focused news server; not too few or too many.

Completeness4/5

Covers cached and latest news retrieval and source listing, but lacks search or other advanced features. Minor gap.