A Model Context Protocol (MCP) server that provides access to the World News API. This server enables AI assistants to search for news, get top headlines, extract articles, retrieve newspaper front pages, and more through the MCP protocol.
- News Search: Search and filter news by text, date, location, category, language, and more
- Top Headlines: Get top news from any country in any language
- Newspaper Front Pages: Retrieve front pages of newspapers from around the world
- Article Extraction: Extract full articles from news URLs
- News Links Discovery: Extract news links from websites
- Source Search: Find monitored news sources
- Location Coordinates: Get geo-coordinates for location-based filtering
- Content Analysis: Extract entities, detect sentiment, and more
npm install -g world-news-api-mcp-
Get a World News API key (free at https://worldnewsapi.com/register)
-
Set your API key as an environment variable:
# Windows (PowerShell) $env:WORLD_NEWS_API_KEY="your_api_key_here" # macOS/Linux export WORLD_NEWS_API_KEY="your_api_key_here"
Add this configuration to your MCP client (Claude Desktop, etc.):
{
"servers": {
"world-news-api": {
"command": "world-news-api-mcp",
"env": {
"WORLD_NEWS_API_KEY": "your_api_key_here"
}
}
}
}# Set your API key
export WORLD_NEWS_API_KEY="your_key_here"
# Test the server
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | world-news-api-mcpSearch and filter news by text, date, location, category, language, and more.
Parameters:
text(string, optional): Text to match in news content (min 3 chars)source-country(string, optional): ISO 3166 country code (e.g., "us", "gb")language(string, optional): ISO 6391 language code (e.g., "en", "es")min-sentiment/max-sentiment(number, optional): Sentiment range [-1,1]earliest-publish-date/latest-publish-date(string, optional): Date range (YYYY-MM-DD HH:MM:SS)news-sources(string, optional): Comma-separated list of sourcesauthors(string, optional): Comma-separated list of authorscategories(string, optional): Categories (politics, sports, business, technology, etc.)entities(string, optional): Filter by entities (ORG:Tesla,PER:Elon Musk)location-filter(string, optional): "latitude,longitude,radius_km"sort(string, optional): Sorting criteria (publish-time)sort-direction(string, optional): ASC or DESCoffset(number, optional): Number of results to skipnumber(number, optional): Number of results to return (1-100, default: 10)
Get the top news from a country in a language for a specific date.
Parameters:
source-country(string, required): ISO 3166 country codelanguage(string, required): ISO 6391 language codedate(string, optional): Date (YYYY-MM-DD), defaults to current dayheadlines-only(boolean, optional): Return only basic info (default: false)
Get front pages of newspapers from around the world.
Parameters:
source-country(string, optional): ISO 3166 country codesource-name(string, optional): Publication identifier (e.g., "herald-sun")date(string, optional): Date (YYYY-MM-DD), earliest: 2024-07-09
Retrieve detailed information about specific news articles by their IDs.
Parameters:
ids(string, required): Comma-separated list of news IDs
Extract a news article from a website to a well-structured JSON object.
Parameters:
url(string, required): URL of the news articleanalyze(boolean, optional): Analyze content (entities, sentiment, etc.)
Extract news links from a news website.
Parameters:
url(string, required): URL of the news websiteanalyze(boolean, optional): Analyze extracted content
Search whether a news source is monitored by the World News API.
Parameters:
name(string, required): (Partial) name of the source
Get latitude and longitude of a location for use in location-filter.
Parameters:
location(string, required): Address or location name
{
"name": "search_news",
"arguments": {
"text": "artificial intelligence",
"language": "en",
"categories": "technology",
"number": 5
}
}{
"name": "get_top_news",
"arguments": {
"source-country": "us",
"language": "en"
}
}{
"name": "extract_news",
"arguments": {
"url": "https://www.bbc.com/news/world-us-canada-59340789",
"analyze": true
}
}{
"name": "search_news",
"arguments": {
"text": "earthquake",
"location-filter": "35.6762,139.6503,50",
"language": "en"
}
}To run in development mode:
npm run devTo build:
npm run buildTo test:
npm testThe World News API has different rate limits based on your subscription:
- Free Plan: 150 requests per day
- Paid Plans: Higher limits available
Check the World News API pricing for details.
The server handles common API errors:
- 401 Unauthorized: Invalid API key
- 402 Payment Required: API quota exceeded
- 429 Too Many Requests: Rate limit exceeded
ISC
Contributions are welcome! Please feel free to submit a Pull Request.