Skip to main content
Glama
bhargavkahar-pcom

Weather MCP Server

🌦️ Weather MCP Server (Python)

A high-performance Model Context Protocol (MCP) server providing real-time weather observations, hourly forecasts, multi-day daily forecasts, and air quality analysis for any location globally.

Built with Python and the official Model Context Protocol SDK (mcp / FastMCP), powered by the free and keyless Open-Meteo API.


✨ Features

  • 🌍 Global Geocoding: Automatically resolves city names, regions, countries, and landmarks to exact coordinates and timezones.

  • 🌑️ Current Weather: Real-time temperature, apparent ("feels-like") temperature, humidity, precipitation, cloud cover, wind speed & cardinal direction, and pressure.

  • πŸ“† Daily Forecasts: Up to 16-day forecasts with daily highs/lows, precipitation probabilities & volume, max UV index, and sunrise/sunset times.

  • ⏱️ Hourly Forecasts: Granular hour-by-hour forecast tables with rain chances, temperatures, and conditions.

  • πŸƒ Air Quality & UV: Comprehensive US & European AQI, PM2.5, PM10, Ozone, NOβ‚‚, SOβ‚‚, CO, dust levels, and health recommendations.

  • πŸ”’ Zero API Keys Required: Powered by Open-Meteo with no authentication or account needed.

  • ⚑ Async & Non-blocking: Uses httpx for fast, lightweight network requests.


Related MCP server: mcp-weather-plus

πŸ› οΈ MCP Tools Reference

1. get_current_weather

Fetch live weather conditions for any location.

  • Parameters:

    • location (str, required): City, region, or landmark (e.g. "Tokyo", "London", "San Francisco, US").

    • units (str, optional): Temperature unit β€” "celsius" (default) or "fahrenheit".

2. get_daily_forecast

Get a multi-day forecast breakdown.

  • Parameters:

    • location (str, required): City or landmark.

    • days (int, optional): Number of forecast days from 1 to 16 (default: 5).

    • units (str, optional): "celsius" (default) or "fahrenheit".

3. get_hourly_forecast

Get an hour-by-hour forecast.

  • Parameters:

    • location (str, required): City or landmark.

    • hours (int, optional): Number of hours ahead from 1 to 48 (default: 24).

    • units (str, optional): "celsius" (default) or "fahrenheit".

4. get_air_quality

Get current air quality, particulate concentrations, and UV index.

  • Parameters:

    • location (str, required): City or landmark.


πŸ“‹ MCP Prompts & Resources

  • Resource: weather://{location}/current β€” Dynamic resource to read current weather data.

  • Prompt: weather_briefing β€” Pre-built prompt to generate tailored morning, travel, or outdoor activity advisories.


πŸš€ Installation & Setup

Prerequisites

  • Python 3.10+

  • uv (recommended) or pip

1. Clone or Navigate to Project

cd C:\Users\Bhargav-Kahar\.gemini\antigravity\scratch\weather-mcp-server

2. Install Dependencies

Using uv:

uv venv
uv pip install -e .

Or using standard pip:

python -m venv .venv
.venv\Scripts\activate
pip install -e .

3. Run Verification Tests

.venv\Scripts\python test_server.py

πŸ”Œ MCP Client Configuration

Claude Desktop Configuration

Add the server to your Claude Desktop config file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "weather": {
      "command": "C:\\Users\\Bhargav-Kahar\\.gemini\\antigravity\\scratch\\weather-mcp-server\\.venv\\Scripts\\python.exe",
      "args": [
        "C:\\Users\\Bhargav-Kahar\\.gemini\\antigravity\\scratch\\weather-mcp-server\\weather_server.py"
      ]
    }
  }
}

Or using uv directly:

{
  "mcpServers": {
    "weather": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\Users\\Bhargav-Kahar\\.gemini\\antigravity\\scratch\\weather-mcp-server",
        "run",
        "weather_server.py"
      ]
    }
  }
}

Antigravity / Gemini MCP Configuration

In your workspace .agents/mcp_config.json or ~/.gemini/config/mcp_config.json:

{
  "mcpServers": {
    "weather": {
      "command": "C:\\Users\\Bhargav-Kahar\\.gemini\\antigravity\\scratch\\weather-mcp-server\\.venv\\Scripts\\python.exe",
      "args": [
        "C:\\Users\\Bhargav-Kahar\\.gemini\\antigravity\\scratch\\weather-mcp-server\\weather_server.py"
      ]
    }
  }
}

πŸ“‚ Project Structure

weather-mcp-server/
β”œβ”€β”€ pyproject.toml         # Package metadata and dependencies
β”œβ”€β”€ weather_server.py      # Main MCP server implementation
β”œβ”€β”€ test_server.py         # Automated verification test suite
└── README.md              # Documentation and client setup guide

πŸ“„ License

MIT License

Related MCP Connectors

Related MCP Servers