GnistAI GnistAI
Log in

Getting Started with Open-Meteo (Weather)

Current weather, forecasts, historical data, and severe weather alerts.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Environment

Data source: Open-Meteo, NWS

Overview

Open-Meteo (Weather) wraps Open-Meteo, NWS, handling authentication, pagination, and rate limits for you. This tutorial covers all 8 tools with working code examples you can copy and run.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-open-meteo": {
      "url": "https://context.gnist.ai/mcp/open-meteo/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (8)

geocode_location

Search for a city or place name and return matching coordinates. Use this tool first to convert a place name into latitude/longitude coordinates, then pass those coordinates to the weather, air quality, or marine forecast tools. Returns matching locations with name, coordinates, country, population, and timezone.

ParameterTypeRequiredDescription
namestringrequiredCity or place name to search for (e.g. "Oslo", "New York", "Tokyo").
countintegeroptionalMaximum number of results to return (1-100). Default 5. (default: 5)
languagestringoptionalResponse language as ISO 639-1 code (e.g. 'en', 'de', 'fr'). Default 'en'. (default: en)
curl -X POST "https://context.gnist.ai/mcp/open-meteo/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "geocode_location", "arguments": {"name": "Oslo"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/open-meteo/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'name': 'Oslo'}, 'name': 'geocode_location'}},
)
print(resp.json())

get_current_weather

Get current weather conditions at a location. Returns current temperature, humidity, wind, precipitation, and description. Weather descriptions follow the WMO Weather Interpretation Code standard.

ParameterTypeRequiredDescription
latnumberrequiredLatitude of the location (-90 to 90).
lonnumberrequiredLongitude of the location (-180 to 180).
unitsstringoptionalUnit system: "metric" (C, m/s, mm) or "imperial" (F, mph, inch). (default: metric)
curl -X POST "https://context.gnist.ai/mcp/open-meteo/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_current_weather", "arguments": {"lat": 59.91, "lon": 10.75}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/open-meteo/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'lat': 59.91, 'lon': 10.75},
            'name': 'get_current_weather'}},
)
print(resp.json())

get_weather_forecast

Get hourly weather forecast for a location. Returns hourly forecast entries with temperature, precipitation probability, wind, and weather description for each hour. Up to 7 days (168 hours).

ParameterTypeRequiredDescription
latnumberrequiredLatitude of the location (-90 to 90).
lonnumberrequiredLongitude of the location (-180 to 180).
hoursintegeroptionalNumber of hours to forecast (1-168, default 24). (default: 24)
unitsstringoptionalUnit system: "metric" (C, m/s, mm) or "imperial" (F, mph, inch). (default: metric)
curl -X POST "https://context.gnist.ai/mcp/open-meteo/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_weather_forecast", "arguments": {"lat": 59.91, "lon": 10.75}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/open-meteo/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'lat': 59.91, 'lon': 10.75},
            'name': 'get_weather_forecast'}},
)
print(resp.json())

get_alerts

Get active severe weather alerts for a location. Currently covers the United States via the National Weather Service (NWS) API. Returns an empty list for non-US coordinates.

ParameterTypeRequiredDescription
latnumberrequiredLatitude of the location (-90 to 90).
lonnumberrequiredLongitude of the location (-180 to 180).
curl -X POST "https://context.gnist.ai/mcp/open-meteo/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_alerts", "arguments": {"lat": 59.91, "lon": 10.75}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/open-meteo/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'lat': 59.91, 'lon': 10.75}, 'name': 'get_alerts'}},
)
print(resp.json())

get_historical_weather

Get historical weather data for a location and date range. Draws from the ERA5 climate reanalysis archive, covering 1940-01-01 to approximately 5 days before the current date. Returns daily summaries with max/min/mean temperature, precipitation, and wind speed.

ParameterTypeRequiredDescription
latnumberrequiredLatitude of the location (-90 to 90).
lonnumberrequiredLongitude of the location (-180 to 180).
start_datestringrequiredStart of the date range, format YYYY-MM-DD (earliest: 1940-01-01).
end_datestringrequiredEnd of the date range, format YYYY-MM-DD (latest: ~5 days ago).
unitsstringoptionalUnit system: "metric" (C, m/s, mm) or "imperial" (F, mph, inch). (default: metric)
curl -X POST "https://context.gnist.ai/mcp/open-meteo/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_historical_weather", "arguments": {"lat": 59.91, "lon": 10.75, "start_date": "2025-01-15", "end_date": "2025-01-15"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/open-meteo/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'end_date': '2025-01-15',
                          'lat': 59.91,
                          'lon': 10.75,
                          'start_date': '2025-01-15'},
            'name': 'get_historical_weather'}},
)
print(resp.json())

get_air_quality

Get air quality forecast for a location. Returns hourly air quality data including European AQI, US AQI, PM2.5, PM10, carbon monoxide, nitrogen dioxide, sulphur dioxide, and ozone. AQI scales: - European AQI: 0-20 Good, 20-40 Fair, 40-60 Moderate, 60-80 Poor, 80-100 Very Poor, 100+ Extremely Poor - US AQI: 0-50 Good, 51-100 Moderate, 101-150 Unhealthy (sensitive), 151-200 Unhealthy, 201-300 Very Unhealthy

ParameterTypeRequiredDescription
latnumberrequiredLatitude of the location (-90 to 90).
lonnumberrequiredLongitude of the location (-180 to 180).
hoursintegeroptionalNumber of hours to forecast (1-120, default 24). (default: 24)
curl -X POST "https://context.gnist.ai/mcp/open-meteo/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_air_quality", "arguments": {"lat": 59.91, "lon": 10.75}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/open-meteo/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'lat': 59.91, 'lon': 10.75},
            'name': 'get_air_quality'}},
)
print(resp.json())

get_marine_forecast

Get marine/ocean forecast for a coastal location. Returns hourly wave data including total wave height, direction, and period, as well as separate wind-wave and swell components. Best for coastal and offshore locations; inland locations may return null values.

ParameterTypeRequiredDescription
latnumberrequiredLatitude of the coastal location (-90 to 90).
lonnumberrequiredLongitude of the coastal location (-180 to 180).
hoursintegeroptionalNumber of hours to forecast (1-168, default 24). (default: 24)
curl -X POST "https://context.gnist.ai/mcp/open-meteo/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_marine_forecast", "arguments": {"lat": 59.91, "lon": 10.75}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/open-meteo/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'lat': 59.91, 'lon': 10.75},
            'name': 'get_marine_forecast'}},
)
print(resp.json())

report_feedback

Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/open-meteo/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/open-meteo/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())

Common Patterns

Date range filtering
Use date range parameters to narrow results to a specific time window. Dates are typically in YYYY-MM-DD format.

FAQ

What data does Open-Meteo (Weather) provide?

Current weather, forecasts, historical data, and severe weather alerts. It exposes 8 tools: geocode_location, get_current_weather, get_weather_forecast, get_alerts, get_historical_weather, get_air_quality, get_marine_forecast, report_feedback.

What do I need to get started?

A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.

What format does the Open-Meteo (Weather) API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials