Digital Building Stock Model (DBSM) & AI (MCP)

Digital Building Stock Model (DBSM)

Bridging Geospatial Databases and Artificial Intelligence via the Model Context Protocol (MCP)

PostGIS / Spatial DB DBSM REST API Model Context Protocol (MCP) LLMs & Conversational AI Urban Analytics & Decarbonization

Project Overview

The Digital Building Stock Model (DBSM) stores millions of granular geospatial records—ranging from building footprints and height estimates to total floor area, energy demand, and solar photovoltaic potential across European statistical regions (NUTS1, NUTS2, NUTS3, and LAU level).

While geospatial databases hold immense value for urban decarbonization and climate action, accessing them has historically required specialized GIS skills, spatial SQL knowledge, and custom scripts. By developing a dedicated Model Context Protocol (MCP) server that exposes the DBSM API directly to Large Language Models (LLMs), policy analysts, urban planners, and decision-makers can now ask complex natural-language questions and receive instant, deterministic spatial analytics.

Geospatial Granularity: Building Footprints & LAU Administrative Boundaries
Digital Building Stock Model - Building Footprints & LAU Boundaries

Figure 1: Digital Building Stock Model (DBSM) visualization showcasing individual building footprint geometries (blue polygons) aggregated across Local Administrative Unit (LAU) boundary boundaries. Using the MCP server, AI models can directly query spatial endpoints like get_lau_buildings and search_buildings_bbox to extract granular building statistics without requiring manual GIS software.

The Friction in Traditional GIS Analytics

Unlocking building stock intelligence is critical for regional climate strategies, rooftop solar installation policies, and energy efficiency targets. However, traditional workflows encounter significant barriers:

    Data Fragmentation: Spatial boundaries (NUTS/LAU regions) must be joined across massive building polygon datasets. Skill Barrier: Key decision-makers often lack GIS software proficiency (QGIS/ArcGIS) or spatial SQL expertise. Query Latency: Generating custom aggregations across millions of buildings requires dedicated data engineering cycles.

The Conversational AI Frontier

Generative AI models are natural interfaces for human interaction, but standard LLMs fail when asked for precise spatial statistics—they tend to hallucinate numbers or lack access to up-to-date database records.

The Solution: Deterministic Tool Calling via MCP

Instead of allowing the LLM to guess, the Model Context Protocol (MCP) provides standard, secure contracts that empower the LLM to query the DBSM API directly. The AI handles natural language interpretation, while PostGIS and the DBSM engine perform exact spatial math.


Architecture: How DBSM & MCP Work Together

1. Geospatial Database

PostGIS / Spatial Engine

Stores millions of building geometries, floor area calculations, age classes, and solar potential mapped to NUTS and LAU boundary polygons.

2. DBSM REST API

High-Performance Endpoints

Exposes high-level aggregation and filtering endpoints (e.g. regional rankings, bounding box queries, statistical comparisons).

3. MCP Server Layer

Model Context Protocol

Defines structured JSON schemas and tool capabilities, allowing LLMs to auto-discover and safely invoke spatial functions.

4. LLM & User Interface

Natural Language Insights

Interprets plain English queries, invokes the appropriate MCP tool, and formats structured responses into clear executive summaries.


Standardized MCP Tools Exposing the DBSM API

The DBSM MCP server exposes a rich suite of geospatial analytics tools. The AI assistant dynamically selects the exact tool based on the user's inquiry:

MCP Tool Name Geospatial Capability Sample Natural Language Prompt
get_country_nuts_stats Aggregates building counts, floor area, and solar metrics across NUTS1/2/3 regions. "What is the total residential floor area and solar potential in NUTS2 regions of Austria?"
compare_regions Performs side-by-side comparative analysis of building stock density and age between regions. "Compare the building stock volume and solar potential between Tyrol and Styria."
get_region_ranking Ranks administrative areas by custom metrics (e.g. highest rooftop solar capacity). "Rank all Austrian NUTS3 regions by rooftop solar generation potential."
search_buildings_bbox Retrieves individual building footprints and parameters within a bounding box. "Find all commercial buildings in central Vienna within a specific bounding box."
lookup_nuts_by_point Resolves geographic point coordinates (latitude/longitude) to specific NUTS/LAU codes. "Which administrative NUTS region does coordinate (48.2082, 16.3738) fall into?"

Natural Language to Spatial Intelligence: In Action

Below is an illustration of how an urban policy analyst interacts with the system:

Policy Analyst Natural Language Query
"Can you break down the total floor area and estimated rooftop solar potential across all NUTS2 regions in Austria?"
⬇️ LLM detects intent ➔ Invokes MCP tool get_country_nuts_stats(country="AUT", level=2) ⬇️
AI Assistant Structured Spatial Response (Powered by DBSM API)

Here is the regional summary of residential building stock and solar potential across Austrian NUTS2 regions:

NUTS2 Region Region Name Building Count Total Floor Area (m²) Est. Rooftop Solar Potential (GWh/yr)
AT11 Burgenland 132,450 24.8 Million 1,420
AT12 Niederösterreich 584,200 112.5 Million 6,150
AT13 Wien (Vienna) 178,900 94.2 Million 3,890
AT21 Kärnten 210,300 38.7 Million 2,240
AT22 Steiermark 415,800 76.1 Million 4,380
AT31 Oberösterreich 492,100 92.4 Million 5,110
Key Insight: Niederösterreich (AT12) and Oberösterreich (AT31) represent over 45% of Austria's total rooftop solar generation capacity, making them prime targets for regional clean energy deployment subsidies.
Live Execution Showcase: Claude (Sonnet) + DBSM MCP Server

The real-world screenshots below illustrate live interactions with Claude (Sonnet) connected directly to the DBSM MCP server. By interpreting plain natural-language prompts, Claude automatically invokes the appropriate DBSM API tools, computes cross-border spatial statistics, generates custom data visualizations, and suggests relevant follow-up investigations.

Claude Sonnet using DBSM API MCP to compare France and Italy building stock

1. Multi-Country Spatial Analytics

User Query: "can you show me the data for France and Italy from DBSM API?"
Claude automatically loads the DBSM-API integration, queries national building metrics (49.8M buildings in France vs. 23.8M in Italy), and delivers high-level spatial insights—observing that Italian residential buildings are on average larger (157.6 m² vs 109.9 m²) and taller (4.8 m vs 4.1 m) due to denser apartment-block urban forms.

Claude rendering bar chart of DBSM API building count data

2. Dynamic Visualizations & Follow-up

Automated Charting & Reasoning: Beyond returning text metrics, Claude converts the spatial payload from the DBSM API into a visual bar chart comparing Building Count by Use Category (Residential, Non-residential, Unassigned) and prompts the user with next logical analytical queries (e.g. NUTS-region breakdowns).

Claude Sonnet rendering NUTS3 region building floor area ranking table and bar chart for Italy using DBSM API MCP

3. NUTS3 Regional Ranking & Charting

User Query: "provide floor area and number of buildings data for the 5 largest NUTS3 in Italy"
Claude invokes the get_country_nuts_stats MCP tool to extract exact spatial statistics from the DBSM API. It constructs a structured ranking table (Roma, Torino, Milano, Salerno, Brescia) highlighting building counts, total floor area, and average building size (e.g. Milano averaging 313.0 m² vs. Roma's 160.0 m²), automatically paired with an interactive bar chart.


Key Benefits of the MCP Approach

    Zero Hallucinations: All statistics come from deterministic PostGIS spatial aggregations, never synthesized text. Democratization of Data: Policy researchers can interact directly with complex geospatial infrastructures without SQL barriers. Real-Time Spatial Reasoning: Combines qualitative AI reasoning with quantitative spatial metrics. Protocol Standard: Built on Model Context Protocol (MCP), ensuring seamless compatibility across different AI agents and platforms.

Looking Ahead

Integrating Model Context Protocol with spatial data infrastructures represents a paradigm shift in urban analytics. Beyond static dashboards and specialized GIS workstations, decision-makers can engage in dynamic dialogues with nationwide digital twins—evaluating climate risks, retrofitting needs, and renewable energy transitions in real time.