Weather MCP Server
by sirrupesh
A Model Context Protocol (MCP) server that provides weather information and alerts using the National Weather Service (NWS) API. It offers easy access to weather data and alerts for various locations.
Last updated: N/A
Weather MCP Server
A Model Context Protocol (MCP) server that provides weather information and alerts using the National Weather Service (NWS) API.
Features
- Get weather alerts for any US state
- Get detailed weather forecasts for any location using latitude and longitude
- Easy-to-use MCP interface
- Docker support for easy deployment
Prerequisites
- Python 3.13 or higher
- Docker and Docker Compose (for containerized deployment)
Installation
Local Development
- Clone the repository
- Install dependencies using
uv
:pip install uv uv venv uv pip install . uv run src/main.py
Docker Deployment
Simply use Docker Compose to build and run the server:
docker compose up -d
The server endpoint will be available at http://localhost:8001/sse
.
Available Tools
get_alerts(state: str)
Get active weather alerts for a US state.
Parameters:
state
: Two-letter US state code (e.g., "CA" for California, "NY" for New York)
get_forecast(latitude: float, longitude: float)
Get detailed weather forecast for a specific location.
Parameters:
latitude
: Latitude of the locationlongitude
: Longitude of the location
Development
The project uses Docker volumes for development, allowing code changes to be reflected without rebuilding the container. The source code is mounted at /app/src
in the container.
Technical Details
- Built with Python's MCP framework
- Uses httpx for async HTTP requests
- Implements proper error handling and request timeouts
- Uses uv for dependency management
- Containerized with Docker for easy deployment
Environment Variables
PYTHONUNBUFFERED=1
: Ensures Python output is sent directly to the terminal without buffering
Port
The server runs on port 8000 inside the container and is mapped to port 8001 on the host machine.