Skip to main content
Glama
Mediastack News MCP Server

Mediastack News MCP Server

by rftsngl

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.

Related MCP server: GNews API MCP Server

πŸš€ Installation

  1. Clone this repository:

    git clone <repository-url>
    cd NewsMCP_with_MediastackAPI
  2. Install the required Python packages:

    pip install -r requirements.txt

βš™οΈ Configuration

This server requires a Mediastack API key to function.

  1. Get a free API key from mediastack.com.

  2. Create a file named .env in the project's root directory.

  3. 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

  1. Push this repository to GitHub.

  2. Connect your GitHub repository to Smithery.ai.

  3. Smithery will automatically detect the smithery.yaml configuration.

  4. Set your MEDIASTACK_API_KEY in Smithery's environment variables.

  5. 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.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables access to News Api14 for searching and retrieving news articles, publishers, and trending topics with filtering by country, language, category, and date.
      8
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Provides access to global news articles from over 60,000 sources through the GNews API. Supports keyword search, category browsing, and language customization.
      2
      7 npm
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides access to the GNews API for searching news articles and retrieving top headlines with advanced filtering options.
      -