Handles environment variable configuration for API keys and server settings through the .env file.
Integration point for cloning the repository and accessing source code for setup and deployment.
Used for package management and running the MCP server, with configuration available for the author's NPM account.
Provides badge integration for displaying license, language, and protocol version information in the README.
Core language used for implementation with version 5.3+ support highlighted in the project badges.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@News MCP Serversearch for latest AI developments in French"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π° News MCP Server
A smart news search MCP (Model Context Protocol) server with automatic API switching for reliable news fetching. Never worry about API limits again!
β¨ Features
π Smart API Switching: Automatically switches between multiple news APIs when one reaches its limit
π Multiple Free APIs: Supports 5+ free news APIs with generous daily quotas
π Quota Management: Intelligent tracking of daily API usage limits
π Multi-language Support: Search news in 20+ languages
β‘ Fast & Reliable: Failover mechanism ensures you always get results
π οΈ Easy Setup: Simple configuration with environment variables
Related MCP server: MCP Server Firecrawl
π Quick Start
1. Installation
# Clone the repository
git clone https://github.com/guangxiangdebizi/news-mcp.git
cd news-mcp
# Install dependencies
npm install
# Copy environment template
cp .env.example .env2. API Configuration
Get free API keys from any of these services (you only need one, but more = better reliability):
Service | Daily Limit | Sign Up Link | Priority |
TheNewsAPI | Unlimited* | π₯ Highest | |
NewsData.io | ~200 requests | π₯ High | |
NewsAPI.org | 100 requests | π₯ Medium | |
GNews | 100 requests | π Medium | |
Twingly | Trial available | ποΈ Low |
*Claimed unlimited for free tier
3. Configure Environment
Edit .env file and add your API keys:
# Add at least one API key (more is better for reliability)
THE_NEWS_API_KEY=your_api_key_here
NEWSDATA_IO_KEY=your_api_key_here
NEWSAPI_ORG_KEY=your_api_key_here
GNEWS_API_KEY=your_api_key_here
TWINGLY_API_KEY=your_api_key_here4. Build & Run
# Build the project
npm run build
# Start the MCP server
npm start
# Or run in development mode
npm run devπ§ Usage
With Claude Desktop
Add to your Claude Desktop configuration:
Stdio Mode (Local Development):
{
"mcpServers": {
"news-mcp": {
"command": "node",
"args": ["path/to/news-mcp/build/index.js"]
}
}
}SSE Mode (Web Access):
# Start SSE server
npm run sse{
"mcpServers": {
"news-mcp": {
"type": "sse",
"url": "http://localhost:3100/sse",
"timeout": 600
}
}
}Available Tools
search_news
Search for news articles with automatic API switching.
Parameters:
query(required): Search keywords or topicslanguage(optional): Language code (default: "en")limit(optional): Number of articles (1-10, default: 5)
Example:
// Search for technology news
{
"query": "artificial intelligence",
"language": "en",
"limit": 5
}
// Search for Chinese news
{
"query": "η§ζζ°ι»",
"language": "zh",
"limit": 3
}π§ How Smart Switching Works
Priority Order: APIs are tried in order of reliability and quota limits
Quota Tracking: System tracks daily usage for each API
Automatic Failover: When an API fails or reaches limit, automatically tries the next one
Success Guarantee: Continues until successful response or all APIs exhausted
TheNewsAPI (β) β NewsData.io (200) β NewsAPI.org (100) β GNews (100) β Twingly (50)π Supported Languages
English (en) - All APIs
Chinese (zh) - Most APIs
Spanish (es) - Most APIs
French (fr) - Most APIs
German (de) - Most APIs
And 15+ more languages
π οΈ Development
Project Structure
src/
βββ index.ts # MCP server entry point
βββ config.ts # API configuration management
βββ tools/
βββ newsSearch.ts # Smart news search toolScripts
npm run build # Build TypeScript
npm run dev # Development mode with watch
npm start # Start built server
npm run sse # Start SSE server on port 3100Adding New APIs
Add API configuration to
src/config.tsImplement API-specific request logic in
src/tools/newsSearch.tsAdd environment variable to
.env.example
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)Open a Pull Request
π License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
π¨βπ» Author
Xingyu Chen
π Website: GitHub Profile
π§ Email: guangxiangdebizi@gmail.com
πΌ LinkedIn: Xingyu Chen
π¦ NPM: @xingyuchen
π Acknowledgments
Model Context Protocol for the amazing MCP framework
All the news API providers for their generous free tiers
The open-source community for inspiration and support
β If this project helped you, please give it a star!