新闻标题情感分析
STDIO分析美国新闻标题情感的服务器
分析美国新闻标题情感的服务器
A Model Context Protocol server that analyzes sentiment in news headlines from major US publications. The server provides both a standard date-based interface and natural language date parsing for easier use.
git clone https://github.com/fred-em/headline-vibes.git cd headline-vibes
npm install
npm run build
{ "mcpServers": { "headline-vibes": { "command": "node", "args": ["/path/to/headline-vibes/build/index.mjs"], "env": { "NEWS_API_KEY": "your-api-key-here" }, "disabled": false, "autoApprove": [] } } }
Analyze sentiment using natural language date input or specific dates.
Example usage:
// Using natural language { "name": "analyze_headlines", "arguments": { "input": "yesterday" } } // Or using specific dates { "name": "analyze_headlines", "arguments": { "input": "2025-02-11" } }
Input examples:
The tool returns results in the following format:
{ "score": "6.50", // Normalized sentiment score (0-10) "synopsis": "Overall positive sentiment in today's headlines", "headlines_analyzed": 100, // Number of headlines analyzed "sources_analyzed": 12, // Number of unique sources "source_distribution": { // Distribution of headlines by source "Reuters": 10, "Associated Press": 8, "CNN": 9, // ... etc }, "sample_headlines": [ // Up to 5 sample headlines "Example headline 1", "Example headline 2", // ... etc ] }
The server pulls headlines from major US news sources including:
The server provides clear error messages for common issues:
To run the server in watch mode during development:
npm run watch
MIT