Skip to main content
Glama
Amankhan1009

AI Weather MCP Server

by Amankhan1009

๐ŸŒฆ๏ธ AI Weather MCP Server

Python MCP FastMCP Docker Tests License

A production-grade Model Context Protocol (MCP) server that combines real-time weather data with LLM-powered reasoning to deliver intelligent weather insights instead of raw numbers.

Built to demonstrate production backend engineering, clean architecture, MCP development, external API integration, asynchronous programming, Dockerization, testing, and AI reasoning.


โœจ Features

๐ŸŒค Weather Tools

  • Current Weather

  • Weather Forecast

  • Air Quality

  • UV Index

  • Sunrise & Sunset

Related MCP server: Ingrids Reisetjenester

๐Ÿค– AI Tools

  • Clothing Recommendation

  • Weather Summary

  • Travel Advice

  • Outdoor Activity Recommendation

  • AI Weather Advisory

The guiding principle is:

Weather APIs provide facts. The LLM provides reasoning.

The model never invents weather information.


๐Ÿ— Architecture

MCP Client
     โ”‚
     โ–ผ
MCP Tools
     โ”‚
     โ–ผ
Services
     โ”‚
     โ–ผ
Clients
 โ”œโ”€โ”€ Weather APIs
 โ””โ”€โ”€ LLM Provider

Each layer has a single responsibility.


๐Ÿ“‚ Project Structure

src/weather_mcp/
โ”œโ”€โ”€ server.py
โ”œโ”€โ”€ config.py
โ”œโ”€โ”€ logging_config.py
โ”œโ”€โ”€ exceptions.py
โ”œโ”€โ”€ models/
โ”œโ”€โ”€ clients/
โ”œโ”€โ”€ services/
โ””โ”€โ”€ tools/

๐Ÿง  Design Decisions

Two Weather Providers

The project combines OpenWeatherMap with Open-Meteo.

OpenWeatherMap supplies current weather, forecast and air-quality data.

Open-Meteo is used for UV Index because it remains free without requiring a paid One Call subscription.


AI Weather Advisory

get_weather_alerts() intentionally produces an AI-generated advisory.

It is not an official government weather warning.

Instead, the LLM reasons over forecast information to identify potentially concerning conditions such as:

  • Heavy rain

  • Strong winds

  • High temperatures

  • Thunderstorms


Swappable LLM

The LLM layer is isolated.

Changing from Groq to OpenAI only requires configuration rather than application changes.


โš™๏ธ Installation

git clone <repository-url>

cd weather-mcp-server

python3 -m venv .venv
source .venv/bin/activate

pip install -e ".[dev]"

๐Ÿ”‘ Configuration

Copy:

cp .env.example .env

Configure your API keys.

Variable

Description

WEATHER_API_KEY

OpenWeatherMap key

LLM_API_KEY

Groq/OpenAI key

LLM_PROVIDER

groq/openai

LLM_MODEL

Model name


โ–ถ Running

python3 -m weather_mcp.server

๐Ÿณ Docker

docker build -t weather-mcp-server .

docker run -i --env-file .env weather-mcp-server

Pull the pre-built image directly:

```bash docker pull amankhan1009/weather-mcp-server:latest docker run -i --env-file .env amankhan1009/weather-mcp-server:latest ```

Or build it yourself:

```bash docker build -t weather-mcp-server . docker run -i --env-file .env weather-mcp-server ```

๐Ÿงช Testing

pytest

The suite uses mocked external services for deterministic tests.


๐Ÿ”Œ MCP Clients

Compatible with:

  • Claude Desktop

  • MCP Inspector

  • Any MCP-compatible client


๐Ÿ“ˆ Future Improvements

  • Official severe weather alerts

  • Additional LLM providers

  • Response caching

  • Streaming responses

  • Structured JSON outputs


๐Ÿ‘จโ€๐Ÿ’ป Author

Md Aman Alam

LinkedIn: Md Aman Alam

If you found this project useful, consider giving it a โญ on GitHub.

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

โ€“Maintainers
โ€“Response time
โ€“Release cycle
โ€“Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Amankhan1009/weather-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server