MCP Server for Swiss weather and climate data โ MeteoSwiss SwissMetNet, ICON forecasts, climate normals
Project description
๐ฆ๏ธ meteoswiss-mcp
MCP server for Swiss weather and climate data from MeteoSwiss.
Connects AI models to the SwissMetNet measurement network (160+ stations, 10-minute interval), MeteoSwiss ICON-CH1/CH2-EPS forecasts and climate normals 1991โ2020. Part of the swiss-public-data-mcp portfolio.
๐ฉ๐ช Deutsche Version
Demo query (anchor example)
How suitable is next Wednesday for the sports day at Leutschenbach school?
โ meteo_school_check(location="Zรผrich Oerlikon", activity="Sporttag") returns a ๐ข/๐ก/๐ด traffic light for each day of the coming week โ straight from the MeteoSwiss ICON model.
Combined with swiss-environment-mcp:
How were air quality and weather at Leutschenbach school yesterday?
โ meteo_current(station='REH') + env_nabel_current(station='ZUE') = a complete environmental picture.
โ More use cases by audience โ
Tools (6)
| Tool | Description | Data source |
|---|---|---|
meteo_stations |
List SwissMetNet stations (filterable by canton) | Embedded |
meteo_current |
Current 10-min observations for a station | BGDI STAC API |
meteo_forecast |
1โ16 day forecast for a place or coordinates | Open-Meteo / MeteoSwiss ICON |
meteo_school_check |
๐ข/๐ก/๐ด traffic light for outdoor school events | Open-Meteo / MeteoSwiss ICON |
meteo_climate_normals |
Monthly climate normals 1991โ2020 | Embedded (KLO, SMA, BER, LUG, GVE) |
meteo_warnings |
Current weather warnings & links | opendata.swiss + links |
Tool annotations (MCP hints)
All tools carry explicit MCP annotations โ relevant for the client approval UI and for the LLM's safety decisions.
| Tool | readOnlyHint |
destructiveHint |
idempotentHint |
openWorldHint |
|---|---|---|---|---|
meteo_stations |
โ | โ | โ | โ (curated list) |
meteo_current |
โ | โ | โ (live data) | โ (upstream STAC) |
meteo_forecast |
โ | โ | โ (live data) | โ (upstream Open-Meteo) |
meteo_school_check |
โ | โ | โ (live data) | โ (geocoding + forecast) |
meteo_climate_normals |
โ | โ | โ | โ (embedded normals) |
meteo_warnings |
โ | โ | โ (live data) | โ (opendata.swiss) |
Read rules: all 6 tools are readOnly + non-destructive โ the server fundamentally cannot write or delete anything. idempotentHint=False marks tools that return different values depending on when they are called.
MCP protocol version
| Aspect | Value |
|---|---|
| Tested spec versions | 2024-11-05, 2025-03-26, 2025-06-18 (via the mcp[cli] SDK) |
| FastMCP SDK version | see pyproject.toml โ mcp[cli]>=1.0.0 |
| Update policy | Dependabot watches mcp[cli]; spec bumps are documented in the CHANGELOG with a "Tool Definition Changes" marker |
โ Full roadmap & update strategy: docs/roadmap.md
Quick start
Claude Desktop
{
"mcpServers": {
"meteoswiss": {
"command": "uvx",
"args": ["meteoswiss-mcp"]
}
}
}
Claude Desktop (local development)
{
"mcpServers": {
"meteoswiss": {
"command": "uv",
"args": ["run", "--directory", "/path/to/meteoswiss-mcp", "meteoswiss-mcp"]
}
}
}
Cloud / Render.com (Streamable HTTP)
Configuration via ENV variables (the CLI flags --http / --port N still work as an override):
| Variable | Default | Meaning |
|---|---|---|
MCP_TRANSPORT |
stdio |
stdio or streamable-http |
MCP_HOST |
127.0.0.1 |
Bind address โ never change locally |
MCP_PORT |
8000 |
Port |
MCP_ALLOW_ANY_HOST |
unset | Must be set to 1 to allow the server to bind to 0.0.0.0 (containers/cloud only) |
MCP_LOG_LEVEL |
INFO |
DEBUG / INFO / WARNING / ERROR โ structured JSON logs on stderr |
MCP_ALLOWED_ORIGINS |
unset | Comma-separated list of allowed origins for CORS. Empty = CORS disabled (same-origin only). Mcp-Session-Id is exposed automatically. |
MCP_API_KEY |
unset | If set: every request except /health requires X-API-Key: <key> or Authorization: Bearer <key>. Constant-time comparison. |
MCP_STATELESS_HTTP |
0 |
1 enables FastMCP stateless mode โ each HTTP request opens a new session. Prerequisite for multi-replica deploys without sticky sessions (SCALE-002/003). |
OTEL_EXPORTER_OTLP_ENDPOINT |
unset | If set + pip install meteoswiss-mcp[otel]: OpenTelemetry spans per tool call + automatic httpx instrumentation are sent as OTLP-HTTP to the collector. |
OTEL_SERVICE_NAME |
meteoswiss_mcp |
Service name in the OTel resources |
MCP_CACHE_ENABLED |
1 |
0 disables the TTL cache entirely (e.g. for end-to-end tests) |
MCP_CACHE_TTL_STAC |
300 |
TTL in seconds for STAC SMN observations (default 5 min) |
MCP_CACHE_TTL_OPEN_METEO |
600 |
TTL for ICON forecasts (default 10 min) |
MCP_CACHE_TTL_GEOCODING |
3600 |
TTL for geocoding lookups (default 1 h) |
MCP_CACHE_TTL_OPENDATA |
3600 |
TTL for the opendata.swiss catalogue (default 1 h) |
MCP_CACHE_TTL_WARNINGS |
300 |
TTL for the structured warnings API (default 5 min) |
MCP_CLIMATE_NORMALS_PATH |
unset | Path to a JSON file with additional climate normals โ see data/climate-normals.example.json |
MCP_WARNINGS_API_URL |
unset | URL of a structured MeteoSwiss warnings API. The host must be on the egress allow-list. Schema-tolerant (GeoJSON features, a warnings array or items). |
MCP_CLIMATE_NORMALS_URL_TEMPLATE |
unset | URL template for runtime lookup of climate normals (for stations without embedded or JSON values). Tokens: {station} (lowercase), {STATION} (uppercase), {param} (MeteoSwiss code tre200m0/rre150m0/sre000m0). Example: https://data.geo.admin.ch/.../{station}/{param}.txt. The host must be on the egress allow-list. |
# Local test (safe, loopback only)
MCP_TRANSPORT=streamable-http meteoswiss-mcp
# Container / Render
MCP_TRANSPORT=streamable-http MCP_HOST=0.0.0.0 MCP_ALLOW_ANY_HOST=1 meteoswiss-mcp
Docker / Render
The repo includes a production-ready multi-stage Dockerfile (non-root user, HEALTHCHECK) and a render.yaml blueprint:
# Build + test locally
docker build -t meteoswiss-mcp .
docker run --rm -p 8000:8000 meteoswiss-mcp
curl http://127.0.0.1:8000/health # โ {"status":"ok","service":"meteoswiss-mcp"}
On Render: "New โ Blueprint" โ select the repo. Defaults (plan starter, Frankfurt, single instance) are set in render.yaml.
Important: numInstances: 1 is set deliberately โ sticky-session routing for multi-replica (audit SCALE-002/003) is not yet implemented.
Structured logging
All tool invocations, upstream failures and egress blocks are emitted as JSON events on stderr (stdio-transport safe). Example:
{"tool": "meteo_forecast", "days": 7, "has_coords": false, "event": "tool_invoked", "level": "info", "timestamp": "2026-05-20T07:00:00Z"}
{"tool": "meteo_forecast", "endpoint": "geocoding", "error_type": "HTTPStatusError", "event": "upstream_failed", "level": "warning", "timestamp": "..."}
{"url": "https://evil.example.com/", "method": "GET", "reason": "host not in allow-list", "event": "egress_blocked", "level": "warning", "timestamp": "..."}
HTTP-mode security
MCP_HOSTdeliberately defaults to127.0.0.1so that--httpon a dev laptop is not accidentally exposed to the local subnet (audit finding SEC-016).- All outgoing HTTP calls (including redirect follows) are validated against an allow-list:
data.geo.admin.ch,api.open-meteo.com,geocoding-api.open-meteo.com,opendata.swiss. Other hosts and IP literals (in particular169.254.169.254, RFC1918) are rejected withEgressBlocked(SEC-004 / SEC-021). - CORS: disabled by default (same-origin only). Browser clients (e.g. claude.ai web) need
MCP_ALLOWED_ORIGINS=<csv>โ theMcp-Session-Idheader is then automatically inAccess-Control-Expose-Headers(SDK-004). - API-key auth: disabled by default. In a production HTTP setup, always set
MCP_API_KEY=<random>โ requests without a validX-API-KeyorAuthorization: Bearer โฆare rejected with 401 (SEC-009 / SEC-013)./healthstays open for container health probes.
Example: production HTTP stack
# 32 bytes of randomness as the auth key
export MCP_API_KEY=$(python -c "import secrets; print(secrets.token_urlsafe(32))")
MCP_TRANSPORT=streamable-http \
MCP_HOST=0.0.0.0 \
MCP_ALLOW_ANY_HOST=1 \
MCP_ALLOWED_ORIGINS=https://app.example.com \
MCP_API_KEY="$MCP_API_KEY" \
meteoswiss-mcp
Example queries
School planning
Which days next week are suitable for a sports day in Zรผrich?
โ meteo_school_check(location="Zรผrich", activity="Sporttag")
What will the weather be at Leutschenbach school on Friday?
โ meteo_forecast(location="Zรผrich Oerlikon", days=5)
Show me current readings from the nearest MeteoSwiss station to Zรผrich-Schwamendingen.
โ meteo_current(station="REH")
Climate comparison
How much rain normally falls in June in Zรผrich?
โ meteo_climate_normals(station="KLO")
Is Lugano really much sunnier than Zรผrich? Show me the annual values.
โ meteo_climate_normals(station="LUG") + meteo_climate_normals(station="SMA")
Infrastructure & environment
Are there currently any weather warnings for the canton of Zรผrich?
โ meteo_warnings(canton="ZH")
Show me a 10-day forecast for the Heerenschรผrli sports facility with hourly values.
โ meteo_forecast(location="Sportanlage Heerenschรผrli Zรผrich", days=10, hourly=True)
Architecture
Claude Desktop / AI agent
โ
โ MCP (stdio / Streamable HTTP)
โผ
meteoswiss-mcp (FastMCP)
โ
โโโ meteo_stations โโโโโโโโโโโโโโโโ [embedded: ~20 SMN stations]
โ
โโโ meteo_current โโโโโโโโโโโโโโโโโ BGDI STAC API
โ data.geo.admin.ch/api/stac/v1
โ Collection: ch.meteoschweiz.ogd-smn
โ
โโโ meteo_forecast โโโโโโโโโโโโโโโโ Open-Meteo
โโโ meteo_school_check โโโโโโโโโโโโ api.open-meteo.com/v1/meteoswiss
โ (MeteoSwiss ICON-CH1/CH2-EPS, 1โ2 km)
โ
โโโ meteo_climate_normals โโโโโโโโโ [embedded: normals 1991โ2020]
โ
โโโ meteo_warnings โโโโโโโโโโโโโโโโ opendata.swiss CKAN + links
Data sources
| Source | URL | License |
|---|---|---|
| BGDI STAC API (MeteoSwiss OGD) | data.geo.admin.ch/api/stac/v1 |
CC BY 4.0 |
| Open-Meteo (MeteoSwiss ICON) | api.open-meteo.com/v1/meteoswiss |
CC BY 4.0 |
| Open-Meteo Geocoding | geocoding-api.open-meteo.com |
CC BY 4.0 |
| opendata.swiss CKAN | opendata.swiss/api/3/action |
CC BY 4.0 |
Safety & limits
| Aspect | Details |
|---|---|
| Access | Read-only (readOnlyHint: true on all tools) โ the server cannot modify or delete any data |
| Personal data | No personal data โ all sources are aggregated, publicly available open data |
| Rate limits | Built-in per-query caps: max 50 results per API call, 30 s timeout |
| Authentication | No API keys required โ all data sources are publicly accessible |
| Licenses | All data under CC BY 4.0 (MeteoSwiss Open Government Data) |
| Terms of Service | Subject to the ToS of the respective data sources: MeteoSwiss OGD, Open-Meteo, opendata.swiss |
Known limitations
| ID | Tool | Description |
|---|---|---|
| BUG-01 | meteo_current |
STAC asset structure can vary per station; fallback to a direct link is implemented |
| LIM-01 | meteo_climate_normals |
Only 5 stations embedded (KLO, SMA, BER, LUG, GVE); the rest via an opendata.swiss link |
| LIM-02 | meteo_warnings |
A direct warnings REST API is planned from Q2 2026 (MeteoSwiss OGD phase 2); currently links + CAP |
| LIM-03 | meteo_current |
Shows 10-min values in UTC; no automatic conversion to local time |
Portfolio synergies
meteoswiss-mcp
โ
โโโ swiss-environment-mcp Combine weather + air quality (NABEL)
โ "How were weather AND air at Leutschenbach school?"
โ
โโโ zurich-opendata-mcp School locations โ weather forecast
"Which schools in Zรผrich have sports-day weather?"
Testing
# Unit tests (no network)
PYTHONPATH=src pytest tests/ -m "not live" -v
# Live tests (real APIs)
PYTHONPATH=src pytest tests/ -m live -v
# Linting
ruff check src/ tests/
Development
git clone https://github.com/malkreide/meteoswiss-mcp
cd meteoswiss-mcp
pip install -e ".[dev]"
MCP Inspector (local test)
PYTHONPATH=src npx @modelcontextprotocol/inspector python -m meteoswiss_mcp.server
Contributing & Security
License
MIT License โ see LICENSE.
Source data: MeteoSwiss Open Government Data (CC BY 4.0). When using the data, cite: Source: MeteoSwiss.
Related servers
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file meteoswiss_mcp-0.3.3.tar.gz.
File metadata
- Download URL: meteoswiss_mcp-0.3.3.tar.gz
- Upload date:
- Size: 270.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85ed01daff50c3e9960559ce49b8018f4830c877c942ea826ac9c31eafdd01ad
|
|
| MD5 |
ec7bc34c4b4de86fdcb9e35e550318bb
|
|
| BLAKE2b-256 |
ce173c995826685c636e618cd6e087e39adf2accd13efad3aed5d128170aae71
|
File details
Details for the file meteoswiss_mcp-0.3.3-py3-none-any.whl.
File metadata
- Download URL: meteoswiss_mcp-0.3.3-py3-none-any.whl
- Upload date:
- Size: 35.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1376dec65ce6d2e0bd0ddb439f423271b6f71531378c2b59cf51aa1be21fb55
|
|
| MD5 |
69ef72a11e9b31dcc718e739015ff8d8
|
|
| BLAKE2b-256 |
4c8a612ac76c92f4dc1ab5b8cb772bc675f77073c6ac7cec5287d280c55ae8b6
|