NimbleBrainInc/mcp-news-api
If you are the rightful owner of mcp-news-api and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
MCP server for accessing news articles, breaking headlines, and sources from News API.
News API MCP Server
MCP server for accessing news articles, breaking headlines, and sources from News API. Search through 80,000+ news sources worldwide with advanced filtering options.
Features
- Article Search: Search all articles with keywords, dates, and filters
- Top Headlines: Get breaking news and top headlines by country/category
- Source Discovery: List and filter from 80,000+ news sources
- Multi-language: Access news in 14 different languages
- Country-specific: Get news from 150+ countries
- Category Filtering: Browse news by 7 major categories
Setup
Prerequisites
- News API account (free or paid)
- API key from newsapi.org
Environment Variables
NEWS_API_KEY
(required): Your News API key
How to get an API key:
- Go to newsapi.org/register
- Sign up for a free or paid account
- Find your API key in the dashboard
- Free tier includes 100 requests/day
Available Tools
Article Search Tools
search_everything
Search through all articles with advanced filtering.
Parameters:
q
(string, required): Keywords or phrases to search forfrom_date
(string, optional): Oldest date (ISO 8601: YYYY-MM-DD)to_date
(string, optional): Newest date (ISO 8601: YYYY-MM-DD)sources
(string, optional): Comma-separated source IDs (e.g., 'bbc-news,cnn')domains
(string, optional): Comma-separated domains (e.g., 'bbc.co.uk,techcrunch.com')language
(string, optional): Language code ('en', 'es', 'fr', 'de', 'it', 'pt', 'ru', 'ar', 'zh', etc.)sort_by
(string, optional): Sort order ('relevancy', 'popularity', 'publishedAt', default: 'publishedAt')page_size
(int, optional): Results per page (max: 100, default: 20)page
(int, optional): Page number (default: 1)
Example:
articles = await search_everything(
q="artificial intelligence",
from_date="2024-01-01",
to_date="2024-12-31",
language="en",
sort_by="relevancy",
page_size=50
)
get_top_headlines
Get breaking news and top headlines.
Parameters:
country
(string, optional): 2-letter ISO country code ('us', 'gb', 'ca', 'au', 'de', 'fr', etc.)category
(string, optional): Category ('business', 'entertainment', 'general', 'health', 'science', 'sports', 'technology')sources
(string, optional): Comma-separated source IDsq
(string, optional): Keywords to search forpage_size
(int, optional): Results per page (max: 100, default: 20)page
(int, optional): Page number (default: 1)
Note: Cannot mix 'sources' with 'country' or 'category' parameters.
Example:
headlines = await get_top_headlines(
country="us",
category="technology",
page_size=10
)
search_by_source
Search articles from specific news sources.
Parameters:
sources
(string, required): Comma-separated source IDsq
(string, optional): Keywords to search forfrom_date
(string, optional): Oldest date (ISO 8601: YYYY-MM-DD)to_date
(string, optional): Newest date (ISO 8601: YYYY-MM-DD)sort_by
(string, optional): Sort order (default: 'publishedAt')page_size
(int, optional): Results per page (max: 100, default: 20)page
(int, optional): Page number (default: 1)
Example:
articles = await search_by_source(
sources="bbc-news,cnn,techcrunch",
q="climate change",
page_size=20
)
Source Discovery Tools
get_sources
Get all available news sources with optional filters.
Parameters:
category
(string, optional): Filter by categorylanguage
(string, optional): Filter by language codecountry
(string, optional): Filter by country code
Example:
sources = await get_sources(
category="technology",
language="en",
country="us"
)
Category & Country Tools
search_by_category
Get news articles by category.
Parameters:
category
(string, required): News categorycountry
(string, optional): Country codeq
(string, optional): Keywords to search forpage_size
(int, optional): Results per page (max: 100, default: 20)page
(int, optional): Page number (default: 1)
Example:
tech_news = await search_by_category(
category="technology",
country="us",
page_size=25
)
search_by_country
Get news articles by country.
Parameters:
country
(string, required): 2-letter ISO country codecategory
(string, optional): News categoryq
(string, optional): Keywords to search forpage_size
(int, optional): Results per page (max: 100, default: 20)page
(int, optional): Page number (default: 1)
Example:
uk_news = await search_by_country(
country="gb",
category="business",
page_size=15
)
search_by_language
Get news articles in a specific language.
Parameters:
language
(string, required): 2-letter ISO language codeq
(string, required): Keywords to search forfrom_date
(string, optional): Oldest date (ISO 8601: YYYY-MM-DD)to_date
(string, optional): Newest date (ISO 8601: YYYY-MM-DD)sort_by
(string, optional): Sort order (default: 'publishedAt')page_size
(int, optional): Results per page (max: 100, default: 20)page
(int, optional): Page number (default: 1)
Example:
french_articles = await search_by_language(
language="fr",
q="économie",
page_size=30
)
Trending Tools
get_trending_topics
Get currently trending news topics and headlines.
Parameters:
country
(string, optional): Country code (default: 'us')category
(string, optional): News category (default: 'general')page_size
(int, optional): Results per page (max: 100, default: 20)
Example:
trending = await get_trending_topics(
country="us",
category="general",
page_size=20
)
Supported Options
Categories (7 available)
business
- Business news and financeentertainment
- Entertainment and celebrity newsgeneral
- General news (default)health
- Health and medical newsscience
- Science and research newssports
- Sports news and scorestechnology
- Technology and gadget news
Languages (14 available)
ar
- Arabicde
- Germanen
- Englishes
- Spanishfr
- Frenchhe
- Hebrewit
- Italiannl
- Dutchno
- Norwegianpt
- Portugueseru
- Russiansv
- Swedishud
- Urduzh
- Chinese
Countries (150+ available)
Popular country codes:
us
- United Statesgb
- United Kingdomca
- Canadaau
- Australiade
- Germanyfr
- Francein
- Indiajp
- Japancn
- Chinabr
- Brazilmx
- Mexicoza
- South Africa
Rate Limits and Pricing
Free Tier
- 100 requests/day
- Historical articles up to 1 month old
- Top headlines and sources
- Development use only
Paid Tiers
Developer Plan ($449/month)
- 250,000 requests/month
- Historical articles up to 2 years
- Commercial use allowed
- Email support
Business Plan ($999/month)
- 1,000,000 requests/month
- Full historical archive
- Commercial use allowed
- Priority support
Enterprise (Custom pricing)
- Unlimited requests
- Full historical archive
- Dedicated support
- SLA guarantees
Visit newsapi.org/pricing for current rates.
Rate Limit Headers
All responses include rate limit information:
X-RateLimit-Limit
: Total requests allowedX-RateLimit-Remaining
: Requests remainingX-RateLimit-Reset
: Time when limit resets
Search Tips
Keywords and Phrases
- Use quotes for exact phrases:
"climate change"
- Use AND/OR/NOT operators:
tesla AND "electric cars"
- Use parentheses for complex queries:
(bitcoin OR cryptocurrency) AND regulation
Date Ranges
- Dates must be in ISO 8601 format:
YYYY-MM-DD
- Example:
from_date="2024-01-01"
,to_date="2024-12-31"
- Free tier limited to last 30 days
Sorting Options
relevancy
- Most relevant articles firstpopularity
- Most popular/shared articlespublishedAt
- Most recent articles (default)
Pagination
- Maximum
page_size
is 100 - Results are paginated, use
page
parameter to navigate totalResults
field shows total articles available
Response Format
All successful responses include:
{
"status": "ok",
"totalResults": 12345,
"articles": [
{
"source": {
"id": "bbc-news",
"name": "BBC News"
},
"author": "John Doe",
"title": "Article Title",
"description": "Article description...",
"url": "https://example.com/article",
"urlToImage": "https://example.com/image.jpg",
"publishedAt": "2024-01-15T10:30:00Z",
"content": "Article content..."
}
]
}
Error Handling
Common error codes:
- 400 Bad Request - Invalid parameters
- 401 Unauthorized - Invalid or missing API key
- 429 Too Many Requests - Rate limit exceeded
- 500 Server Error - News API service issue
Security Best Practices
- Never commit API keys: Store in environment variables
- Use HTTPS only: All API calls use HTTPS
- Monitor usage: Check rate limits regularly
- Rotate keys: Change API keys periodically
- Restrict domains: Configure allowed domains in News API dashboard
- Use proxies: Consider caching responses to reduce API calls
API Documentation
For detailed information about News API:
Use Cases
- News Aggregation: Build custom news dashboards
- Market Research: Monitor industry trends and competitors
- Content Curation: Discover trending topics and stories
- Sentiment Analysis: Analyze news sentiment for brands
- Breaking News Alerts: Get real-time notifications
- Research Tools: Access historical news archives
- Media Monitoring: Track brand mentions and coverage
Limitations
- Free tier limited to 100 requests/day
- Historical data restricted based on plan
- Cannot mix 'sources' with 'country/category' in top-headlines
- Maximum 100 articles per request
- Some sources may require attribution
- Real-time news has 15-minute delay on free tier