Bonsai-mcp
The Bonsai-mcp server extends Blender's IFC capabilities, enabling LLMs to query, analyze, manipulate, and visualize IFC building models through comprehensive integration.
Query & Analyze: Retrieve project information, list entities by type, examine properties, explore spatial hierarchies, and analyze relationships using GlobalId
Work with Selections: Get information about IFC entities corresponding to objects selected in Blender UI
Export Data: Export IFC data to structured JSON or CSV files with filtering by entity type or building level
Create & Modify: Place and position IFC elements at specified coordinates with optional rotation
Visualize: Capture current Blender viewport images to see the user's perspective
Calculate: Get measurements (m², m³, etc.) for IFC elements with filtering options
Execute Code: Run arbitrary Python code within Blender (use with caution)
Structured Analysis: Use sequential thinking tool for complex, multi-step problem-solving
Enables interactions with IFC (Industry Foundation Classes) models through Bonsai BIM, allowing users to query models, analyze spatial structures, inspect project information, and examine building elements and their relationships.
Provides tools for executing Python code in Blender, creating and modifying 3D objects, applying materials, and analyzing IFC models through a socket-based connection.
Click on "Deploy 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., "@Bonsai-mcp list all the doors in this building model"
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.
Bonsai-mcp - Model Context Protocol Integration for IFC through IfcOpenShell and Blender
Bonsai-mcp is a fork of BlenderMCP that extends the original functionality with dedicated support for IFC (Industry Foundation Classes) models through Bonsai. This integration is a platform to let LLMs read and modify IFC files.
Features
IFC-specific functionality: Query IFC models, analyze spatial structures, examine building elements and extract quantities
Eleven IFC tools included: Inspect project info, list entities, examine properties, explore spatial structure, analyze relationships and more
Sequential Thinking: Includes the sequential thinking tool from modelcontextprotocol/servers for structured problem solving
Execute Code tool from the original BlenderMCP implementation: Create and modify objects, apply materials, and execute Python code in Blender
Related MCP server: BlenderMCP
Components
The system consists of two main components:
Blender Addon (
addon.py): A Blender addon that creates a socket server within Blender to receive and execute commands, including IFC-specific operationsMCP Server (
tools.py): A Python server that implements the Model Context Protocol and connects to the Blender addon
Installation - Through MCP Client Settings
Prerequisites
Blender 4.0 or newer
Python 3.12 or newer
uv package manager
Bonsai BIM addon for Blender (for IFC functionality)
Installing uv:
Mac:
brew install uv
Windows:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
set Path=C:\Users\[username]\.local\bin;%Path%
For other platforms, see the uv installation guide.
Clone the repository
git clone https://github.com/JotaDeRodriguez/Bonsai_mcp
Claude for Desktop Integration
Edit your claude_desktop_config.json file (Claude > Settings > Developer > Edit Config) to include:
{
"mcpServers": {
"Bonsai-mcp": {
"command": "uv",
"args": [
"--directory",
"\\your\\path\\to\\Bonsai_mcp",
"run",
"tools.py"
]
}
}
}
Installation via Docker
The repository comes with a Dockerfile that makes deployment simple and consistent across different environments.
Quick Start
# 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_mcpOnce running, the container will expose the MCP tools as REST/OpenAPI APIs at http://localhost:8000.
To verify youtr installation, open your browser and navigate to
http://localhost:8000/docsYou'll see the Swagger UI with all available endpoints
Test an endpoint by clicking on it, then click "Try it out" and "Execute"
Connecting to Open WebUI or Other API Clients
To connect this API to Open WebUI:
In Open WebUI, go to Settings > Manage Tool Servers
Add a new connection with:
URL:
http://localhost:8000Path to OpenAPI spec:
/openapi.jsonAuthentication: None (unless configured otherwise)
Environment Variables
The Docker container accepts several environment variables to customize its behavior:
# 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_mcpInstalling the Blender Addon
Download the
addon.pyfile from this repoOpen Blender
Go to Edit > Preferences > Add-ons
Click "Install..." and select the
addon.pyfileEnable the addon by checking the box next to "Interface: Blender MCP - IFC"
Usage
Starting the Connection
In Blender, go to the 3D View sidebar (press N if not visible)
Find the "Blender MCP - IFC" tab
Click "Connect to Claude"
Make sure the MCP server is running
Using with Claude
Once connected, you'll see a hammer icon in Claude's interface with tools for the Blender MCP IFC integration.
IFC Tools
This repo includes multiple IFC-specific tools that enable comprehensive querying and manipulation of IFC models:
get_ifc_project_info: Retrieves basic information about the IFC project, including name, description, and counts of different entity types. Example: "What is the basic information about this IFC project?"
list_ifc_entities: Lists IFC entities of a specific type (walls, doors, spaces, etc.) with options to limit results and filter by selection. Example: "List all the walls in this IFC model" or "Show me the windows in this building"
get_ifc_properties: Retrieves all properties of a specific IFC entity by its GlobalId or from currently selected objects. Example: "What are the properties of this wall with ID 1Dvrgv7Tf5IfTEapMkwDQY?"
get_ifc_spatial_structure: Gets the spatial hierarchy of the IFC model (site, building, storeys, spaces). Example: "Show me the spatial structure of this building"
get_ifc_relationships: Retrieves all relationships for a specific IFC entity. Example: "What are the relationships of the entrance door?"
get_selected_ifc_entities: Gets information about IFC entities corresponding to objects currently selected in the Blender UI. Example: "Tell me about the elements I've selected in Blender"
get_user_view: Captures the current Blender viewport as an image, allowing visualization of the model from the user's perspective. Example: "Show me what the user is currently seeing in Blender"
export_ifc_data: Exports IFC data to a structured JSON or CSV file, with options to filter by entity type or building level. Example: "Export all wall data to a CSV file"
place_ifc_object: Creates and positions an IFC element in the model at specified coordinates with optional rotation. Example: "Place a door at coordinates X:10, Y:5, Z:0 with 90 degrees rotation"
get_ifc_quantities: Calculate and get quantities (m2, m3, etc.) for IFC elements, with options to filter by entity type or selected ones. Example: "Give me the area of all the walls in the building using the tool get_ifc_quantities"
get_ifc_total_structure: Retrieves the complete hierarchical structure of the IFC model including spatial elements (Project, Site, Building, Storeys) and all building elements within each spatial container. This comprehensive view combines spatial hierarchy with building elements, essential for generating complete reports and budgets. Example: "Show me the complete structure of this IFC model including all building elements organized by floor"
export_drawing_png: Exports 2D and 3D drawings as high-resolution PNG images with customizable resolution and view parameters. Creates orthographic plan views from above at specified height offsets. Example: "Generate a floor plan PNG for the ground floor at 1920x1080 resolution"
get_ifc_georeferencing_info: Retrieves comprehensive georeferencing information from IFC files including coordinate reference systems (CRS), map conversions, world coordinate systems, true north direction, and site geographic coordinates. Example: "What georeferencing information is available in this IFC model?"
georeference_ifc_model: Creates or updates georeferencing information in IFC models, allowing you to set coordinate reference systems using EPSG codes or custom CRS definitions, establish map conversions with eastings/northings coordinates, and configure site geographic positioning. Example: "Georeference this IFC model using EPSG:4326 with coordinates at latitude 40.7589, longitude -73.9851"
export_bc3_budget: Exports a BC3 budget file (FIEBDC-3/2016 format) based on the IFC model loaded in Blender. This tool creates a complete construction budget by extracting the IFC spatial structure, grouping building elements by type and category (structure, masonry, slabs, carpentry, installations, furniture), assigning unit prices from a comprehensive database, and generating detailed measurements. Supports multi-language output (Spanish/English) with proper encoding for international characters. The BC3 format is the Spanish standard for construction budgets and cost estimation. Example: "Generate a BC3 budget file in Spanish for this building model"
Features
Automatic element categorization: Building elements are automatically classified into categories:
ESTR: Structural elements (beams, columns, footings, piles, ramps, stairs)
ALB: Masonry (walls)
FORG: Slabs and roofs
CARP: Carpentry (doors, windows)
INST: Installations (pipes, fittings, terminals, railings)
MOB: Furniture
Accurate measurements:
Walls measured by NetSideArea (accounts for openings like doors and windows)
Slabs and roofs measured by GrossVolume
Beams, columns, and piles measured by length (meters)
Doors, windows, and furniture counted as units
Multi-language support: Generate budgets in Spanish or English with proper character encoding (windows-1252)
Hierarchical structure: Budget chapters follow the IFC spatial hierarchy (Project → Site → Building → Storey)
Unit price database: Includes comprehensive unit prices for common construction elements, fully customizable via JSON files
Sorted measurements: Elements within each category are sorted alphabetically for easier review
Configuration Files
The BC3 export uses external JSON configuration files located in resources/bc3_helper_files/:
precios_unitarios.json/unit_prices.json: Unit prices per IFC element typespatial_labels_es.json/spatial_labels_en.json: Spatial element translationselement_categories.json: IFC type to budget category mappings
These files can be customized to adapt the budget generation to specific project needs or regional pricing standards.
Output
BC3 files are exported to the exports/ folder with proper FIEBDC-3/2016 format, including:
Complete hierarchical chapter structure
Detailed measurements for each element
Unit prices and totals
Full compliance with Spanish construction budget standard bc3
MCP Resources
This integration provides access to structured documentation through MCP resources:
file://table_of_contents.md: Contains the complete technical report structure template for generating comprehensive building reports. This resource provides a standardized table of contents that can be used as a reference when creating technical documentation from IFC models.
MCP Prompts
The server includes specialized MCP Prompts for automated report generation:
Technical_building_report: Generates comprehensive technical building reports based on IFC models loaded in Blender. This prompt provides a structured workflow for creating professional architectural documentation in multiple languages (English, Spanish, French, German, Italian, Portuguese). The prompt guides the analysis through systematic data extraction from the IFC model, including spatial structure, quantities, materials, and building systems, culminating in a complete technical report with drawings and 3D visualizations.
Execute Blender Code
Legacy feature from the original MCP implementation. Allows Claude to execute arbitrary Python code in Blender. Use with caution.
Sequential Thinking Tool
This integration includes the Sequential Thinking tool for structured problem-solving and analysis. It facilitates a step-by-step thinking process that can branch, revise, and adapt as understanding deepens - perfect for complex IFC model analysis or planning tasks.
Example: "Use sequential thinking to analyze this building's energy efficiency based on the IFC model"
Example Commands
Here are some examples of what you can ask Claude to do with IFC models:
"Analyze this IFC model and tell me how many walls, doors and windows it has"
"Show me the spatial structure of this building model"
"List all spaces in this IFC model and their properties"
"Identify all structural elements in this building"
"What are the relationships between this wall and other elements?"
"Generate a report of the measurements from the IFC model opened in Blender"
"Use sequential thinking to create a maintenance plan for this building based on the IFC model"
"Generate a BC3 budget file in Spanish for the current IFC model"
"Export a construction cost estimate to BC3 format with English descriptions"
Troubleshooting
Connection issues: Make sure the Blender addon server is running, and the MCP server is configured in Claude
IFC model not loading: Verify that you have the Bonsai BIM addon installed and that an IFC file is loaded
Timeout errors: Try simplifying your requests or breaking them into smaller steps
Docker:
"Connection refused" errors: Make sure Blender is running and the addon is enabled with the server started
CORS issues: The API has CORS enabled by default for all origins. If you encounter issues, check your client's CORS settings
Performance concerns: For large IFC models, the API responses might be slower. Consider adjusting timeouts in your client
Technical Details
The IFC integration uses the Bonsai BIM module to access ifcopenshell functionality within Blender. The communication follows the same JSON-based protocol over TCP sockets as the original BlenderMCP.
Limitations & Security Considerations
The
execute_blender_codetool from the original project is still available, allowing running arbitrary Python code in Blender. Use with caution and always save your work.Complex IFC models may require breaking down operations into smaller steps.
IFC query performance depends on model size and complexity.
Get User View tool returns a base64 encoded image. Please ensure the client supports it.
Contributions
This MIT licensed repo is open to be forked, modified and used in any way. I'm open to ideas and collaborations, so don't hesitate to get in contact with me for contributions.
Credits
Original BlenderMCP by Siddharth Ahuja
Sequential Thinking tool from modelcontextprotocol/servers
IFC integration built upon the Bonsai BIM addon for Blender
TO DO
Integration and testing with more MCP Clients
Available Tools
17 toolsexecute_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
Scored across 17 tools
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.
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.
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.
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
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
A Model Context Protocol server for Wix AI tools
MCP server giving Claude AI access to 22+ NYC public-record databases for real estate due diligence
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA server that integrates Blender with local AI models via the Model Context Protocol, allowing users to control Blender using natural language prompts for 3D modeling tasks.123MIT
- AlicenseBqualityDmaintenanceConnects Blender to Claude AI through the Model Context Protocol, enabling AI-assisted 3D modeling, scene creation, and manipulation through natural language commands.172MIT
- AlicenseBqualityDmaintenanceConnects 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.22MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that connects AI language models with the Bonsai Blender add-on to read, create, and edit IFC models through high-level tool calls.70MIT