AllNewsAPI MCP
Enables LLMs to search for news articles, get top headlines, and access comprehensive news data with advanced filtering options through AllNewsAPI.
README
AllNewsAPI MCP
A Model Context Protocol (MCP) server that provides news data capabilities using AllNewsAPI. This server enables LLMs to search for news articles, get top headlines, and access comprehensive news data with advanced filtering options.
Key Features
- Comprehensive news search. Access news articles with advanced filtering by date, language, country, category, and more.
- Real-time headlines. Get the latest top headlines from around the world with customizable parameters.
- LLM-optimized responses. Clean, formatted output designed for easy consumption by language models.
Requirements
- Node.js 18 or newer
- AllNewsAPI key (get one at allnewsapi.com)
- VS Code, Cursor, Windsurf, Claude Desktop, or any other MCP client
Getting started
First, get your API key from AllNewsAPI and install the AllNewsAPI MCP server with your client.
Standard config works in most of the tools:
{
"mcpServers": {
"allnewsapi": {
"command": "npx",
"args": [
"allnewsapi-mcp@latest",
"--apikey",
"YOUR_API_KEY_HERE"
]
}
}
}
<details> <summary>Claude Desktop</summary>
Follow the MCP install guide, use the standard config above, or configure with environment variable:
{
"mcpServers": {
"allnewsapi": {
"command": "npx",
"args": ["allnewsapi-mcp@latest"],
"env": {
"ALLNEWSAPI_KEY": "YOUR_API_KEY_HERE"
}
}
}
}
</details>
<details> <summary>Cursor</summary>
Go to Cursor Settings -> MCP -> Add new MCP Server. Name it "AllNewsAPI", use command type with the command npx allnewsapi-mcp@latest --apikey YOUR_API_KEY_HERE. You can also verify config or add command arguments via clicking Edit.
</details>
<details> <summary>VS Code</summary>
Follow the MCP install guide, use the standard config above. You can also install the AllNewsAPI MCP server using the VS Code CLI:
# For VS Code
code --add-mcp '{"name":"allnewsapi","command":"npx","args":["allnewsapi-mcp@latest","--apikey","YOUR_API_KEY_HERE"]}'
After installation, the AllNewsAPI MCP server will be available for use with your GitHub Copilot agent in VS Code.
</details>
<details> <summary>Windsurf</summary>
Follow Windsurf MCP documentation. Use the standard config above.
</details>
Configuration
The AllNewsAPI MCP server supports the following configuration options:
API Key Configuration
You can provide your AllNewsAPI key in two ways:
- Command-line argument (recommended for most setups):
npx allnewsapi-mcp@latest --apikey YOUR_API_KEY_HERE
- Environment variable:
export ALLNEWSAPI_KEY=YOUR_API_KEY_HERE
npx allnewsapi-mcp@latest
Local Installation
If you want to install and run the server locally:
# Clone the repository
git clone https://github.com/AllNewsAPI/mcp-server.git
cd mcp-server
# Install dependencies
npm install
# Build the project
npm run build
# Run the server
node build/index.js --apikey YOUR_API_KEY_HERE
Tools
<details> <summary><b>News search and headlines</b></summary>
-
search-news
- Title: Search news articles
- Description: Search for news articles using various parameters including keywords, date ranges, and filters
- Parameters:
q(string, optional): Keywords to search for in news articlesstartDate(string, optional): Filter articles published on or after this date (YYYY-MM-DD format)endDate(string, optional): Filter articles published on or before this date (YYYY-MM-DD format)content(boolean, optional): Whether to retrieve full article content (default: false)lang(string, optional): Language code(s) of the articles (e.g., 'en', 'fr', 'de')country(string, optional): Country code(s) of publication (e.g., 'us', 'gb', 'ca')region(string, optional): Region(s) to filter by (e.g., 'americas', 'europe', 'asia')category(string, optional): Category/categories to filter by (e.g., 'business', 'technology', 'sports')max(number, optional): Number of articles to return, 1-100 (default: 5)attributes(string, optional): Where to search for keywords: 'title', 'description', 'content' (default: 'title,description')page(number, optional): Page number for pagination (default: 1)sortby(string, optional): Sort results by 'publishedAt' or 'relevance' (default: 'publishedAt')publisher(string, optional): Filter by specific publisher(s)
- Read-only: true
-
headlines
- Title: Get top headlines
- Description: Get top headlines with optional filtering by country, category, and language
- Parameters:
country(string, optional): Country code(s) of publication (e.g., 'us', 'gb', 'ca')category(string, optional): Category to filter by (e.g., 'business', 'technology', 'sports')max(number, optional): Number of articles to return, 1-100 (default: 5)lang(string, optional): Language code of the articles (e.g., 'en', 'fr', 'de')
- Read-only: true
</details>
Supported Parameters
<details> <summary><b>Languages</b></summary>
The following language codes are supported:
ar, zh, nl, en, fr, de, el, he, hi, it, ja, ml, mr, no, pt, ro, ru, es, sv, ta, te, uk
</details>
<details> <summary><b>Categories</b></summary>
The following categories are supported:
adult, autos, beauty, business, communities, crime, cryptocurrency, electronics, entertainment, finance, food, games, health, hobbies, lifestyle, internet, jobs, law, literature, pets, politics, realty, science, sensitive, shopping, society, sports, technology, travel
</details>
<details> <summary><b>Regions</b></summary>
The following regions are supported:
africa, americas, antarctic, asia, europe, oceania
</details>
<details> <summary><b>Countries</b></summary>
The API supports numerous country codes including:
us(United States)gb(United Kingdom)ca(Canada)au(Australia)de(Germany)fr(France)jp(Japan)in(India)- And many more...
The server validates all country codes against the official list from AllNewsAPI.
</details>
Example Usage
Once you have connected your MCP client to the AllNewsAPI server, you can ask natural language queries like:
- "Get me the latest technology news from the US"
- "Find news articles about climate change from European sources"
- "Show me top business headlines from the past week"
- "Search for cryptocurrency news in English from the last month"
- "Get sports headlines from Canada and Australia"
The server will validate all parameters, connect to the AllNewsAPI, and return formatted results that are easy to read and understand.
Error Handling
The server includes comprehensive error handling:
- API Key validation: Clear error messages if no API key is provided
- Parameter validation: All parameters are validated against official AllNewsAPI supported values
- Network error handling: Graceful handling of API connection issues
- Rate limit handling: Proper error messages for API rate limits
Technical Implementation
The server is built with TypeScript and the Model Context Protocol SDK. Key features include:
- ES module support with top-level await
- Comprehensive error handling with informative messages
- Parameter validation against official supported values
- Clean formatting of API responses for LLM consumption
- Flexible configuration supporting multiple API key methods
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。