Skip to main content
Glama
swiss-energy-mcp

swiss-energy-mcp

by malkreide

πŸ‡¨πŸ‡­ Part of the Swiss Public Data MCP Portfolio

⚑ swiss-energy-mcp

Version License: MIT Python 3.11+ MCP Data Source Tests CI

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.

πŸ‡©πŸ‡ͺ Deutsche Version


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


Related MCP server: swiss-statistics-mcp

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) or pip


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.elektrizitaetsproduktionsanlagen

  • ch.bfe.windenergieanlagen

  • ch.bfe.statistik-wasserkraftanlagen

  • ch.bfe.photovoltaik-grossanlagen

  • ch.bfe.biogasanlagen

  • ch.bfe.energiestaedte

  • ch.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_ALLOWED_HOSTS

(empty)

Comma-separated inbound Host allow-list. Only needed for a non-loopback bind.

SWISS_ENERGY_LOG_LEVEL

INFO

Log level: DEBUG / INFO / WARNING / ERROR

SWISS_ENERGY_HTTP_TIMEOUT

20

Upstream HTTP timeout in seconds

Both list-valued variables also accept a JSON array β€” ["https://a.test"] β€” in addition to the comma-separated form.

See .env.example for a template.


MCP Protocol Version

This server speaks two protocol eras over the same endpoint. The client's first request on a connection decides which one applies; a later claim from the other era is refused.

Era

Revision

Who reaches it

initialize handshake

2024-11-05 … 2025-11-25

What today's clients speak. The server answers with the revision asked for, or with the 2025-11-25 ceiling when the request asks for something newer.

Per-request envelope

2026-07-28

A request carrying the 2026-07-28 _meta envelope opens a modern connection.

Both revisions are pinned in tests/test_protocol_version.py and asserted against the installed SDK, so a Dependabot bump of mcp cannot move either one silently. The handshake ceiling is measured against a live initialize through the assembled ASGI stack, not read off a constant name.

Note that the SDK's LATEST_PROTOCOL_VERSION is an alias for the modern era, not for the handshake era β€” pinning against it alone would leave the era that current clients actually negotiate free to drift.

Update policy. When the gate fails, do not edit the constant blindly: read the spec changelog between the two revisions, verify the server still behaves, then move the constant, this section, README.de.md and CHANGELOG.md together.

Server identity

Every modern-era response carries the server's identity under _meta["io.modelcontextprotocol/serverInfo"]; the handshake era carries the same block once, in initialize.serverInfo:

{
  "name": "swiss_energy_mcp",
  "title": "Swiss Energy MCP",
  "version": "<version from the package metadata>",
  "websiteUrl": "https://github.com/malkreide/swiss-energy-mcp"
}

version comes from the installed package metadata, never from a literal in src/ β€” scripts/check_version_sync.py rejects a hand-maintained number there. Both eras are measured through the assembled ASGI stack in tests/test_server_identity.py: the SDK default for version is the empty string, so a missing constructor argument is silent rather than red.

MCP Primitives

The server uses all three MCP primitives:

  • Tools β€” 10 read-only tools (see above). Every search tool returns an EnergyResponse envelope: structured results plus a Markdown summary, explicit source / license attribution, and a match_type field.

  • 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          # Contribution guide (English)
β”œβ”€β”€ CONTRIBUTING.de.md       # Contribution guide (German)
β”œβ”€β”€ SECURITY.md              # Security policy (English)
β”œβ”€β”€ SECURITY.de.md           # Security policy (German)
β”œβ”€β”€ 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-daecher covers 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 (πŸ‡©πŸ‡ͺ Deutsch)


Security

See SECURITY.md (πŸ‡©πŸ‡ͺ Deutsch) for the security policy and posture summary, and docs/security.md for the full technical security model.


License

MIT License β€” see LICENSE


Author

Hayal Oezkan Β· malkreide


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-energy-mcp": {
      "command": "uvx",
      "args": [
        "swiss-energy-mcp"
      ]
    }
  }
}

Available Tools

10 tools
energy_check_statusA
Read-only

PrΓΌft die VerfΓΌgbarkeit der GeoAdmin- und opendata.swiss-APIs.

<use_case>Diagnose bei unerwartetem Verhalten, Monitoring.</use_case> <important_notes>FΓΌhrt zwei leichtgewichtige Test-Requests aus.</important_notes>

Inputs: no named parameters. Returns: Response of the energy_check_status tool.

energy_find_biogas_plantsA
Read-onlyIdempotent

Sucht Biogasanlagen im Umkreis eines Standorts. Biogasanlagen erzeugen Energie aus organischen AbfΓ€llen und Biomasse.

<use_case>Recherche zu Biomasse-Energie, regionale Kreislaufwirtschaft.</use_case> <important_notes>Quelle: ch.bfe.biogasanlagen.</important_notes> lat=47.4, lon=8.5, radius_m=25000

Inputs: params (required). Returns: Standard envelope returned by every search/list tool.

energy_find_energy_citiesA
Read-onlyIdempotent

Sucht Gemeinden mit dem Label Β«EnergiestadtΒ» per Name oder Standort.

<use_case>Vergleich der Energiepolitik von Gemeinden, kommunale Recherche.</use_case> <important_notes>Quelle: ch.bfe.energiestaedte. Entweder name ODER lat/lon angeben β€” nicht beides leer lassen.</important_notes> name='ZΓΌrich' | lat=47.35, lon=8.65, radius_m=50000

Inputs: params (required). Returns: Standard envelope returned by every search/list tool.

energy_find_hydro_plantsA
Read-onlyIdempotent

Sucht Wasserkraftwerke (Lauf-, Speicher-, Pumpspeicher) im Umkreis eines Standorts inkl. Leistung, FallhΓΆhe und erwarteter Jahresproduktion.

<use_case>Analyse der regionalen Wasserkraft, Infrastruktur-Recherche.</use_case> <important_notes>Quelle: ch.bfe.statistik-wasserkraftanlagen.</important_notes> lat=47.05, lon=8.31, radius_m=30000

Inputs: params (required). Returns: Standard envelope returned by every search/list tool.

energy_find_power_plantsA
Read-onlyIdempotent

Sucht ElektrizitΓ€tsproduktionsanlagen aller Typen (Photovoltaik, Wasserkraft, Wind, Biomasse, Kernkraft) im Umkreis eines Standorts.

<use_case>Standortanalysen, politische und journalistische Recherche, Schul- und Verwaltungsprojekte zur lokalen Stromproduktion.</use_case> <important_notes>Quelle: BFE-Layer ch.bfe.elektrizitaetsproduktionsanlagen. Optionaler category_filter grenzt auf einen Anlagentyp ein. Liefert max. 201 Treffer pro Aufruf.</important_notes> lat=46.948, lon=7.447, radius_m=20000, category_filter='Photovoltaik'

Inputs: params (required). Returns: Standard envelope returned by every search/list tool.

energy_find_pv_installationsA
Read-onlyIdempotent

Sucht Photovoltaik-Grossanlagen im Umkreis eines Standorts inkl. Leistung (MWp), Jahres- und Winterproduktion sowie Projektstatus.

<use_case>Recherche zu PV-Grossprojekten, Energieplanung.</use_case> <important_notes>Quelle: ch.bfe.photovoltaik-grossanlagen. Erfasst nur Grossanlagen β€” Einzel-PV erscheint in energy_find_power_plants.</important_notes> lat=46.2, lon=7.5, radius_m=40000

Inputs: params (required). Returns: Standard envelope returned by every search/list tool.

energy_find_wind_turbinesA
Read-onlyIdempotent

Sucht Windenergieanlagen im Umkreis eines Standorts inkl. Betreiber, Hersteller, Modell, NabenhΓΆhe und Leistung.

<use_case>Recherche zu Windkraft-Standorten, regionale Energieplanung.</use_case> <important_notes>Quelle: ch.bfe.windenergieanlagen. Windkraft konzentriert sich auf Jura, Wallis und Mittelland β€” fΓΌr landesweite Suchen radius_m bis 50000 m wΓ€hlen oder die Koordinaten anpassen.</important_notes> lat=47.22, lon=7.05, radius_m=30000

Inputs: params (required). Returns: Standard envelope returned by every search/list tool.

energy_location_profileA
Read-onlyIdempotent

Erstellt ein vollstΓ€ndiges Energieprofil fΓΌr einen Standort und aggregiert dafΓΌr fΓΌnf BFE-Layer (Produktionsanlagen, Wind, Wasser, PV-Gross, EnergiestΓ€dte) in einem einzigen Aufruf.

<use_case>Schneller GesamtΓΌberblick fΓΌr Berichte der Stadtverwaltung, Standortentscheide und Demos β€” beantwortet die Anchor-Frage in einem Aufruf.</use_case> <important_notes>Aggregiert mehrere parallele API-Calls; typische Laufzeit unter 5 s. Quelle: GeoAdmin / BFE.</important_notes> lat=47.05, lon=8.31, radius_m=20000

Inputs: params (required). Returns: Standard envelope returned by every search/list tool.

energy_search_bfe_datasetsA
Read-onlyIdempotent

Durchsucht den opendata.swiss-Katalog nach DatensΓ€tzen des Bundesamts fΓΌr Energie (BFE).

<use_case>Auffinden von BFE-Rohdaten und Statistiken, Datenrecherche jenseits der Geo-Layer.</use_case> <important_notes>Liefert Metadaten (Titel, Beschreibung, Formate, Link) β€” keine Rohdaten. Volltextsuche deckt nur Metadaten ab. Paginierung ΓΌber offset.</important_notes> query='wasserkraft', limit=10, offset=0

Inputs: params (required). Returns: Standard envelope returned by every search/list tool.

energy_solar_potentialA
Read-onlyIdempotent

Fragt die Solareignung von DΓ€chern fΓΌr einen Standort ab.

<use_case>Entscheide ΓΌber PV-Anlagen auf SchulhΓ€usern und ΓΆffentlichen GebΓ€uden, Solarpotenzial-Analysen.</use_case> <important_notes>Quelle: ch.bfe.solarenergie-eignung-daecher (Rasterdaten). Kleine Radien liefern evtl. keine Treffer; der Radius wird intern auf mindestens 2000 m angehoben. Eignungsklassen: 1 (sehr gut) bis 5 (nicht geeignet).</important_notes> lat=47.37, lon=8.54, radius_m=3000

Inputs: params (required). Returns: Standard envelope returned by every search/list tool.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 10 tools

    Disambiguation3/5

    Several tools overlap: energy_find_power_plants covers all plant types, while the specific find tools (wind, hydro, PV, biogas) duplicate the same search for a single category. Although descriptions clarify the extra details each specific tool provides, an agent could select the wrong one for a given task. Other tools like energy_solar_potential and energy_check_status are clearly distinct.

    Naming Consistency3/5

    The energy_find_* tools follow a consistent verb_noun pattern, but energy_solar_potential and energy_location_profile use noun phrases, and energy_search_bfe_datasets uses 'search' instead of 'find'. This mix of conventions is readable but not fully consistent.

    Tool Count5/5

    With 10 tools, the server is well-scoped within the ideal 3-15 range. Each tool covers a distinct aspect of Swiss energy data queries, and none feel redundant or unnecessary.

    Completeness4/5

    The server provides comprehensive location-based energy data queries, including a convenient aggregation tool (energy_location_profile). Minor gaps exist: biogas is not explicitly included in the location profile, and there is no direct lookup by plant identifier. Overall, the core domain is well covered.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      87+ specialized tools for German and European energy data. Direct AI access to Marktstammdatenregister (MaStR), ENTSO-E, Redispatch 2.0, and Grid Operations for utilities and datacenters.
      2
      GPL 3.0
    • A
      license
      A
      quality
      B
      maintenance
      Provides AI-native access to Swiss Federal Statistical Office datasets through 9 tools for querying education, population, and cross-cantonal comparisons without authentication.
      3
      15
      42 PyPI
      2
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Connects AI assistants to Swiss environmental data from BAFU, including air quality, hydrology, natural hazards, and open datasets, with no API keys required.
      21
      26 PyPI
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides free energy intelligence APIs for AI agents: solar production estimates, US clean-energy incentives by ZIP, home Energy Node Scores, contractor search, and consented installer routing.
      MIT