Mediastack News Server
Provide up-to-date news retrieval and source listing capabilities by integrating the Mediastack News API as MCP tools. Enable agents to fetch the latest news stories with flexible filtering and access comprehensive news source information. Simplify news data access for MCP-compatible platforms with easy deployment and configuration.
Ask AI about Mediastack News Server
Powered by Claude Β· Grounded in docs
I know everything about Mediastack News Server. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Mediastack News MCP Server
A FastMCP server that exposes the Mediastack News API as MCP (Model Context Protocol) tools. This server can be used as a plug-and-play backend for Smithery.ai or any other MCP-compatible agent platform.
β¨ Features
get_latest_news: Fetches the most recent news stories with various filtering options.get_sources: Lists available news sources with filtering capabilities.
π Installation
-
Clone this repository:
git clone <repository-url> cd NewsMCP_with_MediastackAPI -
Install the required Python packages:
pip install -r requirements.txt
βοΈ Configuration
This server requires a Mediastack API key to function.
- Get a free API key from mediastack.com.
- Create a file named
.envin the project's root directory. - Add your API key to this file in the following format:
MEDIASTACK_API_KEY=your_api_key_here
The server will automatically load this environment variable when a tool is called.
π» Running Locally
To start the MCP server, run the following command:
python server.py
By default, the server will start on http://0.0.0.0:8080.
π οΈ Available Tools
1. get_latest_news
Fetches the most recent news stories from Mediastack.
Parameters:
keywords(Optional): Search terms to filter news.sources(Optional): News sources, comma-separated (e.g., "cnn,bbc").countries(Optional): Country codes, comma-separated (e.g., "us,gb").languages(Optional): Language codes, comma-separated (e.g., "en,fr").categories(Optional): News categories, comma-separated.date(Optional): A specific date or date range (YYYY-MM-DD).sort(Optional): Sort order (published_desc,published_asc,popularity).limit(Optional): Maximum number of results to return (default: 25, max: 100).offset(Optional): Pagination offset.
2. get_sources
Lists available news sources from Mediastack.
Parameters:
search(Optional): A search term to filter sources.sources(Optional): Specific sources, comma-separated.countries(Optional): Country codes, comma-separated.languages(Optional): Language codes, comma-separated.categories(Optional): News categories, comma-separated.limit(Optional): Maximum number of results to return (default: 25, max: 100).offset(Optional): Pagination offset.
βοΈ Deployment on Smithery.ai
- Push this repository to GitHub.
- Connect your GitHub repository to Smithery.ai.
- Smithery will automatically detect the
smithery.yamlconfiguration. - Set your
MEDIASTACK_API_KEYin Smithery's environment variables. - Deploy and start using the MCP tools.
For more information, visit the Smithery.ai Documentation.
π Project Structure
.
βββ app.py # MCP tool definitions
βββ server.py # FastMCP server setup
βββ requirements.txt # Python dependencies
βββ smithery.yaml # Smithery deployment configuration
βββ Dockerfile # Instructions for building a Docker image
βββ LICENSE # Project license
βββ .env # (Local) Environment variables
βββ README.md # This file
π License
This project is licensed under the MIT License.
