swiss-housing-mcp
swiss-housing-mcp
Swiss Public Data MCP Portfolio의 일부 — AI 에이전트를 스위스 공공 데이터에 연결하는 오픈소스 MCP 서버. 개인 프로젝트로, 고용주나 기관과 무관합니다.
스위스 연방 건축물·주거등록부(GWR/RegBL)용 MCP 서버 — 건축물, 주거, 건설 파이프라인
🎯 앵커 데모 쿼리
«2020년 이후 취리히 시에 새로 지어진 주거는 몇 채이며, 그중 4개 이상의 방을 가진 주거는 몇 채인가 — 그리고 현재 공사 중인 주거는 몇 채인가?»
2026-07-24 라이브 덤프 기준 검증 완료: 2020년 이후 신규 주거 16,164채(그중 27.4%가 4개 이상의 방 — 가족용 주거 대리 지표), 현재 공사 중인 주거 7,287채. 오늘 공사 중인 주거는 1~3년 후의 가구 수를 의미합니다: 학교 공간 계획을 위한 조기 지표입니다.
데모
Related MCP server: swiss-statistics-mcp
개요
GWR/RegBL은 건축물에 있어 Zefix가 기업에 해당하는 존재입니다: 많은 데이터 소스 중 하나가 아니라, 그 식별자(건축물은 EGID, 주거는 EWID)가 스위스 행정 데이터 전반의 조인 키로 사용되는 연방 등록부입니다. 이 서버는 등록부의 공개 추출본을 MCP 도구로 제공합니다 — 건축물 조회, 주소 지오코딩, 지자체별 건설 통계, 지자체 내 경계상자 분석, 계획·건설 파이프라인.
address_to_egid는 다른 데이터 소스를 EGID 호환으로 만드는 플러그입니다: 주소 입력, 연방 식별자와 LV95 좌표 출력.
아키텍처 결정
이 서버는 아키텍처 B(하이브리드: 덤프 우선, API 폴백) 를 사용합니다.
근거(2026-07-24 라이브 검증):
공개 칸톤 덤프(
public.madd.bfs.admin.ch/{canton}.zip)는 매일(~05:30 CET) 갱신되며,building(ZH 기준 399,830행),entrance,dwelling(ZH 기준 894,631행),code테이블이 포함된 준비된data.sqlite를 제공합니다. CSV 파싱도, 인증도 필요 없습니다.api3.geo.admin.ch(find / identify / SearchServer)는 단일 개체 조회와 지오코딩에 인증 없이 안정적으로 작동하지만, 광역 집계에는 확장되지 않습니다(결과 제한)./api/buildings/{egid}에서 프로브한 MADD REST 엔드포인트는 404를 반환했습니다. 경로와 인증 상태가 명확해질 때까지 제외됩니다 — 1단계 도구가 모두 이 엔드포인트 없이 작동하므로 차단 요인은 아닙니다.
결과:
칸톤 덤프는 24시간 TTL(
SWISS_HOUSING_DUMP_TTL_HOURS로 설정 가능)로 디스크에 캐시됩니다.집계와 공간 쿼리는 캐시된 SQLite에 대한 읽기 전용 SQL로 실행되며, 단일 조회와 지오코딩은 라이브 API를 사용합니다.
모든 응답에는
source(출처)와provenance(daily_dump|live_api|cached)가 포함됩니다.
라이브 프로브 결과(2026-07-24)
엔드포인트 | HTTP | 상태 | 비고 |
| 200 | ✅ 작동 | 전체 속성 세트, 인증 불필요 |
| 200 | ✅ 작동 | EGID/EWID 포함 77개 속성 |
| 200 | ✅ 작동 |
|
| 200 | ✅ 작동 | 121MB, 매일 갱신, |
| 404 | ❌ 제외 | 경로/인증 불명확 |
find의 잘못된 EGID | 200 | ⚠️ 소프트 오류 | 빈 |
기능
lookup_building(egid)— 연방 식별자로 단일 건축물 조회(라이브 API)address_to_egid(address)— 모든 스위스 주소를 EGID/EDID + LV95로 지오코딩lookup_dwellings(egid)— 건축물의 모든 주거 조회(방 수, 면적, 층 포함)new_construction(municipality_bfs, since_year)— 연도별 신규 건설(4개 이상 방의 가족용 주거 비율 포함)construction_pipeline(municipality_bfs)— 계획 / 승인 / 공사 중buildings_in_bbox(e_min, n_min, e_max, n_max)— 지자체 내 분석(예: 학군)municipality_housing_stats(municipality_bfs)— 주거 재고 및 방 크기 구성explain_code(attribute, code)— 공식 DE/FR/IT 코드 테이블로 GWR 코드 해독dump_status()— 캐시 신선도, 우아한 성능 저하 진입점
사전 요구 사항
Python 3.10+
칸톤 덤프 1개당 디스크 약 130MB(ZH 기준)
API 키 불필요 — 1단계는 인증 없음
설치
uvx swiss-housing-mcp # once published on PyPI
# or from source
pip install -e .사용법 / 빠른 시작
Claude Desktop(claude_desktop_config.json):
{
"mcpServers": {
"swiss-housing": {
"command": "uvx",
"args": ["swiss-housing-mcp"]
}
}
}클라우드(Render/Railway):
SWISS_HOUSING_TRANSPORT=streamable-http PORT=8000 swiss-housing-mcp구성
변수 | 기본값 | 용도 |
|
|
|
|
| 덤프 캐시 디렉터리 |
|
| 덤프 신선도 창 |
MCP 프로토콜 버전
이 서버는 동일한 엔드포인트에서 두 프로토콜 시대를 지원합니다. 연결 시 클라이언트의 첫 요청이 어느 시대가 적용될지 결정하며, 다른 시대의 이후 주장은 거부됩니다.
시대 | 개정판 | 도달 대상 |
|
| 오늘날 클라이언트가 사용하는 버전. 서버는 요청된 개정판으로 응답하거나, 요청이 더 새로운 것을 요구할 경우 |
요청별 봉투 |
|
|
두 개정판 모두
tests/test_protocol_version.py에 고정되어 있으며
설치된 SDK에 대해 검증되므로, mcp의 Dependabot 업데이트가 둘 중 하나를 조용히 이동시킬 수 없습니다. 이 서버는 initialize를 보낼 ASGI 앱을 구축하지 않으므로, 게이트는 측정된 응답이 아닌 SDK 상수를 검증합니다 — 더 약한 형태이지만, 언급되지 않은 채로 두는 것보다는 낫습니다.
SDK의 LATEST_PROTOCOL_VERSION은 최신 시대의 별칭이지 핸드셰이크 시대의 별칭이 아님에 유의하십시오 — 이에만 고정하면 현재 클라이언트가 실제로 협상하는 시대가 자유롭게 표류할 수 있습니다.
업데이트 정책. 게이트가 실패하면 상수를 맹목적으로 편집하지 마십시오: 두 개정판 사이의 사양 변경 로그를 읽고, 서버가 여전히 올바르게 작동하는지 확인한 다음, 상수, 이 섹션, README.de.md, CHANGELOG.md를 함께 이동하십시오.
테스트
PYTHONPATH=src pytest tests/ -m "not live" # CI-safe
PYTHONPATH=src pytest tests/ -m live # against real upstream프로젝트 구조
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알려진 제한 사항
공개 추출본은 전체 GWR의 개인 관련 및 일부 민감 속성을 생략합니다. 당국에 대한 공식 데이터 전달은 BFS/MADD 채널을 통해 이루어집니다.
좌표는 건축물 기준점(LV95)이며, 건물 외곽선 폴리곤이 아닙니다 — 폴리곤 조인(예: 정확한 학군 경계)에는 외부 지오메트리가 필요합니다.
buildings_in_bbox는 직사각형 근사치를 다룹니다.GBAUJ(건축 연도)는 오래된 건축물의 일부에서 누락되어 있습니다. 기간 코드(GBAUP)가 폴백으로 존재하지만 아직 노출되지 않았습니다.지자체→칸톤 해석은 일반적인 경우에 대해 시드되어 있습니다. 다른 경우에는
canton을 명시적으로 전달하십시오.주택 시장 지수(IMPI, 건설 가격 지수, 공실률)는 의도적으로
swiss-statistics-mcp에 있습니다 — 이 서버는 등록부 계층이지 통계 계층이 아닙니다.
변경 로그
CHANGELOG.md 참조
기여
기여를 환영합니다 — CONTRIBUTING.md(독일어) 참조.
보안
읽기 전용, 개인 식별 정보 없음, 인증 없음 — 고정된 엔드포인트 세트를 통해 접근하는 공개 연방 등록부입니다. 전체 보안 태세와 취약점 신고 방법은 SECURITY.md(독일어)를 참조하십시오.
라이선스
MIT 라이선스 — LICENSE 참조. 데이터: GWR/RegBL, 스위스 연방 통계청(BFS), 출처 표시가 있는 오픈 정부 데이터.
저자
Hayal Oezkan · github.com/malkreide
크레딧 및 관련 프로젝트
포트폴리오 자매 프로젝트:
swiss-statistics-mcp(지수, STAT-TAB),zurich-opendata-mcp(도시 수준 데이터)
Available Tools
5 toolsconstruction_pipelineBRead-only
Buildings and dwellings in the planning/construction pipeline of a municipality.
Breaks down by status: projected (GSTAT 1001), approved (1002), under construction (1003). Dwellings under construction today are households in 1-3 years — the early indicator for school-space planning.
| Name | Required | Description | Default |
|---|---|---|---|
| canton | No | ||
| municipality_bfs | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| note | No | |
| source | No | |
| pipeline | Yes | |
| provenance | Yes | |
| municipality | Yes | |
| municipality_bfs | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, so the description's additional information about status breakdowns and the interpretation of 'under construction' as an early indicator adds useful behavioral context. However, it does not disclose potential limitations like data availability by municipality or time-range constraints.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three concise sentences: the first states the core purpose, the second details the status categories, and the third explains the practical implication. Every sentence adds value, and the content is front-loaded with the most critical information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the presence of an output schema and the tool's moderate complexity, the description covers the data meaning and use case. However, it omits parameter semantics and does not specify what the output contains or how to interpret the status codes fully (though codes are listed). The description is adequate but not comprehensive.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0% description coverage for its two parameters (canton, municipality_bfs). The description does not mention these parameters or provide any guidance on their values, formats, or roles. With no schema descriptions and no parameter information in the description, the agent receives no help beyond the schema structure.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly specifies the tool retrieves buildings and dwellings in the planning/construction pipeline of a municipality, with explicit breakdowns by status codes. This verb-resource combination is distinct from sibling tools like lookup_dwellings (likely existing dwelling data) and new_construction (new building registrations). The context of early indicator for school-space planning further differentiates its use case.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for getting pipeline data for a municipality and hints at its value for school-space planning, but it does not explicitly state when to prefer this tool over siblings or when not to use it. No exclusions or alternative recommendations are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dump_statusARead-only
Cache status of the cantonal GWR dumps (graceful-degradation entry point).
Always returns an evaluable status — never silently empty records. If a source is unreachable, this tool tells you when data was last refreshed.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| note | Yes | |
| dumps | Yes | |
| source | No | |
| ttl_hours | Yes | |
| provenance | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true. The description adds value by stating the tool never returns empty records and reports last refresh time, which is beyond what annotations provide. No contradictions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, no wasted words. The key information is front-loaded and every sentence contributes meaning.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given zero parameters and the existence of an output schema, the description adequately covers the tool's behavior and return value. It is sufficient for the agent to understand what to expect, though it doesn't detail the output structure.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
No parameters exist, so the baseline is 4. The description correctly adds no parameter information since none are needed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool shows cache status of GWR dumps with graceful degradation. It is distinct from sibling tools like lookup_dwellings which retrieve data. No explicit differentiation from siblings, but the purpose is clear.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for checking cache health even when sources are unreachable, but does not explicitly state when to use it over alternatives. It provides context but no exclusions or direct guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
explain_codeARead-only
Decode a GWR code value (e.g. GSTAT=1004, GKAT=1020) into human-readable labels.
Uses the official code table shipped with the dump (DE/FR/IT).
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| canton | No | zh | |
| attribute | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| source | No | |
| provenance | Yes | |
| explanations | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, so the read-only nature is clear. The description adds value by specifying the source of the labels (official code table) and the supported languages (DE/FR/IT), going beyond what annotations provide.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise at two sentences, but the second sentence could be more structured or broken into bullet points for clarity. No superfluous information, but room for slight improvement.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (3 params, no enums) and the presence of an output schema, the description adequately covers the main purpose. However, it lacks explanation for the optional parameter and does not mention the output schema's structure, resulting in moderate completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description bears the full burden of explaining parameters. It includes an example of 'attribute' and 'code' but does not describe the optional 'canton' parameter at all, leaving a gap in understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool decodes GWR code values into human-readable labels, with a specific verb and resource. It provides an example of inputs (GSTAT=1004) and distinguishes itself from sibling tools that handle different tasks.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies use for decoding codes from a specific code table, but does not explicitly state when to use this tool vs alternatives, nor does it mention any prerequisites or when not to use it. Sibling tools have different purposes, so some implicit differentiation exists.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
lookup_dwellingsARead-only
List all dwellings (EWID) of a building from the daily cantonal dump.
Includes rooms, floor area, floor and status per dwelling.
| Name | Required | Description | Default |
|---|---|---|---|
| egid | Yes | ||
| canton | No | zh |
Output Schema
| Name | Required | Description |
|---|---|---|
| egid | Yes | |
| count | Yes | |
| source | No | |
| dwellings | Yes | |
| provenance | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true. The description adds context (data source 'daily cantonal dump' and included fields) but does not disclose behavior beyond that, such as error handling or permissions. No contradiction with annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise (two sentences) and front-loaded with the core action. However, it could be slightly more structured with bullet points for clarity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a read-only list tool with an output schema, the description adequately mentions included fields but omits explanation of the required 'egid' parameter and the default value for 'canton'. The data source reference is vague.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description should explain parameters. However, it does not mention 'egid' as building ID or 'canton''s role. It only references 'a building' implicitly, leaving parameter semantics unclear.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'List all dwellings (EWID) of a building' and specifies included attributes (rooms, floor area, floor, status). This distinguishes it from sibling tools like new_construction or dump_status.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied but not explicit. The description does not mention when to use this tool versus alternatives, nor does it provide conditions for appropriate use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
new_constructionBRead-only
New residential construction per year for a municipality (existing buildings).
Returns buildings, dwellings and 4+ room dwellings per year — the 4+ room share is a proxy for family housing and thus for future pupil numbers. Municipality is identified by its BFS number (e.g. 261 = City of Zurich).
| Name | Required | Description | Default |
|---|---|---|---|
| canton | No | ||
| since_year | No | ||
| municipality_bfs | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| source | No | |
| per_year | Yes | |
| provenance | Yes | |
| since_year | Yes | |
| municipality | Yes | |
| total_dwellings | Yes | |
| family_share_pct | Yes | Share of 4+ room dwellings — proxy for family housing |
| municipality_bfs | Yes | |
| total_dwellings_4plus_rooms | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate readOnlyHint=true. Description adds context about the 4+ room share being a proxy for family housing, but does not disclose any additional behavioral traits such as data source, update frequency, or limitations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Description is two sentences, efficiently conveying core purpose and a key interpretation note. No redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With an output schema present, return value explanation is not needed. However, the description lacks usage context and does not fully cover parameters. Adequate but with gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%. Description only explains municipality_bfs with an example. Parameters canton and since_year are not described at all, leaving their semantics unclear.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states it returns annual new residential construction data for a municipality, including buildings, dwellings, and 4+ room dwellings. However, phrasing 'existing buildings' may cause confusion about whether it covers new construction or existing stock.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus siblings like lookup_dwellings or construction_pipeline. Does not mention alternatives or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v0.1.0- First observed
construction_pipeline - First observed
dump_status - First observed
explain_code - First observed
lookup_dwellings - First observed
new_construction
TDQS
Scored across 5 tools
Each tool targets a distinct aspect: listing dwellings, historical construction, pipeline, code explanation, and cache status. There is no overlap or ambiguity in their purposes.
Tool names mix patterns: verb_noun (lookup_dwellings, explain_code), adjective_noun (new_construction), and noun_noun (construction_pipeline, dump_status). While readable, the lack of a uniform pattern reduces consistency.
Five tools is well-scoped for a niche domain like Swiss housing data. Each tool serves a clear function without excess or deficiency.
The tools cover current dwelling data, historical construction, future pipeline, code decoding, and system status. A minor gap is the lack of a dedicated building-level query beyond dwellings, but the set supports the stated planning use case.
Maintenance
Related MCP Connectors
- geoOAuthco.thinair
Geocoding, routing, isochrones, traffic, weather, and place search for AI agents. 19 MCP tools.
CompanyLens is a remote MCP server giving AI agents instant access to official company registry data across 19 jurisdictions in Europe, the Americas, and Asia-Pacific. Eighteen read-only tools let you search companies and people, look up officers and beneficial owners, map corporate networks through shared directors, screen names against the UK disqualified directors register, find every company at a registered address, and pull filing history — all from a single connector. Visit our website: https://companylens.io
Agent-native MCP server over 49M+ US public and government records, privacy-first, always current.
Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceExposes 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.345 npmMIT
- 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