News Analysis Agent MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/MayssenBHA/mcp-news-analysis-agent
cd mcp-news-analysis-agent

Then follow the repository README for any remaining dependency or build steps before continuing.

2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "RAPIDAPI_KEY=${RAPIDAPI_KEY}" -e "RAPIDAPI_HOST=${RAPIDAPI_HOST}" -e "MISTRAL_API_KEY=${MISTRAL_API_KEY}" news-analysis-agent -- python "<FULL_PATH_TO_MCP_NEWS_ANALYSIS_AGENT>/dist/index.js"

Replace <FULL_PATH_TO_MCP_NEWS_ANALYSIS_AGENT>/dist/index.js with the actual folder you prepared in step 1.

Required:RAPIDAPI_KEYRAPIDAPI_HOSTMISTRAL_API_KEY
README.md

Intelligent news analysis with AI-powered sentiment and summarization

mcp-news-analysis-agent

A comprehensive Model Context Protocol (MCP) implementation for intelligent news analysis, featuring advanced LLM-powered sentiment analysis, AI summarization, and natural language query processing using Mistral AI.

🧠 LLM-Powered Architecture

This project leverages Mistral AI for advanced natural language processing capabilities:

  • Sentiment Analysis: Uses Mistral's LLM for nuanced sentiment understanding with confidence scoring
  • Text Summarization: AI-powered content summarization with customizable length and style
  • Intent Detection: Smart query interpretation for natural language interaction
  • Structured Outputs: JSON-formatted responses with detailed reasoning and metadata

šŸš€ Features

  • News Fetching: Retrieve real-time news articles from RapidAPI
  • Sentiment Analysis: Advanced sentiment analysis using Mistral AI with confidence scoring and detailed reasoning
  • Text Summarization: AI-powered summarization using Mistral AI
  • Intelligent Agent: Natural language query processing with enhanced intent detection
  • MCP Architecture: Fully compliant with Model Context Protocol standards

šŸ“‹ Project Structure

MCPDemo/
ā”œā”€ā”€ server/
│   └── mcp_server.py          # MCP server implementation
ā”œā”€ā”€ client/
│   └── mcp_client.py          # Enhanced MCP client with intelligent intent detection and quote parsing
ā”œā”€ā”€ tools/
│   ā”œā”€ā”€ news_tool.py           # News fetching from RapidAPI
│   ā”œā”€ā”€ sentiment_tool.py      # sentiment analysis tools
│   ā”œā”€ā”€ summary_tool.py        # Text summarization tools
│   └── __init__.py
ā”œā”€ā”€ config/
│   ā”œā”€ā”€ settings.py            # Configuration management
│   ā”œā”€ā”€ .env                   # Environment variables
│   └── __init__.py
ā”œā”€ā”€ requirements.txt           # Python dependencies
└── README.md                  # This file

āš™ļø Setup Instructions

1. Environment Setup

First, create a Python virtual environment:

# Navigate to project directory
cd "C:\Users\mayssen\Desktop\mcp project\MCPDemo"

# Create virtual environment
python -m venv .venv

# Activate virtual environment
.\.venv\Scripts\Activate  # Windows
# source .venv/bin/activate  # macOS/Linux

# Install dependencies
pip install -r requirements.txt

2. API Keys Configuration

Edit the config/.env file and add your API keys:

# News API key from RapidAPI (already provided)
RAPIDAPI_KEY=6d35e9aa82msh4c8550ffb3e08b4p15bf78jsna3f5a47eeb4d
RAPIDAPI_HOST=real-time-news-data.p.rapidapi.com

# Get your Mistral AI API key from https://console.mistral.ai/
MISTRAL_API_KEY=your_mistral_api_key_here

# Optional: Adjust other settings as needed
MAX_NEWS_ARTICLES=10
MAX_SUMMARY_LENGTH=500
LOG_LEVEL=INFO

3. Install Additional Dependencies

Some packages might need special installation:

# Ensure Mistral AI client is properly installed
pip install mistralai

# If you encounter any import errors, install packages individually:
pip install httpx langchain-mistralai fastmcp

šŸ”§ Usage

Running the MCP Server

# Make sure you're in the project directory with activated virtual environment
python server/mcp_server.py

Running the Interactive Agent

In a separate terminal:

# Activate the same virtual environment
.\.venv\Scripts\Activate

# Run the client
python client/mcp_client.py

Example Queries

Once the agent is running, try these natural language queries:

- "Get latest news about technology"
- "Analyze sentiment of recent news about climate change"
- "Summarize news about the economy"
- "Show me top 5 news from UK"
- "How do people feel about the latest political news?"
- "Get French news about sports and analyze sentiment"
- "This new AI technology is amazing but also quite expensive" (direct text analysis)

šŸ›  Available Tools

1. News Tool

  • Function: fetch_news
  • Purpose: Fetches news articles from RapidAPI
  • Parameters: topic, country, language, limit
  • Example: Retrieve tech news from US in English

2. Sentiment Analysis Tool

  • Function: analyze_sentiment
  • Purpose: Analyzes sentiment using advanced Mistral AI LLM with confidence scoring and detailed reasoning
  • Parameters: text, analysis_type (simple/detailed)
  • Features:
    • Structured JSON responses with confidence scores
    • Detailed reasoning and emotion detection
    • Support for complex, nuanced sentiment analysis
    • Direct text analysis through quotes
  • Example: Determine sentiment with confidence: "Mixed sentiment (0.80 confidence) - expresses both excitement and concern"

3. Summary Tool (Requires Mistral AI)

  • Function: summarize_text
  • Purpose: Summarizes text using Mistral AI
  • Parameters: text, max_length, summary_type
  • Example: Create brief summaries of long articles

4. Combined Workflows

  • Function: analyze_news_sentiment
  • Purpose: Fetches news and analyzes sentiment in one step

Tools (4)

fetch_newsFetches news articles from RapidAPI
analyze_sentimentAnalyzes sentiment using advanced Mistral AI LLM with confidence scoring and detailed reasoning
summarize_textSummarizes text using Mistral AI
analyze_news_sentimentFetches news and analyzes sentiment in one step

Environment Variables

RAPIDAPI_KEYrequiredAPI key for accessing real-time news data
RAPIDAPI_HOSTrequiredHost URL for the news API
MISTRAL_API_KEYrequiredAPI key for Mistral AI services

Configuration

claude_desktop_config.json
{"mcpServers": {"news-analysis": {"command": "python", "args": ["/path/to/mcp_server.py"], "env": {"RAPIDAPI_KEY": "your_key", "MISTRAL_API_KEY": "your_key"}}}}

Try it

→Get latest news about technology
→Analyze sentiment of recent news about climate change
→Summarize news about the economy
→Show me top 5 news from UK
→Get French news about sports and analyze sentiment

Frequently Asked Questions

What are the key features of News Analysis Agent?

Real-time news fetching from RapidAPI. Advanced sentiment analysis with confidence scoring and reasoning. AI-powered text summarization using Mistral AI. Natural language query processing with intent detection. Structured JSON output for analysis results.

What can I use News Analysis Agent for?

Tracking public sentiment on specific global events. Generating concise summaries of long-form news articles. Automating market research by aggregating and analyzing industry news. Monitoring regional news trends for specific topics.

How do I install News Analysis Agent?

Install News Analysis Agent by running: python server/mcp_server.py

What MCP clients work with News Analysis Agent?

News Analysis Agent works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep News Analysis Agent docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare