MCP Server für Schweizer Energiedaten – BFE Elektrizitätsproduktionsanlagen, Windkraft, Wasserkraft, Photovoltaik, Solareignung, Energiestädte via GeoAdmin REST API und opendata.swiss
Project description
🇨🇭 Part of the Swiss Public Data MCP Portfolio
⚡ swiss-energy-mcp
MCP server for Swiss energy data from the Federal Office of Energy (SFOE/BFE) via GeoAdmin REST API and opendata.swiss — no API key required.
Overview
swiss-energy-mcp gives AI assistants structured, location-based access to Switzerland's energy infrastructure. Built on open geodata from the Swiss Federal Office of Energy (SFOE/BFE) via the GeoAdmin REST API and the opendata.swiss catalogue — completely authentication-free.
The server is part of a growing portfolio of Swiss open data MCP servers. Think of it as the energy atlas counterpart to swiss-road-mobility-mcp: while the latter maps mobility, this server maps where Switzerland produces electricity, where solar potential exists, and which municipalities hold the "Energiestadt" label.
Anchor demo query: "Which power plants are within 20 km of the school in Wädenswil — and is the municipality an Energiestadt?"
Features
- 🔍 10 ready-to-use tools covering all major energy data layers from SFOE/BFE
- ⚡ Power plants — all types: photovoltaic, hydro, wind, biomass, nuclear, with optional category filter
- 💨 Wind turbines — detailed data incl. manufacturer, model, hub height, annual production
- 💧 Hydropower plants — type, status, turbine capacity, expected annual output
- ☀️ PV large installations — project name, capacity, annual/winter production, altitude
- 🌿 Biogas plants — plant name, output
- 🏙️ Energiestädte — municipalities with the Swiss "Energiestadt" label (score, year awarded, audits)
- 🏠 Solar roof potential — suitability category, area, orientation, and slope per roof segment
- 📊 Location energy profile — combines 5 layers into a single overview for any Swiss location
- 🗂️ SFOE dataset search — full-text search across SFOE publications on opendata.swiss
- ✅ Status check — verifies availability of both upstream APIs
- ☁️ Dual transport — stdio for Claude Desktop, Streamable HTTP for cloud deployment
Prerequisites
- Python 3.11+
uv(recommended) orpip
Installation
Claude Desktop (stdio transport)
Add to your claude_desktop_config.json:
{
"mcpServers": {
"swiss-energy-mcp": {
"command": "uvx",
"args": ["swiss-energy-mcp"]
}
}
}
Config file locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Local development
git clone https://github.com/malkreide/swiss-energy-mcp.git
cd swiss-energy-mcp
uv sync
uv run swiss-energy-mcp
Cloud / HTTP transport (Streamable HTTP)
For use via claude.ai in the browser (e.g. on managed workstations without local software):
SWISS_ENERGY_TRANSPORT=http uvx swiss-energy-mcp
💡 "stdio for the developer laptop, HTTP for the browser."
Quickstart
Once connected in Claude Desktop, try:
What power plants are within 20 km of Bern?
Show me all wind turbines in the Jura region.
Is Zürich an Energiestadt? What's their score?
What is the solar potential of rooftops near lat=47.37, lon=8.54?
Give me a full energy profile for the region around Lucerne.
Find SFOE datasets about hydropower.
Available Tools
| Tool | Description |
|---|---|
energy_find_power_plants |
All electricity generation plants within a radius (optional category filter) |
energy_find_wind_turbines |
Wind turbines with manufacturer, model, hub height |
energy_find_hydro_plants |
Hydropower plants with capacity and expected output |
energy_find_pv_installations |
Large PV installations with annual/winter production |
energy_find_biogas_plants |
Biogas plants |
energy_find_energy_cities |
Municipalities with "Energiestadt" label |
energy_solar_potential |
Solar suitability of roof segments at a location |
energy_location_profile |
Combined energy profile (5 layers) for a location |
energy_search_bfe_datasets |
Full-text search over SFOE datasets on opendata.swiss |
energy_check_status |
Check availability of GeoAdmin and opendata.swiss APIs |
All tools accept WGS84 coordinates (lat/lon). Conversion to Swiss LV95 is handled internally.
Example Use Cases
| Query | Tool |
|---|---|
| "Power plants near Bern (20 km radius)?" | energy_find_power_plants |
| "Wind turbines in the Jura?" | energy_find_wind_turbines |
| "Is Zürich an Energiestadt?" | energy_find_energy_cities |
| "Solar potential of rooftops near lat=47.37, lon=8.54?" | energy_solar_potential |
| "Full energy profile for Lucerne region?" | energy_location_profile |
| "SFOE datasets on hydropower?" | energy_search_bfe_datasets |
→ More use cases by audience →
Data Sources
| Source | URL | Auth |
|---|---|---|
| GeoAdmin REST API (swisstopo) | api3.geo.admin.ch |
None |
| opendata.swiss CKAN API | opendata.swiss/api/3/action |
None |
BFE Layers used:
ch.bfe.elektrizitaetsproduktionsanlagench.bfe.windenergieanlagench.bfe.statistik-wasserkraftanlagench.bfe.photovoltaik-grossanlagench.bfe.biogasanlagench.bfe.energiestaedtech.bfe.solarenergie-eignung-daecher
Configuration
All variables use the SWISS_ENERGY_ prefix and are validated at startup.
| Environment variable | Default | Description |
|---|---|---|
SWISS_ENERGY_TRANSPORT |
stdio |
Transport mode: stdio or http |
SWISS_ENERGY_HOST |
127.0.0.1 |
Host for HTTP transport. Bind 0.0.0.0 only inside a container. |
SWISS_ENERGY_PORT |
8000 |
Port for HTTP transport |
SWISS_ENERGY_CORS_ORIGINS |
https://claude.ai |
Comma-separated allowed CORS origins (HTTP transport) |
SWISS_ENERGY_LOG_LEVEL |
INFO |
Log level: DEBUG / INFO / WARNING / ERROR |
SWISS_ENERGY_HTTP_TIMEOUT |
20 |
Upstream HTTP timeout in seconds |
See .env.example for a template.
MCP Protocol Version
This server targets the MCP protocol version shipped with the pinned mcp
SDK (mcp[cli] >= 1.20.0). SDK updates arrive monthly via Dependabot;
protocol-version changes are recorded in CHANGELOG.md.
MCP Primitives
The server uses all three MCP primitives:
- Tools — 10 read-only tools (see above). Every search tool returns an
EnergyResponseenvelope: structuredresultsplus a Markdownsummary, explicitsource/licenseattribution, and amatch_typefield. - Resource —
energy://layers, the static catalogue of BFE GeoAdmin layers. - Prompt —
energy_site_assessment, a guided location-analysis template.
Development Phase
The server is in Phase 1 (read-only). See docs/roadmap.md for the phased architecture and docs/security.md for the egress allow-list, SSRF protection and trifecta assessment.
Safety & Limits
| 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 infrastructure data |
| Rate limits | Built-in per-query caps (max 50 search results, default 5 km radius) |
| Timeout | 20 seconds per API call |
| Authentication | No API keys required — both APIs are publicly accessible |
| Licenses | All data under open licenses via opendata.swiss (OGD) |
| Terms of Service | Subject to ToS of the respective data sources: GeoAdmin, opendata.swiss, SFOE/BFE |
Architecture
┌─────────────────┐ ┌───────────────────────────┐ ┌──────────────────────────┐
│ Claude / AI │────▶│ Swiss Energy MCP │────▶│ SFOE / BFE Open Data │
│ (MCP Host) │◀────│ (MCP Server) │◀────│ │
└─────────────────┘ │ │ │ GeoAdmin REST API │
│ 10 Tools │ │ (api3.geo.admin.ch) │
│ Stdio | HTTP │ │ │
│ │ │ opendata.swiss CKAN │
│ server.py (FastMCP) │ │ (opendata.swiss) │
│ api_client.py │ └──────────────────────────┘
│ LV95 conversion │
│ GeoAdmin queries │
└───────────────────────────┘
Infrastructure Components
| Component | Metaphor | Function |
|---|---|---|
api_client.py |
Switchboard | Handles HTTP requests, coordinate conversion, error handling |
| LV95 converter | Translator | Converts WGS84 (lat/lon) to Swiss coordinate system |
server.py |
Storefront | Exposes all 10 tools via FastMCP |
Project Structure
swiss-energy-mcp/
├── src/
│ └── swiss_energy_mcp/
│ ├── server.py # FastMCP setup, lifespan, entry point
│ ├── settings.py # Typed configuration (pydantic-settings)
│ ├── logging_config.py # Structured JSON logging to stderr
│ ├── api_client.py # HTTP client, egress guard, LV95 conversion
│ ├── models.py # Pydantic input/output models
│ ├── formatting.py # Markdown summary builders
│ ├── resources.py # Layer-catalogue resource + prompt
│ └── tools/ # One module per tool group
│ ├── installations.py # power, wind, hydro, PV, biogas
│ ├── places.py # solar, Energiestadt, location profile
│ └── catalog.py # dataset search, status
├── tests/
│ ├── test_unit.py # Pure-unit tests (coords, formatting, egress)
│ ├── test_tools.py # Tool tests with respx-mocked APIs
│ └── test_live.py # Live integration tests (marked `live`)
├── docs/ # roadmap.md, security.md
├── Dockerfile # Multi-stage build, non-root user
├── pyproject.toml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md # This file (English)
└── README.de.md # German version
Known Limitations
- GeoAdmin radius search: Maximum search radius depends on layer density; very large radii may return partial results
- Solar potential: Layer
ch.bfe.solarenergie-eignung-daechercovers building footprints — not all roof types are classified - Energiestadt: Only municipalities with active label are included; historical entries may be incomplete
- opendata.swiss CKAN: Full-text search covers metadata only, not document contents
Testing
# Unit tests (no API key required)
PYTHONPATH=src pytest tests/ -m "not live"
# Live integration tests (network access required)
PYTHONPATH=src pytest tests/ -m "live"
Changelog
See CHANGELOG.md
Contributing
See CONTRIBUTING.md
License
MIT License — see LICENSE
Author
Hayal Oezkan · malkreide
Credits & Related Projects
- Data: SFOE/BFE via GeoAdmin — Swiss Federal Office of Energy
- Data: opendata.swiss — Swiss Open Government Data portal
- Protocol: Model Context Protocol — Anthropic / Linux Foundation
- Related: swiss-road-mobility-mcp — MCP server for Swiss mobility data
- Related: zurich-opendata-mcp — MCP server for Zurich city open data
- Portfolio: Swiss Public Data MCP Portfolio
Project details
Release history Release notifications | RSS feed
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 swiss_energy_mcp-0.2.1.tar.gz.
File metadata
- Download URL: swiss_energy_mcp-0.2.1.tar.gz
- Upload date:
- Size: 54.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6046f21e4555cac2046e31df9d739e56f4f6a8f66af06df7eaa117165cdae761
|
|
| MD5 |
ff3234e1544b3b65acfc7c1eb6e6dd94
|
|
| BLAKE2b-256 |
fa1661abdd7b67975d6f98f48173030266ef331bb49acb515d7e1c06f3537b7c
|
Provenance
The following attestation bundles were made for swiss_energy_mcp-0.2.1.tar.gz:
Publisher:
publish.yml on malkreide/swiss-energy-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swiss_energy_mcp-0.2.1.tar.gz -
Subject digest:
6046f21e4555cac2046e31df9d739e56f4f6a8f66af06df7eaa117165cdae761 - Sigstore transparency entry: 1574256820
- Sigstore integration time:
-
Permalink:
malkreide/swiss-energy-mcp@36ef8748ab880ccb62c46df1951b4f9c7b21b92e -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/malkreide
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@36ef8748ab880ccb62c46df1951b4f9c7b21b92e -
Trigger Event:
release
-
Statement type:
File details
Details for the file swiss_energy_mcp-0.2.1-py3-none-any.whl.
File metadata
- Download URL: swiss_energy_mcp-0.2.1-py3-none-any.whl
- Upload date:
- Size: 30.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17a4de59e4394aaed67f061818ed51506525c03eedfff100c51c3d840a6c2d1c
|
|
| MD5 |
f8d369ee638f332c242d87f808d06ed3
|
|
| BLAKE2b-256 |
b5784b30a8a8b5595c49b998511a7556e33cfb1f8f3363deed78a38335dc9507
|
Provenance
The following attestation bundles were made for swiss_energy_mcp-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on malkreide/swiss-energy-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swiss_energy_mcp-0.2.1-py3-none-any.whl -
Subject digest:
17a4de59e4394aaed67f061818ed51506525c03eedfff100c51c3d840a6c2d1c - Sigstore transparency entry: 1574256890
- Sigstore integration time:
-
Permalink:
malkreide/swiss-energy-mcp@36ef8748ab880ccb62c46df1951b4f9c7b21b92e -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/malkreide
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@36ef8748ab880ccb62c46df1951b4f9c7b21b92e -
Trigger Event:
release
-
Statement type: