bharathveerB/MCP-Server-WeatherAPI_to_Claude
If you are the rightful owner of MCP-Server-WeatherAPI_to_Claude and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The MCP Weather Service is a Model Control Protocol server that provides weather-related tools, including alerts and forecasts, using the National Weather Service API.
MCP Weather Service
A Model Control Protocol (MCP) server that provides weather-related tools including weather alerts and forecasts using the National Weather Service (NWS) API.
Features
- MCP Tools:
get_alerts: Retrieve weather alerts for any US stateget_forecast: Get detailed weather forecasts by coordinates
- MCP Integration:
- Built with FastMCP framework
- Asynchronous operation support
- Type-annotated interfaces
- Self-documenting tools
Screenshot

Getting Started
Prerequisites
- Python 3.8+
- pip (Python package manager)
- An internet connection (for API access)
Installation
-
Clone the repository:
git clone <repository-url> cd weather -
Create and activate a virtual environment (recommended):
python -m venv .venv .venv\Scripts\activate # On Windows -
Install the required dependencies:
pip install -e .
Usage
Available Commands
-
Get Weather Alerts
from weather import get_alerts # Get alerts for California alerts = await get_alerts("CA") print(alerts) -
Get Weather Forecast
from weather import get_forecast # Get forecast for New York City forecast = await get_forecast(40.7128, -74.0060) print(forecast)
API Reference
get_alerts(state: str) -> str
Get weather alerts for a US state.
state: Two-letter US state code (e.g., 'CA', 'NY')
get_forecast(latitude: float, longitude: float) -> str
Get weather forecast for specific coordinates.
latitude: Latitude of the locationlongitude: Longitude of the location
MCP Implementation
Project Structure
weather.py: Main MCP server implementation with tool definitionsmain.py: MCP server entry pointpyproject.toml: Project configuration with MCP dependencies
MCP Tools
get_alerts(state: str) -> str
Fetches active weather alerts for a US state.
Parameters:
state: Two-letter US state code (e.g., 'CA', 'NY')
Returns: Formatted string containing active weather alerts
get_forecast(latitude: float, longitude: float) -> str
Retrieves weather forecast for specific coordinates.
Parameters:
latitude: Latitude of the locationlongitude: Longitude of the location
Returns: Formatted weather forecast information
MCP Dependencies
fastmcp: Core MCP server implementationhttpx: Async HTTP client for API requestspydantic: For data validation and settings management