swiss-housing-mcp
This server provides access to the Swiss Federal Register of Buildings and Dwellings (GWR/RegBL), enabling AI agents to query building data, geocode addresses, analyze construction trends, and decode official register codes.
Look up a building by its federal identifier (EGID): get address, LV95 coordinates, status, category, floor area, dwelling count, and construction year.
Geocode addresses: convert Swiss addresses to EGID/EDID and LV95 coordinates.
List dwellings: retrieve all dwellings in a building with rooms, floor area, floor level, and construction year.
New construction statistics: for a municipality, get yearly counts of new buildings, dwellings, and 4+ room dwellings (family housing proxy) since a given year.
Construction pipeline: see buildings and dwellings currently projected, approved, or under construction in a municipality.
Spatial queries: aggregate building and dwelling counts inside an LV95 bounding box for sub‑municipal analysis (e.g. school districts).
Municipality housing stats: get an overview of housing stock: total buildings, residential buildings, total dwellings, and breakdown by room count.
Decode GWR codes: translate numeric GWR codes into human‑readable labels in German, French, and Italian.
Check cache status: inspect freshness of cantonal data dumps and configured TTL.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@swiss-housing-mcpHow many new dwellings in Zurich since 2020?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
swiss-housing-mcp
Part of the Swiss Public Data MCP Portfolio — open-source MCP servers connecting AI agents to Swiss public data. Private project, independent of any employer or institutional affiliation.
MCP server for the Swiss Federal Register of Buildings and Dwellings (GWR/RegBL) — buildings, dwellings, and the construction pipeline
🎯 Anchor Demo Query
«How many dwellings were newly built in the City of Zurich since 2020, how many with 4+ rooms — and how many are currently under construction?»
Verified against the live dump on 2026-07-24: 16'164 new dwellings since 2020 (27.4% with 4+ rooms — the family-housing proxy), and 7'287 dwellings currently under construction. Dwellings under construction today are households in 1–3 years: the early indicator for school-space planning.
Demo
Related MCP server: swiss-statistics-mcp
Overview
The GWR/RegBL is to buildings what Zefix is to companies: not one data source among many, but the federal register whose identifiers (EGID for buildings, EWID for dwellings) serve as join keys across Swiss administrative data. This server exposes the register's public extract through MCP tools — building lookups, address geocoding, per-municipality construction statistics, sub-municipal bounding-box analysis, and the planning/construction pipeline.
address_to_egid is the plug that makes other data sources EGID-capable: address in, federal identifier and LV95 coordinates out.
Architecture decision
This server uses Architecture B (Hybrid: Dump-first, API-fallback).
Rationale (verified live on 2026-07-24):
The public cantonal dump (
public.madd.bfs.admin.ch/{canton}.zip) is refreshed daily (~05:30 CET) and ships a ready-madedata.sqlitewith tablesbuilding(399'830 rows for ZH),entrance,dwelling(894'631 rows for ZH), andcode. No CSV parsing, no auth.api3.geo.admin.ch(find / identify / SearchServer) works reliably without authentication for single-entity lookups and geocoding, but does not scale to area-wide aggregations (result limits).A MADD REST endpoint probed at
/api/buildings/{egid}returned 404; it is excluded until path and auth status are clarified — no blocker, since all Phase-1 tools work without it.
Consequences:
Cantonal dumps are cached on disk with a 24 h TTL (configurable via
SWISS_HOUSING_DUMP_TTL_HOURS).Aggregations and spatial queries run as read-only SQL against the cached SQLite; single lookups and geocoding hit the live API.
Every response carries
source(attribution) andprovenance(daily_dump|live_api|cached).
Live probe findings (2026-07-24)
Endpoint | HTTP | Status | Note |
| 200 | ✅ works | full attribute set, no auth |
| 200 | ✅ works | 77 attributes incl. EGID/EWID |
| 200 | ✅ works |
|
| 200 | ✅ works | 121 MB, daily refresh, contains |
| 404 | ❌ excluded | path/auth unclear |
Invalid EGID on find | 200 | ⚠️ soft error | empty |
Features
lookup_building(egid)— single building by federal identifier (live API)address_to_egid(address)— geocode any Swiss address to EGID/EDID + LV95lookup_dwellings(egid)— all dwellings of a building with rooms, area, floornew_construction(municipality_bfs, since_year)— yearly new construction incl. 4+ room family-housing shareconstruction_pipeline(municipality_bfs)— projected / approved / under constructionbuildings_in_bbox(e_min, n_min, e_max, n_max)— sub-municipal analysis (e.g. school districts)municipality_housing_stats(municipality_bfs)— housing stock and room-size mixexplain_code(attribute, code)— decode GWR codes via the official DE/FR/IT code tabledump_status()— cache freshness, graceful-degradation entry point
Prerequisites
Python 3.10+
~130 MB disk per cached cantonal dump (ZH)
No API keys — Phase 1 is authentication-free
Installation
uvx swiss-housing-mcp # once published on PyPI
# or from source
pip install -e .Usage / Quickstart
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"swiss-housing": {
"command": "uvx",
"args": ["swiss-housing-mcp"]
}
}
}Cloud (Render/Railway):
SWISS_HOUSING_TRANSPORT=streamable-http PORT=8000 swiss-housing-mcpConfiguration
Variable | Default | Purpose |
|
|
|
|
| Dump cache directory |
|
| Dump freshness window |
Testing
PYTHONPATH=src pytest tests/ -m "not live" # CI-safe
PYTHONPATH=src pytest tests/ -m live # against real upstreamProject Structure
swiss-housing-mcp/
├── src/swiss_housing_mcp/
│ ├── server.py # FastMCP tools (9)
│ ├── gwr.py # Dump store + geo.admin.ch client + retry
│ ├── models.py # Pydantic v2 envelopes (source + provenance)
│ └── __main__.py # Dual-transport entry point
├── tests/ # respx-mocked + @pytest.mark.live
└── .github/workflows/ # CI + OIDC PyPI publishKnown Limitations
The public extract omits person-related and some sensitive attributes of the full GWR; official data deliveries to authorities go through the BFS/MADD channel.
Coordinates are building reference points (LV95), not footprint polygons — polygon joins (e.g. exact school-district boundaries) need external geometries;
buildings_in_bboxcovers the rectangular approximation.GBAUJ(construction year) is missing for a share of older buildings; period codes (GBAUP) exist as fallback but are not yet exposed.Municipality→canton resolution is seeded for common cases; pass
cantonexplicitly for others.Housing-market indices (IMPI, construction price index, vacancy rate) deliberately live in
swiss-statistics-mcp— this server is the register layer, not the statistics layer.
Changelog
See CHANGELOG.md
Contributing
Contributions are welcome — see CONTRIBUTING.md (Deutsch).
Security
Read-only, no PII, no authentication — a public federal register accessed through a fixed set of endpoints. See SECURITY.md (Deutsch) for the full posture and how to report a vulnerability.
License
MIT License — see LICENSE. Data: GWR/RegBL, Swiss Federal Statistical Office (BFS), open government data with attribution.
Author
Hayal Oezkan · github.com/malkreide
Credits & Related Projects
Portfolio siblings:
swiss-statistics-mcp(indices, STAT-TAB),zurich-opendata-mcp(city-level data)
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityCmaintenanceExposes ATTOM's real estate API as MCP tools, enabling property details, valuations, assessments, sales, and area data via natural language.2
- AlicenseAqualityAmaintenanceProvides AI-native access to Swiss Federal Statistical Office datasets through 9 tools for querying education, population, and cross-cantonal comparisons without authentication.152MIT
- AlicenseBqualityDmaintenanceMCP server exposing all major Swiss official public APIs as native tools for any MCP-compatible AI agent.3412MIT
- AlicenseAqualityAmaintenanceMCP server for Switzerland's national metadata catalogue, enabling AI agents to discover datasets, APIs, public services, and publishers through free-text search and structured queries.13MIT
Related MCP Connectors
MCP server for Japan geodata: cadastral lot numbers (chiban) and reverse geocoding, for AI agents.
Singapore property & financial data APIs for AI agents. 27 MCP tools. x402 micropayments.
Official permit, licensing, compliance, and civic-record tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/malkreide/swiss-housing-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server