A weather service that provides current weather and forecasts for US and Canadian cities.
- Install dependencies using uv:
uv pip install python-dotenv httpxNote: Project uses uv for dependency management. The dependencies are already specified in pyproject.toml and locked in uv.lock.
- Create a
.envfile from the example:
cp .env.example .env- Add your OpenWeather API key to the
.envfile:
OPENWEATHER_API_KEY=your_api_key_here
The service provides two main tools:
- Get current weather:
# With country code
await get_current_weather("Toronto", country="CA")
await get_current_weather("New York", country="US")
# Without country code
await get_current_weather("Chicago")- Get forecast:
# 5-day forecast with country code
await get_forecast("Vancouver", days=5, country="CA")
await get_forecast("Seattle", days=3, country="US")
# Without country code
await get_forecast("Chicago", days=2)The service returns JSON-formatted responses with weather information:
{
"location": "Toronto, CA",
"conditions": "Clear Sky",
"temperature": "20°C",
"feels_like": "18°C",
"humidity": "65%",
"wind_speed": "5.2 m/s",
"pressure": "1013 hPa"
}{
"forecasts": [
{
"date": "2025-01-26",
"conditions": "Partly Cloudy",
"temperature": "22°C",
"feels_like": "20°C",
"humidity": "70%",
"wind_speed": "4.1 m/s"
}
]
}The project uses:
- uv for Python package management
- python-dotenv for environment variable management
- httpx for async HTTP requests
- FastMCP for MCP server implementation