swiss-housing-mcp MCP Server
Swiss Register of Buildings and Dwellings (GWR/RegBL): EGID/EWID lookup, geocoding, housing stats
swiss-housing-mcp scores 64 (Good), licensed MIT and written in Python. It installs as a local process. It does not declare tools yet. Filed under Maps and location. GitHub shows 1 stars. Package registries report about 22 downloads a week. Install configs are generated for 12 clients. Being listed in the registry is not the same as being vendor-official.
Good trust
64 of 100 from six public signals. Nobody can buy a point.
- Listed in the official MCP registry.
- OSI-style license: mit.
License, quality and maintenance
Quality: Grade C
65/100 for listing completeness. Lost points: no listed tools, short summary.
How quality is graded
Where the 64 comes from
22 + 20 + 1 + 10 + 4 + 7 = 64. Each factor is capped, so no single signal can carry a listing.
Active in the official MCP registry, plus a known vendor namespace.
Registry: 22 of 30 points.How recently the repository saw a commit or release.
Maintenance: 20 of 20 points.GitHub stars and weekly downloads, on a log scale.
Popularity: 1 of 20 points.A clear, OSI-style open-source license.
License: 10 of 10 points.Not archived, a secure install path, a pinned version.
Security: 4 of 10 points.A real summary, a README with depth, listed tools.
Docs: 7 of 10 points.Install
Pick your client, copy the config, paste it in.
Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.
{ "mcpServers": { "malkreide-swiss-housing-mcp": { "command": "uvx", "args": [ "swiss-housing-mcp" ] } }}
Environment variables
This server does not declare environment variables.
Tools
All capabilitiesTools show up when the registry metadata or the repository README lists them. Public READMEs are read directly. A GitHub token is used only when one is already configured.
About
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
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 |
|---|---|---|---|
api3.geo.admin.ch β¦/find (EGID lookup) | 200 | β works | full attribute set, no auth |
api3.geo.admin.ch β¦/identify (coordinates) | 200 | β works | 77 attributes incl. EGID/EWID |
β¦/SearchServer (address β EGID) | 200 | β works | featureId = {EGID}_{EDID}; axis swap: y=east, x=north |
public.madd.bfs.admin.ch/zh.zip | 200 | β works | 121 MB, daily refresh, contains data.sqlite |
madd.bfs.admin.ch/api/buildings/{egid} | 404 | β excluded | path/auth unclear |
| Invalid EGID on find | 200 | β οΈ soft error | empty results array β not an HTTP error |
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-mcp
Configuration
| Variable | Default | Purpose |
|---|---|---|
SWISS_HOUSING_TRANSPORT | stdio | stdio | streamable-http | sse |
SWISS_HOUSING_CACHE | ~/.cache/swiss-housing-mcp | Dump cache directory |
SWISS_HOUSING_DUMP_TTL_HOURS | 24 | Dump freshness window |
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 eras are measured, not inferred:
tests/test_modern_era.py drives real requests of
each era through this server's own ASGI app β the one __main__.py serves
under SWISS_HOUSING_TRANSPORT=streamable-http β and reads the negotiated
revision off the response body. Alongside it,
tests/test_protocol_version.py pins both
revisions against the installed SDK, so a Dependabot bump of mcp breaks the
build before anyone reads the measurement.
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.
Identity on the modern era. The 2026-07-28 era has no initialize
handshake: a connection is a single request carrying a _meta envelope. So
server/discover is the only channel through which a modern client learns
anything about this server, and the serverInfo block the SDK stamps into
every result is the only place its identity appears. This server therefore
declares version, title, description, websiteUrl and instructions.
description and websiteUrl are read from the package metadata rather than
repeated as literals β the SDK fills none of them in, and an unversioned server
announces an empty version on every single response.
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.
Testing
PYTHONPATH=src pytest tests/ -m "not live" # CI-safe
PYTHONPATH=src pytest tests/ -m live # against real upstream
Project 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 publish
Known 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
- Data: Federal Statistical Office β GWR/RegBL, geo.admin.ch
- Portfolio siblings:
swiss-statistics-mcp(indices, STAT-TAB),zurich-opendata-mcp(city-level data)
Frequently asked questions
What is swiss-housing-mcp MCP Server?
Swiss Register of Buildings and Dwellings (GWR/RegBL): EGID/EWID lookup, geocoding, housing stats
How do I install swiss-housing-mcp MCP Server in Claude Desktop, Cursor, or VS Code?
Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. swiss-housing-mcp MCP Server runs locally from the PyPI package swiss-housing-mcp with the command uvx swiss-housing-mcp.
Is swiss-housing-mcp MCP Server free and open source?
Yes. swiss-housing-mcp MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.
Does swiss-housing-mcp MCP Server support remote (HTTP) connections?
No remote endpoint is listed for swiss-housing-mcp MCP Server. It runs locally on your machine over stdio, started by your MCP client.
How is swiss-housing-mcp MCP Server's trust score calculated?
swiss-housing-mcp MCP Server scores 64 out of 100 (Good). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.
Reviews
No reviews yetβBe the first to review
No published reviews yet. Used it? Tell the next person how it went.
Sign inA verified email is required to review this server.
Add badge to your README
Paste either snippet into the repository README. The image links to this listing.