Provides access to US National Weather Service (NWS) data, allowing retrieval of weather alerts by state and weather forecasts for specific coordinates.
WeatherMCP
This project is an MCP server built as a hands-on exercise. It provides weather data and alerts from the US National Weather Service (NWS) via a simple API using the FastMCP framework.
Features
- Weather Alerts: Get active weather alerts for any US state.
- Forecast: Retrieve weather forecasts for a specific latitude and longitude.
Requirements
- Python 3.8+
- uv (for dependency management and running)
Installation
- Install dependencies using uv:Or, if you use
pyproject.toml
: - (Optional) Create a virtual environment:
Running the MCP Server
To start the server using uv
:
The server will start and listen for MCP requests via stdio.
Available Tools
1. get_alerts(state: str)
- Description: Get active weather alerts for a US state.
- Argument:
state
— Two-letter US state code (e.g.,CA
,NY
). - Returns: Formatted string of current alerts or a message if none are found.
2. get_forecast(latitude: float, longitude: float)
- Description: Get weather forecast for a specific location.
- Arguments:
latitude
— Latitude of the location (float)longitude
— Longitude of the location (float)
- Returns: Formatted string with the next 5 forecast periods.
Notes
- This project is for educational and hands-on purposes.
- Data is sourced from the National Weather Service API.
Feel free to extend or modify the project for your own experiments!
An MCP server providing US National Weather Service data with tools to fetch weather alerts by state and forecasts by coordinates.
Related MCP Servers
- -securityFlicense-qualityThis SSE-based MCP server allows users to connect and interact with National Weather Service APIs to retrieve weather alerts and forecasts.Last updated -293Python
- -securityFlicense-qualityThis is a Model Context Protocol (MCP) server that provides weather information using the National Weather Service (NWS) API. Features Get weather alerts for a US state Get weather forecast for a specific location (using latitude and longitude)Last updated -Python
- -securityFlicense-qualityA Model Control Protocol (MCP) based service that allows users to query weather forecasts by coordinates and receive weather alerts for U.S. states.Last updated -4Python
- -securityFlicense-qualityAn MCP server that provides weather information like forecasts and alerts for US locations using the National Weather Service API.Last updated -2JavaScript