Skip to main content
Glama
jalaj-pandey

Weather MCP Tool

by jalaj-pandey

Wetter-MCP-Tool (auf Indien ausgerichtet)

Ein MCP-Server (Model Context Protocol), der die OpenWeatherMap-API verwendet, um Folgendes bereitzustellen:

  • Wetterbedingungen in Echtzeit

  • 5-Tage-Wettervorhersagen

  • Luftqualitätsdaten

  • Standortsuche


🚀 Einrichtung

  1. Python 3.10+ ist erforderlich.

  2. Installieren Sie Abhängigkeiten:

    pip install -r requirements.txt
  3. Holen Sie sich einen API-Schlüssel von OpenWeatherMap .

  4. Erstellen Sie eine im Stammordner:

    OPENWEATHER_API_KEY=your_api_key_here

Related MCP server: Weather Query MCP Server

🛠 Verfügbare Tools

get_current_weather(location: str)

Gibt das aktuelle Wetter für einen bestimmten Ort zurück.

get_weather_forecast(location: str, days: int = 5)

Gibt eine Wettervorhersage (bis zu 5 Tage) für den Standort zurück.

get_air_quality(location: str)

Gibt Messwerte zur Luftqualität und den AQI-Wert zurück.

search_location(query: str)

Gibt basierend auf der Abfrage bis zu 5 Standortübereinstimmungen zurück.


🧪 Beispielausgabe (Indien)

Aktuelles Wetter (Delhi)

{
  "location": {
    "name": "Delhi",
    "country": "IN",
    "lat": 28.6139,
    "lon": 77.2090
  },
  "temperature": {
    "current": 32.4,
    "feels_like": 35.1,
    "min": 30.0,
    "max": 36.2
  },
  "weather_condition": {
    "main": "Haze",
    "description": "smoky haze",
    "icon": "50d"
  },
  "wind": {
    "speed": 4.1,
    "deg": 135
  },
  "clouds": 20,
  "humidity": 58,
  "pressure": 1005,
  "visibility": 5000,
  "sunrise": "2025-03-16T06:20:00",
  "sunset": "2025-03-16T18:40:00",
  "timestamp": "2025-03-16T14:30:00"
}

Wettervorhersage (Mumbai)

{
  "location": {
    "name": "Mumbai",
    "country": "IN",
    "lat": 19.0760,
    "lon": 72.8777
  },
  "forecast": [
    {
      "datetime": "2025-03-16T12:00:00",
      "temperature": {
        "temp": 33.2,
        "feels_like": 37.8,
        "min": 31.5,
        "max": 34.0
      },
      "weather_condition": {
        "main": "Clouds",
        "description": "scattered clouds",
        "icon": "03d"
      },
      "wind": {
        "speed": 3.9,
        "deg": 200
      },
      "clouds": 40,
      "humidity": 70,
      "pressure": 1008,
      "visibility": 10000,
      "pop": 0.1
    }
  ],
  "days": 5
}

Luftqualität (Bangalore)

{
  "location": {
    "name": "Bengaluru",
    "country": "IN",
    "lat": 12.9716,
    "lon": 77.5946
  },
  "air_quality_index": 2,
  "air_quality_level": "Fair",
  "components": {
    "co": 102.4,
    "no": 0.0,
    "no2": 12.6,
    "o3": 30.5,
    "so2": 3.8,
    "pm2_5": 45.1,
    "pm10": 60.2,
    "nh3": 1.5
  },
  "timestamp": "2025-03-16T14:30:00"
}

Standortsuche

{
  "results": [
    {
      "name": "Kolkata",
      "state": "West Bengal",
      "country": "IN",
      "lat": 22.5726,
      "lon": 88.3639
    },
    {
      "name": "Kolkata",
      "state": "",
      "country": "IN",
      "lat": 22.5675,
      "lon": 88.3700
    }
  ]
}

🧰 Fehlerbehandlung

Alle Tools liefern eindeutige Fehlermeldungen:

{ "error": "Location 'XYZ' not found" }

📌 Notizen

  • Stellen Sie sicher, dass .env Datei richtig konfiguriert ist.

  • Die Aktivierung von API-Schlüsseln kann einige Zeit in Anspruch nehmen.

  • Kostenlose Stufe von OpenWeatherMap: 60 API-Aufrufe pro Minute.


🧑‍💻 Führen Sie den Server aus

mcp dev main.py

Sobald dieser Server läuft, können Sie ihn mit MCP-kompatiblen Clients wie Claude Desktop oder anderen Automatisierungstools verwenden.


-
security - not tested
F
license - not found
-
quality - not tested

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/jalaj-pandey/Weather-MCP-Tool'

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