bonsai-mcp
Provides tools to view and interact with IFC models inside Blender's viewport, including focusing and isolating elements, setting views, taking screenshots, and reloading the scene.
Click on "Install 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-mcpList all walls and their property sets in the IFC 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
MCP server to read, view and edit IFC models with IfcOpenShell and Bonsai (Blender).
Query a model, look at it through Blender's viewport, and edit it with IFC semantics — profiles, placements, property sets — never raw mesh operations. The read tools run with Blender closed.
Status: Stage 3 — read tools, Blender/Bonsai viewport, and IFC-semantic editing.
Table of contents
Related MCP server: BlenderMCP
1. Requirements
Python | >= 3.11 (3.13 recommended) |
| >= 0.5 |
OS | Windows 11 (primary), macOS, Linux |
Blender | >= 4.2, only needed for the |
Bonsai | the build matching Blender's Python (Blender 5.x → |
The ifc_* tools run with Blender closed. The bl_* tools need Blender + Bonsai + the add-on.
2. Install
git clone https://github.com/nhantruong96/bonsai-mcp.git
cd bonsai-mcp
uv syncTo pin Python 3.13:
uv sync --python 3.13Sample model. --selfcheck and pytest use KIT's FZK-Haus model. It is not committed — it is not this project's file — and is downloaded automatically on first run. Nothing to do.
Fetch it manually if the machine is offline at run time:
curl -L -o tests/fixtures/AC20-FZK-Haus.ifc https://www.ifcwiki.org/images/e/e3/AC20-FZK-Haus.ifcOr point the selfcheck at any IFC file:
uv run python -m bonsai_mcp --selfcheck --file "D:\path\to\your.ifc"3. Install the Blender add-on
Only needed for the bl_* tools. Skip this if you only use the read tools.
3.1. Install Bonsai (if it is not installed yet)
Blender 5.x runs Python 3.13 → take the bonsai_py313 build. Blender 4.2 runs Python 3.11 → bonsai_py311.
Blender → Edit > Preferences > Get Extensions → the ˅ button top right → Install from Disk... → pick the Bonsai zip.
3.2. Build the add-on zip
Compress-Archive -Path C:\Tools\bonsai-mcp\addon\bonsai_mcp_addon -DestinationPath C:\Tools\bonsai-mcp\bonsai_mcp_addon.zip -Force3.3. Install the add-on
Blender → Edit > Preferences > Get Extensions → the ˅ button top right → Install from Disk... → pick bonsai_mcp_addon.zip.
3.4. Point the add-on at src
Edit > Preferences > Add-ons → Bonsai MCP Bridge → expand → fill in bonsai-mcp src:
C:\Tools\bonsai-mcp\srcThis is what lets the ifc_* tools read the model Blender has open. Without it the bl_* tools still work but ifc_* cannot read through Blender.
Alternatively set the BONSAI_MCP_SRC environment variable, which takes precedence.
3.5. Run
Open an IFC file:
Bonsai > Project > Load Project.In the 3D viewport press
N→ Bonsai MCP tab → Start Server.The panel shows
Running, the address127.0.0.1:9876, request/error counts and the last 20 log lines.
Change the port under Edit > Preferences > Add-ons > Bonsai MCP Bridge > Port, then set BONSAI_MCP_BLENDER_PORT to the same value on the MCP side.
4. Selfcheck
uv run python -m bonsai_mcp --selfcheckuv run python -m bonsai_mcp --list-toolsuv run python -m pytestSelfcheck exits 0 on success. All logging goes to stderr.
The Blender integration tests skip themselves when no bridge is running. To run them, Start Server in Blender then:
uv run python -m pytest tests/test_blender_integration.py -vuv run python -m pytest tests/test_blender_edit_integration.py -v5. Claude Desktop config
File: %APPDATA%\Claude\claude_desktop_config.json (Windows) ·
~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
{
"mcpServers": {
"bonsai-mcp": {
"command": "uv",
"args": [
"--directory",
"C:\\Tools\\bonsai-mcp",
"run",
"python",
"-m",
"bonsai_mcp"
],
"env": {
"BONSAI_MCP_BLENDER_HOST": "127.0.0.1",
"BONSAI_MCP_BLENDER_PORT": "9876",
"BONSAI_MCP_LOG_LEVEL": "INFO"
}
}
}
}The env block is optional; leaving it out uses exactly those defaults.
Restart Claude Desktop after editing the file.
6. Claude Code config
claude mcp add bonsai-mcp -- uv --directory C:\Tools\bonsai-mcp run python -m bonsai_mcpVerify:
claude mcp list7. Usage procedure
7.1. Without Blender
ifc_open— open the file; check schema, units and element counts.ifc_list_property_names— always run this before writing any property query.ifc_model_infoorifc_spatial_tree— get the storey structure and per-class counts.ifc_list_entities/ifc_select— filter to the elements you need; page withlimit+offset.ifc_get_element— full detail for one element.ifc_geometry_info— geometry, profile and absolute placement of that element.ifc_representation_stats/ifc_validate— whole-file QC.
7.2. With Blender
Load Project in Bonsai, then Start Server in the Bonsai MCP panel.
bl_status— confirm the file, the versions, and that the session switched toblendermode.From here every
ifc_*tool reads the model Blender holds. Do not callifc_open— it is refused by design.bl_set_viewfor an overview,bl_focus_element(guid)for one element.For anything internal pass
isolate=true, or usebl_isolate, thenbl_isolate(restore=true).
8. Tool reference
8.1. IFC read tools
Tool | Parameters | Returns |
|
| schema, exporter, creation dates, units, entity/element totals, |
|
| the above plus a per-class histogram and the storey list |
|
| real total plus one page: guid, name, class, storey |
|
| attributes, psets, quantities, material, type, container |
|
|
|
|
| Project → Site → Building → Storey with element counts per node |
|
| every pset/property name that actually exists, with occurrence counts |
|
| representations, items, profiles, absolute 4×4 matrix, bbox, volume, area; plus flat |
|
| breakdown by |
|
| condensed |
Query syntax for ifc_select:
IfcWall
IfcWall, IfcSlab
IfcBeam, Name=/B-.*/
IfcSpace, Pset_SpaceCommon.IsExternal=TRUE8.2. Blender tools
Tool | Parameters | Returns |
|
| whether Blender is reachable, Bonsai version, the IFC file it has open, |
|
| viewport PNG plus its real dimensions |
|
| selects and zooms to the element, returns the image and what was focused |
|
| hides everything else, returns the image and hidden/kept counts |
|
| sets the viewpoint, returns the image |
|
| resyncs the viewport from the in-memory IFC data |
direction: front, back, left, right, top, bottom, axo.
width bounds the image's longest side, not literally its width. The viewport aspect ratio is preserved. Clamped to 320–2048.
bl_reload does not reload from disk; it rebuilds the viewport from the in-memory IFC data.
8.3. Edit tools, group A: attributes
No geometry is touched. Each takes guid for one element or query for many.
Tool | Parameters |
|
|
|
|
|
|
|
|
8.4. Edit tools, group B: placement
Tool | Parameters |
|
|
|
|
|
|
ifc_rotate_element spins the element about its own origin, not the project origin.
8.5. Edit tools, group C: parametric geometry
Tool | Parameters |
|
|
|
|
|
|
Recipes: ResetAbsoluteCoordinates, OffsetObjectPlacements, SetWorldCoordinateSystem, ConvertLengthUnit, Optimise.
args uses the recipe's own parameter names; a wrong name is answered with the accepted list and their defaults.
8.6. Saving
Tool | Parameters |
|
|
| — |
9. Safe editing procedure
Run
ifc_geometry_infobefore any geometry edit — check the real parameter names and whether the element shares a representation map.Edit. The session's first edit automatically writes
<name>.backup-<timestamp>.ifcbeside the original.Read the
before/aftervalues in the result. Every edit tool returns both.In blender mode, use
bl_focus_elementorbl_screenshotto look at the result. The viewport is already resynced.ifc_saveto a new path. Overwriting requires an explicitoverwrite=true.If it went wrong,
ifc_revertreturns to the state before the first edit.
Guardrails
Guardrail | Behaviour |
Automatic backup | Once per session, taken just before the first edit |
Never overwrite the original |
|
Shared geometry | Group C refuses when a map or profile is shared, reporting how many elements would be affected; pass |
No tessellation | Editing tessellated geometry is refused, and no tool creates a |
Bulk ceiling | A |
Before and after | Every edit tool returns |
Viewport sync | In blender mode, Bonsai rebuilds exactly the affected elements after each edit |
Note: Blender's own undo (Ctrl+Z) does not cover MCP edits. Use ifc_revert.
10. Unit conventions
Quantity | Unit returned | Note |
Coordinates, dimensions | metres ( | already multiplied by |
Profile parameters | both | |
Extrusion depth |
| |
Volume / area |
| from the IfcOpenShell kernel (SI) |
Storey elevation |
| |
Angles | degrees | |
4×4 matrix |
| row-major, absolute |
Values passed into edit tools | metres and degrees |
|
| the file's own units | use the numbers shown in |
The placement matrix is absolute: the whole nested IfcLocalPlacement chain is multiplied through.
11. Environment variables
Variable | Set where | Default | Effect |
| MCP side |
|
|
| MCP side |
| add-on address |
| MCP side |
| add-on port; must match the preference set in Blender |
| Blender side | — | path to |
12. Troubleshooting
Symptom | Fix |
| Call |
| Use an absolute path; escape |
| Run |
| Wrong class name; see the suggestions in the error, or |
Result looks truncated | Read |
Coordinates are in the wrong place | Use |
| The element has no geometry the kernel could build; read |
No profile found under | Clipping booleans nest; use the flat |
| It is an |
| The map scan was capped; raise |
|
|
| Offline. Fetch it manually with the |
| A captive portal or error page answered instead of the file; nothing was written |
| The upstream file changed; tests asserting exact counts may now fail |
pytest reports many | Blender integration tests, or a missing sample model; see the reasons with |
Server does not appear in Claude | Wrong |
No log output anywhere | Logging goes to stderr, not stdout |
Blender
Symptom | Fix |
| In Blender: 3D viewport → |
The | The add-on is not enabled: |
| The port is taken; change Port in the preferences and set |
| Pin them together: set |
| The add-on has no path to |
| Load one first with |
| By design — Blender holds the model; load the other file in Blender instead |
| It is behind other geometry; call again with |
The image is very tall or very narrow | The image follows the viewport aspect ratio; make the Blender window landscape |
| Blender is headless, or the workspace has no VIEW_3D area |
| Blender has a dialog open or a modal operator running; close it, or raise |
Screenshots show the old geometry after an edit | Call |
Editing
Symptom | Fix |
| Shared geometry. Check with |
| The element has no parameters left; re-export it upstream as a swept solid |
| Narrow the |
| Run |
| Create it first with |
| The error already lists the profile's real parameter names |
| Save to a different path, or pass |
| Nothing has been edited yet, so no backup exists |
|
|
| The folder holding the original is not writable; nothing was changed |
| Blender's undo does not cover MCP edits; use |
13. Development
uv sync
uv run python -m pytest -v
uv run python -m bonsai_mcp --selfcheckConventions:
uv.lockis committed;.venv/never is.No
print(). stdout is the JSON-RPC channel; log throughconfig.pyto stderr.Nothing in
src/may importbpy— the server must run with Blender closed. A test enforces it.addon/bonsai_mcp_addon/protocol.pyruns on the socket thread and must never touchbpy; allbpycalls live inhandlers.pyand run only from the main-thread timer.bpyis not thread safe — a call from the wrong thread crashes Blender dozens of commands later, somewhere unrelated. An AST test enforces it.Failing tools return the full traceback in the
tracebackfield; Blender-side failures carry Blender's own traceback too.Every write goes through
ifcopenshell.api, and throughSession.write; no tool touches the model directly.There are no raw-mesh tools. Editing a mesh freely and writing it back turns a
SweptSolidinto aTessellation— parameters gone, file inflated, recipient unable to edit. A test enforces it.The guardrail fixture is generated by
tests/steel_fixture.py: 4 beams sharing oneIfcRepresentationMap, 1 column with its own profile, 1 tessellated slab.
License: MIT — see LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityFmaintenanceA Model Context Protocol server that integrates Claude with Blender, enabling users to analyze and interact with IFC (Industry Foundation Classes) building models through natural language commands.1758MIT
- AlicenseBqualityDmaintenanceAn MCP server that enables AI models to directly control Blender for 3D modeling, scene manipulation, and material management through natural language. It supports advanced workflows including Python code execution, viewport visualization, and integration with external asset libraries like Poly Haven and Hyper3D.221MIT
- Alicense-qualityCmaintenanceAn 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.57MIT
- Alicense-qualityCmaintenanceAn MCP server that enables AI assistants like Codex or ChatGPT to inspect and control a local Blender scene, including creating objects, editing materials, setting cameras and lights, rendering previews, and saving safe copies of .blend files.MIT
Related MCP Connectors
MCP server for Producer/Riffusion AI music generation
A MCP server built for developers enabling Git based project management with project and personal…
MCP server for generating rough-draft project plans from natural-language prompts.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nhantruong96/bonsai-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server