Bonsai-mcp integrates the Model Context Protocol with IFC models through IfcOpenShell and Blender, allowing AI language models to read and modify IFC files. This specialized server provides tools for querying IFC models, analyzing spatial structures, and extracting building information.
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.
git clone https://github.com/JotaDeRodriguez/Bonsai_mcp
claude_desktop_config.json
file (Claude > Settings > Developer > Edit Config):{
"mcpServers": {
"Bonsai-mcp": {
"command": "uv",
"args": [
"--directory",
"\\your\\path\\to\\Bonsai_mcp",
"run",
"tools.py"
]
}
}
}
# 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
Verify installation by navigating to http://localhost:8000/docs
in your browser.
# 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
addon.py
file from the repositoryaddon.py
fileBonsai-mcp includes eleven specialized IFC tools:
Retrieves basic information about the IFC project.
Example: "What is the basic information about this IFC project?"
Lists IFC entities of a specific type.
Example: "List all the walls in this IFC model" or "Show me the windows in this building"
Retrieves properties of a specific IFC entity.
Example: "What are the properties of this wall with ID 1Dvrgv7Tf5IfTEapMkwDQY?"
Gets the spatial hierarchy of the IFC model.
Example: "Show me the spatial structure of this building"
Retrieves relationships for a specific IFC entity.
Example: "What are the relationships of the entrance door?"
Gets information about currently selected IFC entities.
Example: "Tell me about the elements I've selected in Blender"
Captures the current Blender viewport as an image.
Example: "Show me what the user is currently seeing in Blender"
Exports IFC data to a structured file format.
Example: "Export all wall data to a CSV file"
Creates and positions an IFC element in the model.
Example: "Place a door at coordinates X:10, Y:5, Z:0 with 90 degrees rotation"
Calculate quantities for IFC elements.
Example: "Give me the area of all the walls in the building"
Exports 2D and 3D drawings as high-resolution PNG images.
Example: "Generate a floor plan PNG for the ground floor at 1920x1080 resolution"
Facilitates step-by-step thinking process for complex IFC model analysis.
Example: "Use sequential thinking to analyze this building's energy efficiency based on the IFC model"
Allows execution of arbitrary Python code in Blender (use with caution).
Includes specialized resources like file://table_of_contents.md
and prompts for report generation.
Docker Issues:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "Bonsai-mcp" '{"command":"uv","args":["--directory","\\your\\path\\to\\Bonsai_mcp","run","tools.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"Bonsai-mcp": {
"command": "uv",
"args": [
"--directory",
"\\your\\path\\to\\Bonsai_mcp",
"run",
"tools.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"Bonsai-mcp": {
"command": "uv",
"args": [
"--directory",
"\\your\\path\\to\\Bonsai_mcp",
"run",
"tools.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect