BAFU environmental data, NABEL air quality, hydrology
Valid MCP server (1 strong, 3 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry.
3 files analyzed Β· 1 issue found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
Add this to your MCP configuration file:
{
"mcpServers": {
"io-github-malkreide-swiss-environment-mcp": {
"args": [
"swiss-environment-mcp"
],
"command": "uvx"
}
}
}From the project's GitHub README.
π¨π Part of the Swiss Public Data MCP Portfolio
MCP server connecting AI models to Swiss environmental data from BAFU β air quality, hydrology, natural hazards, wildfire danger and open environmental datasets.
swiss-environment-mcp gives AI assistants like Claude direct access to real-time environmental data from Swiss federal authorities β no API keys required. Air quality readings from the national NABEL monitoring network, hydrological gauging stations, natural hazard bulletins, and the full BAFU dataset catalogue are all accessible through a single standardised MCP interface.
The server covers four thematic clusters: air quality (NABEL), hydrology, natural hazards, and the BAFU open data catalogue. Each cluster maps to a group of purpose-built tools that translate raw agency data into clean JSON responses.
Anchor demo query: "What is the current air quality at the NABEL station ZΓΌrich-Kaserne β and does it comply with WHO 2021 guidelines?" β More use cases by audience β
# Clone the repository
git clone https://github.com/malkreide/swiss-environment-mcp.git
cd swiss-environment-mcp
# Install
pip install -e .
Or with uvx (no permanent installation):
uvx swiss-environment-mcp
Or via pip:
pip install swiss-environment-mcp
# Start the server (stdio mode for Claude Desktop)
swiss-environment-mcp
Try it immediately in Claude Desktop:
"What is the current air quality at NABEL station ZΓΌrich-Kaserne?" "Are there any active flood warnings in Switzerland right now?" "What is the wildfire danger level in Canton Valais?"
Minimal (recommended):
{
"mcpServers": {
"swiss-environment": {
"command": "uvx",
"args": ["swiss-environment-mcp"],
"env": {}
}
}
}
Config file locations:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonAfter saving, restart Claude Desktop completely.
For use via claude.ai in the browser (e.g. on managed workstations without local software):
Render.com (recommended):
render.yaml automaticallyhttps://your-app.onrender.com/sseDocker:
docker build -t swiss-environment-mcp .
docker run -p 8000:8000 swiss-environment-mcp
π‘ "stdio for the developer laptop, SSE for the browser."
| Tool | Description | Data Source |
|---|---|---|
env_nabel_stations | List all 16 NABEL monitoring stations with location type and canton | NABEL / BAFU |
env_nabel_current | Current air quality data for a station (NOβ, Oβ, PM10, PM2.5, SOβ, CO) | NABEL / BAFU |
env_air_limits_check | Compare a measurement against Swiss LRV limits and WHO 2021 guidelines | Built-in |
| Tool | Description | Data Source |
|---|---|---|
env_hydro_stations | Filter hydrological gauging stations by canton or water body | LINDAS SPARQL β hydrodaten.admin.ch (fallback) |
env_hydro_current | Current water level, flow rate and temperature at a station | LINDAS SPARQL β hydrodaten.admin.ch (fallback) |
env_hydro_history | Historical hourly values (up to 30 days) with download links β οΈ | hydrodaten.admin.ch |
env_flood_warnings | Active flood warnings filtered by danger level and canton | hydrodaten.admin.ch |
| Tool | Description | Data Source |
|---|---|---|
env_hazard_overview | Current natural hazard bulletin (SLF/BAFU) in DE/FR/IT/EN | naturgefahren.ch |
env_hazard_regions | Region-specific warnings (floods, avalanches, rockfall) | naturgefahren.ch |
env_wildfire_danger | Wildfire danger index by canton and region | waldbrandgefahr.ch |
| Tool | Description | Data Source |
|---|---|---|
env_snow_stations | List automatic SLF/IMIS snow measurement stations (by canton) | measurement-api.slf.ch |
env_snow_current | Current snow depth (HS) and 24 h new snow (HN_1D) per station, in cm | measurement-api.slf.ch |
env_avalanche_bulletin | Avalanche danger levels (EAWS 1β5) per warning region, seasonal | aws.slf.ch |
| Tool | Description | Data Source |
|---|---|---|
env_hunting_species | List the 36 species tracked by the federal hunting statistics (with codes) | jagdstatistik.ch (embedded) |
env_hunting_stats | Cull / game-loss / population figures per species, canton and year (2015β2024) | jagdstatistik.ch |
| Tool | Description | Data Source |
|---|---|---|
env_bafu_datasets | Search BAFU datasets on opendata.swiss (CKAN API) | opendata.swiss |
env_bafu_dataset_detail | Full metadata and download URLs for a specific dataset | opendata.swiss |
| Query | Tool |
|---|---|
| "Air quality at ZΓΌrich-Kaserne right now?" | env_nabel_current |
| "Does 45 Β΅g/mΒ³ NOβ exceed the Swiss limit?" | env_air_limits_check |
| "Current water level of the Limmat in Zurich?" | env_hydro_current |
| "Active flood warnings in Switzerland?" | env_flood_warnings |
| "Natural hazard bulletin for GraubΓΌnden?" | env_hazard_overview |
| "Wildfire danger in Canton Valais?" | env_wildfire_danger |
| "BAFU biodiversity datasets on opendata.swiss?" | env_bafu_datasets |
| Aspect | Details |
|---|---|
| Access | Read-only (readOnlyHint: true) β the server cannot modify or delete any data |
| Personal data | No personal data β all sources are aggregated, public environmental measurements |
| Rate limits | Built-in per-query caps (e.g. max 30 days hydrology history, 50 dataset search results) |
| Timeout | 30 seconds per API call |
| Authentication | No API keys required β all BAFU endpoints are publicly accessible |
| Licenses | BAFU Open Government Data (OGD) β free reuse with mandatory attribution |
| Terms of Service | Subject to ToS of the respective data sources: BAFU / opendata.swiss, hydrodaten.admin.ch, naturgefahren.ch, waldbrandgefahr.ch |
βββββββββββββββββββ βββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ
β Claude / AI ββββββΆβ Swiss Environment MCP ββββββΆβ BAFU / Swiss Agencies β
β (MCP Host) βββββββ (MCP Server) βββββββ β
βββββββββββββββββββ β β β hydrodaten.admin.ch β
β 12 Tools Β· 3 Resources β β naturgefahren.ch β
β Stdio | SSE β β waldbrandgefahr.ch β
β β β opendata.swiss (CKAN) β
β api_client.py β ββββββββββββββββββββββββββββ
β server.py (FastMCP) β
βββββββββββββββββββββββββββββ
| Source | Data | Licence |
|---|---|---|
| lindas.admin.ch | Current hydrology (level, discharge, water temperature) via SPARQL | BAFU Open-Use / OGD |
| hydrodaten.admin.ch | Water levels, flow rates, temperatures (REST fallback) | BAFU OGD |
| naturgefahren.ch | Natural hazard bulletin (SLF/BAFU) | BAFU/SLF |
| waldbrandgefahr.ch | Wildfire danger index | BAFU |
| SLF data service | Snow depth, new snow (IMIS); avalanche bulletin | SLF (WSL) CC BY 4.0 |
| jagdstatistik.ch | Federal hunting statistics (cull, game loss, population) | BAFU β source attribution required (no explicit licence published) |
| opendata.swiss | BAFU data catalogue (CKAN API) | OGD |
All data: publicly accessible, no authentication required.
Attribution required: BAFU / SLF (WSL) must be cited as the source when using their data.
swiss-environment-mcp/
βββ src/swiss_environment_mcp/
β βββ __init__.py # Package
β βββ server.py # FastMCP server: 12 tools, 3 resources
β βββ api_client.py # HTTP client + egress allow-list (SSRF guard)
β βββ logging_setup.py # structlog -> stderr
βββ tests/
β βββ test_unit.py # Mocked unit tests (no network) β CI default
β βββ test_integration.py # Live API tests (marker: live)
β βββ test_20_scenarios.py # Live scenario coverage
βββ scripts/tool_snapshot.py # Tool-definition hash snapshot (rug-pull guard)
βββ docs/ # security.md, scaling.md, roadmap.md
βββ .github/
β βββ dependabot.yml # Monthly dependency/action updates
β βββ workflows/ # ci.yml, security.yml (gitleaks), live-tests.yml, publish.yml
βββ Dockerfile # Multi-stage, non-root container
βββ render.yaml / Procfile # Cloud deployment
βββ tool-snapshot.json # Committed tool-definition snapshot
βββ .env.example # Non-secret config template
βββ pyproject.toml # Build configuration (hatchling)
Single-module layout (rationale, audit ARCH-011): the 12 tools live in one
server.pyrather than atools/package. They are thin, uniform wrappers overapi_client.pysharing the same input/response patterns, so a single well-sectioned module stays more navigable than 4 near-identical files. This is a deliberate, documented deviation; a split is revisited if tool logic grows non-uniform.
initialize time and handled by the pinned MCP
SDK (mcp[cli]). The SDK version is the canonical pin; SDK/protocol updates land
via Dependabot PRs (.github/dependabot.yml, monthly).tool-snapshot.json; CI fails until the snapshot
is regenerated and a CHANGELOG entry + version bump are added.This server is in Phase 1 (read-only) β all tools read-only, no auth, no side
effects. The phase model and prerequisites for Phase 2 (write/auth) are in
docs/roadmap.md. Security architecture (SSRF/egress, secret
management, lethal-trifecta assessment): docs/security.md.
Scaling/session strategy: docs/scaling.md.
env_hydro_current, env_hydro_stations and env_flood_warnings query the BAFU LINDAS SPARQL endpoint (typed live values: level, discharge, water temperature, danger level). LINDAS holds current values only (one observation per station) β it is not a historical time series. See docs/probe-lindas-hydro.md.env_hydro_history (BUG-01 resolved): the old hydrodaten.admin.ch/lhg/az/* REST endpoints (hourly CSV, warnings.json, station JSON) are decommissioned (404). env_flood_warnings now uses LINDAS dangerLevel instead. Real historical time series (daily / long-term means β e.g. summer 2024 vs. long-term average) are not freely available via API; they must be ordered from the BAFU Hydrological Enquiry Service (abfragezentrale@bafu.admin.ch). env_hydro_history returns the latest LINDAS value plus this access path.env_flood_warnings reads LINDAS dangerLevel; a canton filter is not available there (LINDAS carries no canton code), so it is reported but not applied.env_hunting_stats): The jagdstatistik.ch backend is undocumented (a content-negotiated web-app endpoint). A schema-guard degrades gracefully if the structure changes. Species/canton/datatype lookups are embedded (harvested 2026-07-19); figures are fetched live for 2015β2024. Licence (researched 2026-07-19): the data is owned by BAFU (compiled from cantonal offices; site tech by Wildtier Schweiz) and is not published as a licensed dataset on opendata.swiss; no explicit licence is stated on the source. Responses therefore require source attribution to BAFU; formal licence confirmation from BAFU is still pending. See docs/probe-jagdstatistik.md.meteoswiss-mcp)To avoid duplicating snow and precipitation data across the portfolio,
responsibilities are split as follows. meteoswiss-mcp owns atmospheric
precipitation and weather; swiss-environment-mcp (SLF domain) owns snow on the
ground and avalanche danger.
| Data | swiss-environment-mcp (BAFU / SLF) | meteoswiss-mcp (MeteoSwiss) |
|---|---|---|
Snow depth on the ground (HS) | β
env_snow_current (SLF IMIS) | β |
Fresh snow 24 h (HN_1D) | β
env_snow_current (SLF IMIS) | β |
| Avalanche danger level | β
env_avalanche_bulletin (SLF, EAWS 1β5) | β |
| Snowfall as a current weather condition | β | β
meteo_current / meteo_forecast (weather code) |
| Precipitation amount (mm): measurement network, forecast, climate normals | β | β
meteo_current / meteo_forecast / meteo_climate_normals |
| Precipitation at SLF IMIS mountain stations | β only as snow-cover context, no standalone precipitation tool | (MeteoSwiss network) |
| Weather warnings (storm, thunderstorm, heat) | β | β
meteo_warnings |
| Natural-hazard warnings (flood, avalanche, wildfire) | β
env_flood_warnings, env_hazard_*, env_wildfire_danger | β |
Rule: snow on the ground and avalanche danger belong to
swiss-environment-mcp (SLF); atmospheric precipitation (rain/snowfall as mm)
plus weather, forecast, warnings and climate normals belong to meteoswiss-mcp.
The SLF IMIS precipitation endpoint (RR_10MIN_SUM) is deliberately not wired
up as a tool, so it does not duplicate MeteoSwiss. The snow/avalanche tools are
live (see docs/probe-slf.md).
# Unit tests (no API keys or network required)
PYTHONPATH=src pytest tests/ -m "not live"
# Integration tests (requires live BAFU APIs)
PYTHONPATH=src pytest tests/ -m "live"
# Linting
ruff check src/
See CONTRIBUTING.md (English) Β· CONTRIBUTING.de.md (German)
Security policy and posture: SECURITY.md (English) Β· SECURITY.de.md (German).
Full security architecture: docs/security.md.
See CHANGELOG.md
MIT License β see LICENSE
Source data is subject to BAFU terms of use. Attribution to BAFU is required when using their data.
Hayal Oezkan Β· github.com/malkreide
| Server | Description |
|---|---|
| zurich-opendata-mcp | City of Zurich open data (OSTLUFT air quality, weather, parking, geodata) |
| swiss-transport-mcp | Swiss public transport β OJP 2.0 journey planning, SIRI-SX disruptions |
| swiss-road-mobility-mcp | GBFS shared mobility, EV charging, DATEX II traffic |
| swiss-statistics-mcp | BFS STAT-TAB β 682 statistical datasets |
Synergy example: "What was the air quality at Schulhaus Leutschenbach today β and how does it compare to the national NABEL average?"
β zurich-opendata-mcp (OSTLUFT, local) + swiss-environment-mcp (NABEL, national)
Run via uv's uvx β no clone or manual install needed. Add to your MCP client config (mcpServers for Claude Desktop, Cursor and Windsurf; use a top-level servers key for VS Code in .vscode/mcp.json):
{
"mcpServers": {
"swiss-environment-mcp": {
"command": "uvx",
"args": [
"swiss-environment-mcp"
]
}
}
}
Be the first to review this server!
by Modelcontextprotocol Β· Developer Tools
Web content fetching and conversion for efficient LLM usage
by Toleno Β· Developer Tools
Toleno Network MCP Server β Manage your Toleno mining account with Claude AI using natural language.
by mcp-marketplace Β· Developer Tools
Create, build, and publish Python MCP servers to PyPI β conversationally.