- Explore MCP Servers
- fastMCP-example
Fastmcp Example
What is Fastmcp Example
fastMCP-example is a simple MCP (Model Context Protocol) server built with FastMCP that fetches news articles using the NewsData.io API. It provides tools and resources to retrieve and format the latest news articles.
Use cases
Use cases include fetching news articles for specific topics, generating news summaries for newsletters, and integrating news data into applications for enhanced user engagement.
How to use
To use fastMCP-example, install the required dependencies, set up a virtual environment, and run the MCP server using the provided commands. You can also test it in development mode and attach it to the Claude Desktop app for enhanced functionality.
Key features
Key features include a Fetch News Tool for retrieving articles based on keywords, languages, and countries; a Structured Output Prompt for generating user-friendly lists of articles; and support for various metadata such as languages, countries, and categories.
Where to use
fastMCP-example can be used in various fields such as journalism, content curation, and research, where real-time news retrieval and formatting are essential.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Fastmcp Example
fastMCP-example is a simple MCP (Model Context Protocol) server built with FastMCP that fetches news articles using the NewsData.io API. It provides tools and resources to retrieve and format the latest news articles.
Use cases
Use cases include fetching news articles for specific topics, generating news summaries for newsletters, and integrating news data into applications for enhanced user engagement.
How to use
To use fastMCP-example, install the required dependencies, set up a virtual environment, and run the MCP server using the provided commands. You can also test it in development mode and attach it to the Claude Desktop app for enhanced functionality.
Key features
Key features include a Fetch News Tool for retrieving articles based on keywords, languages, and countries; a Structured Output Prompt for generating user-friendly lists of articles; and support for various metadata such as languages, countries, and categories.
Where to use
fastMCP-example can be used in various fields such as journalism, content curation, and research, where real-time news retrieval and formatting are essential.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
NewsData MCP Server
A simple MCP (Model Context Protocol) server built with FastMCP that fetches news articles using the NewsData.io API. This server provides tools, prompts, and resources to retrieve and format the latest news articles.
You can read the full Medium story at:
Features
- Fetch News Tool: Retrieve news articles based on a keyword, language, and country.
- Structured Output Prompt: Generate a user-friendly list of news articles with titles and links.
- Supported Resources: Provide metadata such as supported languages, countries, and categories.
Getting Started
Prerequisites
- Python 3.10 or later
- uv (required for deploying MCP servers)
- An API key from NewsData.io. Sign up for a free account to generate your API key.
Installation
-
Install
uv:brew install uv -
Set up a virtual environment:
python3 -m venv venv source venv/bin/activate -
Install FastMCP and other dependencies:
uv pip install fastmcp requests -
Clone or copy the project code into a file named
newsdata_mcp.py.
Usage
-
Run the MCP server:
uv run fastmcp install --with uvicorn --with requests newsdata_mcp.py -
Test the MCP server in development mode:
uv run fastmcp dev --with uvicorn --with requests newsdata_mcp.py -
Attach the MCP server to the Claude Desktop app for testing tools, prompts, and resources.
Tools, Prompts, and Resources
Tools
fetch_news
Fetch news articles based on a keyword, language, and country.
Parameters:
keyword(str): Search term for news articles.language(str): Language code (default:en).country(str): Country code (optional).
Example Usage in Claude:
“Tell me the news related to Artificial Intelligence in the United States.”
Prompts
fetch_news_prompt
Formats fetched news articles into a structured list of titles and links.
Example Usage in Claude:
- Attach the
fetch_news_prompttool from the MCP server. - Fill in:
- Keyword: Blockchain
- Language: en
- Country: us
- Submit and receive a
.jsonfile with the news articles.
Resources
newsapi://languages
Returns a list of supported language codes.
newsapi://countries
Returns a list of supported country codes.
newsapi://categories
Returns a list of supported news categories.
Example Usage in Claude:
Attach any resource to receive a .json file with metadata.
Code Overview
Key Functions
fetch_news: The main tool for retrieving news articles from the NewsData.io API.fetch_news_prompt: Formats the fetched articles into a readable list with titles and links.- Resources:
get_supported_languages: Supported language codes.get_supported_countries: Supported country codes.get_news_categories: Supported news categories.
References
Enjoy building with MCP and FastMCP!
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










