convez.ai
MCP ServerDados & AnalyticsIntermediário
malkreide

Swiss Environment MCP

malkreide/swiss-environment-mcp

Acesso integrado a dados ambientais suíços via MCP para IA

Ver no GitHub
BomPluginScore · de 0 a 100

Servidor MCP que conecta modelos de IA a dados ambientais públicos da Suíça em tempo real — qualidade do ar (NABEL), hidrologia, hazardos naturais e alertas de incêndios florestais. Sem necessidade de autenticação, integra dados federais suíços diretamente em assistentes como Claude.

Instalação

$npx convez-ai malkreide/swiss-environment-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
1
Forks
1
Acompanhando
0
Saúde
71%
Último commit
há 3 dias
Versão
v0.7.0
Issues abertas
0
Contribuidores
3

Casos de uso

  • Monitoramento de qualidade do ar em estações NABEL com comparação WHO 2021
  • Consultas sobre níveis de água e vazão em estações de medição hidrológica
  • Alertas de inundações e perigos naturais filtrados por canton
  • Índice de perigo de incêndio florestal por região
  • Busca em catálogo de dados abertos BAFU

Veredito

Ferramenta especializada e bem-estruturada para acesso a dados ambientais públicos suíços. Implementação sólida de MCP com cobertura abrangente (ar, água, hazardos, incêndios) e sem overhead de autenticação — ideal para análise ambiental e alertas regionais.

README

A tradução para o português deste README ainda está na fila.

🇨🇭 Part of the Swiss Public Data MCP Portfolio

🌿 swiss-environment-mcp

Version License: MIT Python 3.11+ MCP CI Data Source

MCP server connecting AI models to Swiss environmental data from BAFU – air quality, hydrology, natural hazards, wildfire danger and open environmental datasets.

🇩🇪 Deutsche Version


Overview

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 →


Features

  • 🌬️ Air quality monitoring – 16 NABEL stations, NO₂/O₃/PM10/PM2.5/SO₂/CO, Swiss LRV + WHO 2021 limit checks
  • 💧 Hydrology – water levels, flow rates, temperatures across Swiss gauging stations
  • 🚨 Flood warnings – active alerts filtered by danger level and canton
  • 🏔️ Natural hazard bulletin – SLF/BAFU bulletin in DE/FR/IT/EN, region-specific warnings
  • 🔥 Wildfire danger – canton- and region-level fire danger index
  • 📦 BAFU open data catalogue – search and retrieve environmental datasets via CKAN
  • 🔑 No authentication required – all data sources are publicly accessible
  • ☁️ Dual transport – stdio for Claude Desktop, Streamable HTTP/SSE for cloud deployment

Prerequisites

  • Python 3.11+
  • No API keys needed – all endpoints are publicly accessible without authentication

Installation

# 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

Quickstart

# 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?"


Configuration

Claude Desktop

Minimal (recommended):

{
  "mcpServers": {
    "swiss-environment": {
      "command": "uvx",
      "args": ["swiss-environment-mcp"],
      "env": {}
    }
  }
}

Config file locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

After saving, restart Claude Desktop completely.

Cloud Deployment (SSE for browser access)

For use via claude.ai in the browser (e.g. on managed workstations without local software):

Render.com (recommended):

  1. Push/fork the repository to GitHub
  2. On render.com: New Web Service → connect GitHub repo
  3. Render detects render.yaml automatically
  4. In claude.ai under Settings → MCP Servers, add: https://your-app.onrender.com/sse

Docker:

docker build -t swiss-environment-mcp .
docker run -p 8000:8000 swiss-environment-mcp

💡 "stdio for the developer laptop, SSE for the browser."


Available Tools

🌬️ Air Quality / NABEL (3 tools)

ToolDescriptionData Source
env_nabel_stationsList all 16 NABEL monitoring stations with location type and cantonNABEL / BAFU
env_nabel_currentCurrent air quality data for a station (NO₂, O₃, PM10, PM2.5, SO₂, CO)NABEL / BAFU
env_air_limits_checkCompare a measurement against Swiss LRV limits and WHO 2021 guidelinesBuilt-in

💧 Hydrology (4 tools)

ToolDescriptionData Source
env_hydro_stationsFilter hydrological gauging stations by canton or water bodyhydrodaten.admin.ch
env_hydro_currentCurrent water level, flow rate and temperature at a stationhydrodaten.admin.ch
env_hydro_historyHistorical hourly values (up to 30 days) with download links ⚠️hydrodaten.admin.ch
env_flood_warningsActive flood warnings filtered by danger level and cantonhydrodaten.admin.ch

🏔️ Natural Hazards (3 tools)

ToolDescriptionData Source
env_hazard_overviewCurrent natural hazard bulletin (SLF/BAFU) in DE/FR/IT/ENnaturgefahren.ch
env_hazard_regionsRegion-specific warnings (floods, avalanches, rockfall)naturgefahren.ch
env_wildfire_dangerWildfire danger index by canton and regionwaldbrandgefahr.ch

📊 Environmental Data Catalogue (2 tools)

ToolDescriptionData Source
env_bafu_datasetsSearch BAFU datasets on opendata.swiss (CKAN API)opendata.swiss
env_bafu_dataset_detailFull metadata and download URLs for a specific datasetopendata.swiss

Example Use Cases

QueryTool
"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

🛡️ Safety & Limits

AspectDetails
AccessRead-only (readOnlyHint: true) — the server cannot modify or delete any data
Personal dataNo personal data — all sources are aggregated, public environmental measurements
Rate limitsBuilt-in per-query caps (e.g. max 30 days hydrology history, 50 dataset search results)
Timeout30 seconds per API call
AuthenticationNo API keys required — all BAFU endpoints are publicly accessible
LicensesBAFU Open Government Data (OGD) — free reuse with mandatory attribution
Terms of ServiceSubject to ToS of the respective data sources: BAFU / opendata.swiss, hydrodaten.admin.ch, naturgefahren.ch, waldbrandgefahr.ch

Architecture

┌─────────────────┐     ┌───────────────────────────┐     ┌──────────────────────────┐
│   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)      │
                        └───────────────────────────┘

Data Sources

SourceDataLicence
hydrodaten.admin.chWater levels, flow rates, temperatures (10-min intervals)BAFU OGD
naturgefahren.chNatural hazard bulletin (SLF/BAFU)BAFU/SLF
waldbrandgefahr.chWildfire danger indexBAFU
opendata.swissBAFU data catalogue (CKAN API)OGD

All data: publicly accessible, no authentication required.
Attribution required: BAFU must be cited as the source when using their data.


Project Structure

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.py rather than a tools/ package. They are thin, uniform wrappers over api_client.py sharing 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.


MCP Protocol Version & Maintenance

  • MCP protocol: negotiated at 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-definition stability (audit SEC-022): any change to a tool's name, description or parameters changes tool-snapshot.json; CI fails until the snapshot is regenerated and a CHANGELOG entry + version bump are added.
  • Update policy: review Dependabot PRs monthly; bump the version (semver) on any tool-definition or behaviour change.

Lifecycle Phase

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.


Known Limitations

  • env_hydro_history: The historical hourly data endpoint is currently returning 404 errors from hydrodaten.admin.ch (BUG-01 – under investigation). The tool will return download links as a fallback.
  • NABEL: Near-real-time data only; no historical time series via this server.
  • Natural hazards: Bulletin availability depends on SLF/BAFU publication schedule.
  • Wildfire danger: Regional granularity varies by season and data availability.

Testing

# 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/

Contributing

See CONTRIBUTING.md (English) · CONTRIBUTING.de.md (German)


Security

Security policy and posture: SECURITY.md (English) · SECURITY.de.md (German). Full security architecture: docs/security.md.


Changelog

See CHANGELOG.md


License

MIT License — see LICENSE

Source data is subject to BAFU terms of use. Attribution to BAFU is required when using their data.


Author

Hayal Oezkan · github.com/malkreide


Credits & Related Projects

ServerDescription
zurich-opendata-mcpCity of Zurich open data (OSTLUFT air quality, weather, parking, geodata)
swiss-transport-mcpSwiss public transport – OJP 2.0 journey planning, SIRI-SX disruptions
swiss-road-mobility-mcpGBFS shared mobility, EV charging, DATEX II traffic
swiss-statistics-mcpBFS 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)

Installation

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"
      ]
    }
  }
}
Ver o original no GitHub

Bom para

Relacionados