Skip to main content
Glama

Bonsai-mcp - Model Context Protocol Integration für IFC über IfcOpenShell und Blender

Bonsai-mcp ist ein Fork von BlenderMCP , der die ursprüngliche Funktionalität um dedizierte Unterstützung für IFC-Modelle (Industry Foundation Classes) über Bonsai (früher BlenderBIM) erweitert. Diese Integration ist eine Plattform, mit der LLMs IFC-Dateien lesen und bearbeiten können.

Merkmale

  • IFC-spezifische Funktionalität : Abfragen von IFC-Modellen, Analysieren räumlicher Strukturen und Untersuchen von Gebäudeelementen

  • Elf IFC-Tools enthalten : Projektinformationen prüfen, Entitäten auflisten, Eigenschaften untersuchen, räumliche Struktur erkunden, Beziehungen analysieren und mehr

  • Sequentielles Denken : Enthält das sequentielle Denktool von modelcontextprotocol/servers für strukturierte Problemlösung

  • Code-Ausführungstool aus der ursprünglichen BlenderMCP-Implementierung : Erstellen und ändern Sie Objekte, wenden Sie Materialien an und führen Sie Python-Code in Blender aus

Related MCP server: BlenderMCP

Komponenten

Das System besteht aus zwei Hauptkomponenten:

  1. Blender-Addon ( addon.py ) : Ein Blender-Addon, das einen Socket-Server innerhalb von Blender erstellt, um Befehle zu empfangen und auszuführen, einschließlich IFC-spezifischer Operationen

  2. MCP-Server ( tools.py ) : Ein Python-Server, der das Model Context Protocol implementiert und eine Verbindung zum Blender-Add-on herstellt

Installation – Über die MCP-Clienteinstellungen

Voraussetzungen

  • Blender 4.0 oder neuer

  • Python 3.12 oder neuer

  • UV-Paketmanager

  • Bonsai BIM-Add-on für Blender (für IFC-Funktionalität)

UV installieren:

Mac:


brew  install  uv

Windows:


powershell  -c  "irm https://astral.sh/uv/install.ps1 | iex"

set  Path=C:\Users\[username]\.local\bin;%Path%

Informationen zu anderen Plattformen finden Sie in der UV-Installationsanleitung .

Klonen Sie das Repository


git  clone  https://github.com/JotaDeRodriguez/Bonsai_mcp

Claude für Desktop-Integration

Bearbeiten Sie Ihre Datei claude_desktop_config.json (Claude > Einstellungen > Entwickler > Konfiguration bearbeiten), um Folgendes einzuschließen:


{
    "mcpServers": {
        "Bonsai-mcp": {
            "command": "uv",
            "args": [
              "--directory",
              "\\your\\path\\to\\Bonsai_mcp",
              "run",
              "tools.py"
          ]
        }
    }
}

Installation über Docker

Das Repository verfügt über eine Docker-Datei, die die Bereitstellung in verschiedenen Umgebungen einfach und konsistent macht.

Schnellstart

# Clone the repository
git clone https://github.com/JotaDeRodriguez/Bonsai_mcp
cd Bonsai_mcp

# Build the Docker image
docker build -t bonsai_mcp .

# Run the container
docker run -p 8000:8000 --name bonsai_mcp bonsai_mcp

Sobald der Container ausgeführt wird, stellt er die MCP-Tools als REST/OpenAPI-APIs unter http://localhost:8000 bereit.

  • Um Ihre Installation zu überprüfen, öffnen Sie Ihren Browser und navigieren Sie zu

  • http://localhost:8000/docs

  • Sie sehen die Swagger-Benutzeroberfläche mit allen verfügbaren Endpunkten

  • Testen Sie einen Endpunkt, indem Sie darauf klicken. Klicken Sie dann auf „Ausprobieren“ und „Ausführen“.

Herstellen einer Verbindung mit Open WebUI oder anderen API-Clients

So verbinden Sie diese API mit Open WebUI:

  1. Gehen Sie in Open WebUI zu Einstellungen > Tool-Server verwalten

  2. Fügen Sie eine neue Verbindung hinzu mit:

    • URL: http://localhost:8000

    • Pfad zur OpenAPI-Spezifikation: /openapi.json

    • Authentifizierung: Keine (sofern nicht anders konfiguriert)

Umgebungsvariablen

Der Docker-Container akzeptiert mehrere Umgebungsvariablen, um sein Verhalten anzupassen:

# Example with custom settings
docker run -p 8000:8000 \
  -e BLENDER_HOST=host.docker.internal \
  -e BLENDER_PORT=9876 \
  -e MCP_HOST=0.0.0.0 \
  -e MCP_PORT=8000 \
  --name bonsai_mcp bonsai_mcp

Installieren des Blender-Add-ons

  1. Laden Sie die Datei addon.py aus diesem Repo herunter

  2. Öffnen Sie Blender

  3. Gehen Sie zu Bearbeiten > Einstellungen > Add-ons

  4. Klicken Sie auf „Installieren…“ und wählen Sie die Datei addon.py aus

  5. Aktivieren Sie das Add-on, indem Sie das Kontrollkästchen neben „Schnittstelle: Blender MCP – IFC“ aktivieren.

Verwendung

Starten der Verbindung

  1. Gehen Sie in Blender zur Seitenleiste „3D-Ansicht“ (drücken Sie N, wenn sie nicht sichtbar ist).

  2. Suchen Sie die Registerkarte „Blender MCP – IFC“

  3. Klicken Sie auf „Mit Claude verbinden“

  4. Stellen Sie sicher, dass der MCP-Server läuft

Verwendung mit Claude

Sobald die Verbindung hergestellt ist, sehen Sie in Claudes Benutzeroberfläche ein Hammersymbol mit Tools für die Blender MCP IFC-Integration.

IFC-Werkzeuge

Dieses Repo enthält neun IFC-spezifische Tools, die eine umfassende Abfrage und Bearbeitung von IFC-Modellen ermöglichen:

get_ifc_project_info : Ruft grundlegende Informationen zum IFC-Projekt ab, einschließlich Name, Beschreibung und Anzahl der verschiedenen Entitätstypen. Beispiel: „Was sind die grundlegenden Informationen zu diesem IFC-Projekt?“

list_ifc_entities : Listet IFC-Objekte eines bestimmten Typs (Wände, Türen, Räume usw.) mit Optionen zum Einschränken der Ergebnisse und Filtern nach Auswahl auf. Beispiel: „Listet alle Wände in diesem IFC-Modell auf“ oder „Zeigt mir die Fenster in diesem Gebäude“

get_ifc_properties : Ruft alle Eigenschaften einer bestimmten IFC-Entität anhand ihrer GlobalID oder der aktuell ausgewählten Objekte ab. Beispiel: „Welche Eigenschaften hat diese Wand mit der ID 1Dvrgv7Tf5IfTEapMkwDQY?“

get_ifc_spatial_structure : Ruft die räumliche Hierarchie des IFC-Modells ab (Gelände, Gebäude, Stockwerke, Räume). Beispiel: „Zeigen Sie mir die räumliche Struktur dieses Gebäudes.“

get_ifc_relationships : Ruft alle Beziehungen für eine bestimmte IFC-Entität ab. Beispiel: „Welche Beziehungen bestehen für die Eingangstür?“

get_selected_ifc_entities : Ruft Informationen zu IFC-Entitäten ab, die den aktuell in der Blender-Benutzeroberfläche ausgewählten Objekten entsprechen. Beispiel: „Erzählen Sie mir von den Elementen, die ich in Blender ausgewählt habe.“

get_user_view : Erfasst den aktuellen Blender-Ansichtsbereich als Bild und ermöglicht so die Visualisierung des Modells aus der Benutzerperspektive. Beispiel: „Zeigen Sie mir, was der Benutzer aktuell in Blender sieht.“

export_ifc_data : Exportiert IFC-Daten in eine strukturierte JSON- oder CSV-Datei mit Filteroptionen nach Entitätstyp oder Gebäudeebene. Beispiel: „Alle Wanddaten in eine CSV-Datei exportieren“

place_ifc_object : Erstellt und positioniert ein IFC-Element im Modell an den angegebenen Koordinaten mit optionaler Drehung. Beispiel: „Platziere eine Tür an den Koordinaten X:10, Y:5, Z:0 mit 90-Grad-Drehung.“

Blender-Code ausführen

Veraltete Funktion aus der ursprünglichen MCP-Implementierung. Ermöglicht Claude, beliebigen Python-Code in Blender auszuführen. Mit Vorsicht verwenden.

Werkzeug für sequentielles Denken

Diese Integration umfasst das Sequential Thinking-Tool für strukturierte Problemlösung und Analyse. Es ermöglicht einen schrittweisen Denkprozess, der sich mit zunehmendem Verständnis verzweigen, überarbeiten und anpassen lässt – ideal für komplexe IFC-Modellanalysen oder Planungsaufgaben.

Beispiel: „Nutzen Sie sequentielles Denken, um die Energieeffizienz dieses Gebäudes anhand des IFC-Modells zu analysieren.“

Beispielbefehle

Hier sind einige Beispiele dafür, was Sie Claude mit IFC-Modellen tun lassen können:

  • „Analysieren Sie dieses IFC-Modell und sagen Sie mir, wie viele Wände, Türen und Fenster es hat.“

  • „Zeigen Sie mir die räumliche Struktur dieses Gebäudemodells“

  • „Alle Räume in diesem IFC-Modell und ihre Eigenschaften auflisten“

  • „Identifizieren Sie alle Strukturelemente in diesem Gebäude“

  • „Welche Beziehungen bestehen zwischen dieser Wand und anderen Elementen?“

  • „Nutzen Sie sequentielles Denken, um einen Wartungsplan für dieses Gebäude basierend auf dem IFC-Modell zu erstellen.“

Fehlerbehebung

  • Verbindungsprobleme : Stellen Sie sicher, dass der Blender-Add-On-Server läuft und der MCP-Server in Claude konfiguriert ist.

  • IFC-Modell wird nicht geladen : Stellen Sie sicher, dass Sie das Bonsai BIM-Add-on installiert haben und dass eine IFC-Datei geladen ist

  • Timeout-Fehler : Versuchen Sie, Ihre Anfragen zu vereinfachen oder in kleinere Schritte aufzuteilen

Docker:

  • Fehler „Verbindung abgelehnt“ : Stellen Sie sicher, dass Blender ausgeführt wird und das Add-on aktiviert ist, während der Server gestartet ist

  • CORS-Probleme : Die API hat CORS standardmäßig für alle Ursprünge aktiviert. Wenn Probleme auftreten, überprüfen Sie die CORS-Einstellungen Ihres Clients.

  • Leistungsbedenken : Bei großen IFC-Modellen können die API-Antworten langsamer sein. Erwägen Sie die Anpassung der Timeouts in Ihrem Client.

Technische Details

Die IFC-Integration nutzt das Bonsai BIM-Modul, um auf die ifcopenshell-Funktionalität in Blender zuzugreifen. Die Kommunikation erfolgt über dasselbe JSON-basierte Protokoll über TCP-Sockets wie das ursprüngliche BlenderMCP.

Einschränkungen und Sicherheitsüberlegungen

  • Das Tool execute_blender_code aus dem Originalprojekt ist weiterhin verfügbar und ermöglicht die Ausführung beliebigen Python-Codes in Blender. Verwenden Sie es mit Vorsicht und speichern Sie Ihre Arbeit immer.

  • Bei komplexen IFC-Modellen kann es erforderlich sein, Vorgänge in kleinere Schritte aufzuteilen.

  • Die Leistung der IFC-Abfrage hängt von der Größe und Komplexität des Modells ab.

  • Das Tool „Benutzeransicht abrufen“ gibt ein Base64-codiertes Bild zurück. Bitte stellen Sie sicher, dass der Client dies unterstützt.

Beiträge

Dieses MIT-lizenzierte Repo kann geforkt, modifiziert und auf jede erdenkliche Weise verwendet werden. Ich bin offen für Ideen und Kooperationen. Zögern Sie also nicht, mich für Beiträge zu kontaktieren.

Credits

ZU TUN

Integration und Tests mit mehreren MCP-Clients

Available Tools

17 tools
execute_blender_codeC
Execute arbitrary Python code in Blender.

Parameters:
- code: The Python code to execute

Inputs: code (required).

export_bc3_budgetA
Export a BC3 budget file (FIEBDC-3/2016) based on the IFC model loaded in Blender.

This tool creates a complete construction budget in BC3 format by:
1. Extracting the complete IFC spatial structure (Project → Site → Building → Storey)
2. Extracting IFC quantities and measurements for all building elements
3. Converting to BC3 hierarchical format with IFC2BC3Converter:
   - Generates budget chapters from IFC spatial hierarchy
   - Groups building elements by type and categories defined in external JSON
   - Assigns unit prices from language-specific JSON database
   - Creates detailed measurements sorted alphabetically
4. Exports to BC3 file with windows-1252 encoding

Features:
- Multi-language support (Spanish/English) for descriptions and labels
- Automatic element categorization using external JSON configuration
- Optimized conversion with O(1) lookups and batch operations
- Detailed measurements with dimensions (units, length, width, height)
- Full FIEBDC-3/2016 format compliance

Configuration files (in resources/bc3_helper_files/):
- precios_unitarios.json / unit_prices.json: Unit prices per IFC type
- spatial_labels_es.json / spatial_labels_en.json: Spatial element translations
- element_categories.json: IFC type to category mappings

Args:
    language: Language for the budget file ('es' for Spanish, 'en' for English). Default is 'es'.

Returns:
    A confirmation message with the path to the generated BC3 file in the exports/ folder.

Inputs: language.

export_drawing_pngA

Export drawings as PNG images with custom resolution.

Creates a drawing, with the view type specified, of the IFC building at the specified 
height above the floor level. Supports custom resolution for high-quality architectural drawings.

Args:
    height_offset: Height in meters above the storey level for the camera position (default 0.5m)
    view_type: Type of view - "top" for plan view, "front", "right" and "left" for elevation views, and "isometric" for 3D view
    resolution_x: Horizontal resolution in pixels (default 1920, max recommended 4096)
    resolution_y: Vertical resolution in pixels (default 1080, max recommended 4096)
    storey_name: Specific storey name to add to the file name (if None, prints default in the file name)
    output_path: Optional file path to save the PNG (if None, returns as base64 image)

Returns:
    metadata and the path of the file image of the drawing at the specified resolution

Inputs: height_offset, view_type, resolution_x, resolution_y, +2 more.

export_ifc_dataB
Export IFC data to a file in JSON or CSV format.

This tool extracts IFC data and creates a structured export file. You can filter
by entity type and/or building level, and choose the output format.

Args:
    entity_type: Type of IFC entity to export (e.g., "IfcWall") - leave empty for all entities
    level_name: Name of the building level to filter by (e.g., "Level 1") - leave empty for all levels
    output_format: "json" or "csv" format for the output file
    
Returns:
    Confirmation message with the export file path or an error message

Inputs: entity_type, level_name, output_format, ctx.

generate_idsA
Creates an .ids file in Blender/Bonsai by calling the add-on handler 'generate_ids'.

Parameters:
  - title (str): Title of the IDS.
  - specs (list | JSON str): List of 'specs' containing 'applicability' and 'requirements'.
    Each facet is a dict with at least a 'type' field ("Entity", "Attribute", "Property",
    "Material", "Classification", "PartOf") and its corresponding attributes.
  - description, author, ids_version, date_iso, purpose, milestone: IDS metadata fields.
  - output_path (str): Full path to the .ids file to be created. If omitted, the add-on will generate a default name.

Returns:
  - JSON (str) with the handler result: {"ok": bool, "output_path": "...", "message": "..."} 
    or {"ok": False, "error": "..."}

Inputs: title (required), specs (required), description, author, +5 more.

georeference_ifc_modelC

Georeferences the IFC currently opened in Bonsai/BlenderBIM by creating or updating IfcProjectedCRS and IfcMapConversion. Optionally updates IfcSite and writes the file to disk.

Inputs: crs_mode (required), epsg, crs_name, geodetic_datum, +19 more.

get_ifc_georeferencing_infoA
Checks whether the IFC currently opened in Bonsai/BlenderBIM is georeferenced
and returns the key georeferencing information.

Parameters
----------
include_contexts : bool
    If True, adds a breakdown of the RepresentationContexts and operations.
    

Returns
--------
str (JSON pretty-printed)
    {
      "georeferenced": true|false,
      "crs": {
        "name": str|null,
        "geodetic_datum": str|null,
        "vertical_datum": str|null,
        "map_unit": str|null
      },
      "map_conversion": {
        "eastings": float|null,
        "northings": float|null,
        "orthogonal_height": float|null,
        "scale": float|null,
        "x_axis_abscissa": float|null,
        "x_axis_ordinate": float|null
      },
      "world_coordinate_system": {
        "origin": [x, y, z]|null
      },
      "true_north": {
        "direction_ratios": [x, y]|null
      },
      "site": {
        "local_placement_origin": [x, y, z]|null,
        "ref_latitude": [deg, min, sec, millionth]|null,
        "ref_longitude": [deg, min, sec, millionth]|null,
        "ref_elevation": float|null
      },
      "contexts": [...],              # only if include_contexts = true
      "warnings": [ ... ]             # Informational message
    }

Notes
-----
- This tool acts as a wrapper: it sends the "get_ifc_georeferencing_info"
  command to the Blender add-on. The add-on must implement that logic
  (reading IfcProject/IfcGeometricRepresentationContext, IfcMapConversion,
  TargetCRS, IfcSite.RefLatitude/RefLongitude/RefElevation, etc.).
- It always returns a JSON string with indentation for easier reading.

Inputs: include_contexts.

get_ifc_project_infoB
Get basic information about the IFC project, including name, description, 
and counts of different entity types.

Returns:
    A JSON-formatted string with project information

Inputs: no named parameters.

get_ifc_propertiesA
Get properties of IFC entities. Can be used to get properties of a specific entity by GlobalId,
or to get properties of all currently selected objects in Blender.

Args:
    global_id: GlobalId of a specific IFC entity (optional if selected_only is True)
    selected_only: If True, return properties for all selected objects instead of a specific entity

Returns:
    A JSON-formatted string with entity information and properties

Inputs: global_id, selected_only.

get_ifc_quantitiesC
Extract and get basic qtos about the IFC project.

Returns:
    A JSON-formatted string with project quantities information

Inputs: no named parameters.

get_ifc_relationshipsB
Get all relationships for a specific IFC entity.

Args:
    global_id: GlobalId of the IFC entity

Returns:
    A JSON-formatted string with all relationships the entity participates in

Inputs: global_id (required).

get_ifc_spatial_structureB
Get the spatial structure of the IFC model (site, building, storey, space hierarchy).

Returns:
    A JSON-formatted string representing the hierarchical structure of the IFC model

Inputs: no named parameters.

get_ifc_total_structureA
Get the complete IFC structure including spatial hierarchy and all building elements.

This function extends the basic spatial structure to include building elements like walls,
doors, windows, columns, beams, etc. that are contained within each spatial element.
It provides a comprehensive view of how the building is organized both spatially and
in terms of its physical components.

Returns:
    A JSON-formatted string representing the complete hierarchical structure of the IFC model
    including spatial elements and their contained building elements, plus summary statistics

Inputs: no named parameters.

get_selected_ifc_entitiesA
Get IFC entities corresponding to the currently selected objects in Blender.
This allows working specifically with objects the user has manually selected in the Blender UI.

Returns:
    A JSON-formatted string with information about the selected IFC entities

Inputs: no named parameters.

get_user_viewA
Capture and return the current Blender viewport as an image.
Shows what the user is currently seeing in Blender.

Focus mostly on the 3D viewport. Use the UI to assist in your understanding of the scene but only refer to it if specifically prompted.

Args:
    max_dimension: Maximum dimension (width or height) in pixels for the returned image
    compression_quality: Image compression quality (1-100, higher is better quality but larger)

Returns:
    An image of the current Blender viewport

Inputs: no named parameters.

list_ifc_entitiesB
List IFC entities of a specific type. Can be filtered to only include objects
currently selected in the Blender UI.

Args:
    entity_type: Type of IFC entity to list (e.g., "IfcWall")
    limit: Maximum number of entities to return
    selected_only: If True, only return information about selected objects

Returns:
    A JSON-formatted string listing the specified entities

Inputs: entity_type, limit, selected_only.

place_ifc_objectB
Place an IFC object at a specified location with optional rotation.

This tool allows you to create and position IFC elements in the model.
The object is placed using the specified IFC type and positioned
at the given coordinates with optional rotation around the Z axis.

Args:
    type_name: Name of the IFC element type to place (must exist in the model)
    x: X-coordinate in model space
    y: Y-coordinate in model space
    z: Z-coordinate in model space
    rotation: Rotation angle in degrees around the Z axis (default: 0)
    
Returns:
    A message with the result of the placement operation

Inputs: type_name (required), x (required), y (required), z (required), +2 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 17 tools

    Disambiguation4/5

    Most tools have distinct purposes with clear boundaries, such as export_bc3_budget for budget generation and get_ifc_georeferencing_info for georeferencing checks. However, some overlap exists between get_ifc_spatial_structure and get_ifc_total_structure, where the latter extends the former, potentially causing confusion about which to use for hierarchical data. Tools like get_ifc_properties and get_ifc_quantities are clearly differentiated by focusing on properties versus quantities.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern throughout, using snake_case uniformly. Examples include execute_blender_code, export_bc3_budget, get_ifc_project_info, and list_ifc_entities. This predictability makes it easy for agents to understand and navigate the toolset without confusion from mixed naming conventions.

    Tool Count4/5

    With 17 tools, the count is slightly high but reasonable for the domain of IFC/BIM modeling and Blender integration, which involves data extraction, export, visualization, and manipulation. Most tools serve specific functions like georeferencing, drawing export, or entity listing, though a few could potentially be consolidated (e.g., spatial structure tools) without losing functionality.

    Completeness5/5

    The toolset provides comprehensive coverage for IFC/BIM workflows, including data retrieval (e.g., get_ifc_project_info, get_ifc_properties), export functions (e.g., export_bc3_budget, export_drawing_png), spatial analysis (e.g., get_ifc_spatial_structure), and manipulation (e.g., place_ifc_object, georeference_ifc_model). It supports CRUD-like operations and lifecycle management, with no obvious gaps that would hinder agent performance in this domain.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Connects Blender to Claude AI through the Model Context Protocol, enabling AI-assisted 3D modeling, scene creation, and manipulation through natural language commands.
      17
      2
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Connects Claude AI to Blender via the Model Context Protocol to enable prompt-assisted 3D modeling, scene creation, and object manipulation. It allows users to control Blender through natural language for tasks such as modifying materials, inspecting scenes, and executing custom Python code.
      22
      MIT