salman-aziz-4425/weather-mcp
If you are the rightful owner of weather-mcp 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.
An MCP server providing weather data tools and resources using the National Weather Service API.
MCP Weather Project
An MCP (Model Context Protocol) server that provides weather data tools and resources using the National Weather Service API. The server includes weather alerts, forecasts, and a RAG-based search system for historical weather data.
Features
- Weather Alerts: Get active weather alerts for any US state
- Weather Forecasts: Retrieve detailed forecasts for any location using latitude and longitude
- Historical Search: Search stored weather data using RAG (Retrieval Augmented Generation)
- Data Storage: Automatically stores all fetched weather data for future reference
- MCP Resources: Access stored alerts, forecasts, and recent weather data through MCP resources
Installation
- Ensure you have Python 3.13+ installed
- Install dependencies using
uv:
uv sync
Usage
Running the Server
Start the MCP server:
uv run python main.py
Available Tools
get_alerts(state: str)
Retrieves active weather alerts for a US state. Provide a two-letter state code (e.g., "CA", "NY", "TX").
get_forecast(latitude: float, longitude: float)
Gets a detailed weather forecast for a specific location. Provide latitude and longitude coordinates.
search_weather_history(query: str, limit: int = 5)
Searches through stored weather data using keyword matching. Returns up to limit results matching the query.
Available Resources
weather://alerts- Lists all stored weather alertsweather://forecasts- Lists all stored weather forecastsweather://recent- Shows recent weather data entries
Testing
Run the test script to verify the server is working:
uv run python test_server.py
Project Structure
main.py- Main MCP server entry pointweather.py- Weather tool implementationsstorage.py- Data storage and RAG search functionalityutils.py- Utility functions for API requeststest_server.py- Test script for the MCP serverweather_data.json- JSON file storing weather data
Dependencies
fastapi[standard]- Web frameworkhttpx- HTTP client for API requestsmcp[cli]- Model Context Protocol implementation
License
This project is provided as-is for educational and development purposes.