Bonsai MCP
Bonsai MCP connects an MCP client (e.g., Claude, Cursor, VS Code) to a running Blender + Bonsai (BlenderBIM) session, enabling inspection, querying, and manipulation of 3D scenes and IFC building models.
Scene & Object Inspection
Get a summary of the current Blender scene (object counts, collections, IFC availability), filtered by type, name, class, or GlobalId.
Retrieve detailed info (name, type, location, dimensions, IFC class, GlobalId) for currently selected objects.
IFC Data Querying
Fetch IFC property sets (psets) and quantity sets (qtos) for one or more objects (up to 100 targets per call).
Get IFC project info: schema version, project name, site/building/storey counts, entity counts, materials, and classifications.
Viewport Interaction
Capture screenshots of the Blender 3D viewport with options to set view direction (top, front, isometric, camera, etc.), frame content (all or selected), image format (JPEG/PNG), quality, and resolution. Optionally returns 2D bounding boxes for visible objects.
Code Execution
Run IfcOpenShell/Bonsai API Python code to query or modify IFC entities, read/write properties, traverse the model, and call
ifcopenshell.apioperations (bpyis blocked for safety).Run arbitrary Python with full
bpyaccess for Blender-specific tasks like viewport manipulation, rendering, object transforms, and modifiers.
IFC Model Management
Save the loaded IFC model in-place or to a new path (with overwrite protection), with an option to reload the project so IFC edits are reflected in the Blender viewport.
Diagnostics
Use the
doctorcommand to verify the bridge connection and tool availability.
Allows connecting MCP clients to a running Blender session with Bonsai (BlenderBIM), enabling scene inspection, IFC project queries, viewport capture, and Python execution inside Blender.
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 every wall in the model with its fire rating."
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
A local Model Context Protocol server that connects any MCP client (Claude Desktop, Claude Code, Cursor, VS Code, OpenAI Codex) to a running Blender + Bonsai (BlenderBIM) session. Inspect the scene, query the loaded IFC project, capture the viewport, and run Python inside Blender.
Documentation site: show2instruct.github.io/bonsai-mcp
MCP client --stdio--> bonsai-mcp --127.0.0.1:9878--> Blender add-on (bpy + Bonsai + IfcOpenShell)
Part of IFC-CoPilot: A Tool-Based Framework for LLM-Driven IFC Building Design.
News
[2026-08] v1.2 released: three new tools that sync Blender after IFC edits without a full reload (
refresh_view,refresh_geometry,reload_project), plus IfcOpenShellselectorqueries inlist_elements. All releases.[2026-07] Bonsai MCP is public, with a documentation site: a lighter, code-generation-first rewrite of our earlier ifc-bonsai-mcp server.
[2025-11] MCP4IFC paper released on arXiv, the study that motivated this server.
Related MCP server: blender-ai-mcp
Relation to ifc-bonsai-mcp
This repository supersedes ifc-bonsai-mcp, which we used for the experiments in the MCP4IFC paper and which stays online for reproducibility.
The original ships a large set of predefined tools. This one is built around code generation. Modern LLMs write IfcOpenShell code well, so a small set of guarded code tools covers more IFC tasks than any fixed tool list, and adapts to tasks we never anticipated. The code-generation workflow is reworked and simplified here, and the server is lightweight, quick to connect, and easy to use.
Use this repository unless you need the original's fixed tools or the exact paper setup. It is the one we keep updated.
Requirements
Blender 3.6+ (4.x recommended).
Bonsai (BlenderBIM), only for the IFC tools. Install it from bonsaibim.org.
uv, one-time install below. Runs the server and handles Python 3.10+ for you.
git, to clone this repo. The server runs from your local checkout; it is not published to PyPI.
Setup (one-time)
Do these once. uv installs everything into the repo's own .venv the
first time you run it; nothing is installed globally, and nothing is
fetched from PyPI.
1. Install uv:
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"2. Clone this repo somewhere permanent, and note its full path; you point your MCP client at it below:
git clone https://github.com/Show2Instruct/bonsai-mcp.gitQuick start
1. Install the Blender add-on
In Blender: Edit > Preferences > Add-ons. On Blender 4.2+/5.x, open the ▾ menu (top-right) > Install from Disk...; on older versions use the Install... button.
Pick
blender_addon/bonsai_bridge.pyfrom the repo you cloned (that exact file, notscripts/package_addon.py), or install thebonsai_mcp_bridge-X.Y.Z.zipattached to the matching GitHub release the same way. Then tick Bonsai MCP Bridge to enable it.Open the sidebar (press N) > Bonsai MCP tab > Start Bridge. It now listens on
127.0.0.1:9878.
2. Connect your client
Point your client at the folder you cloned. Everywhere below, replace
/path/to/bonsai-mcp with that path. On Windows in JSON, either use forward
slashes or double every backslash (C:\\Users\\you\\bonsai-mcp).
Claude Code:
claude mcp add bonsai-mcp -- uv run --directory /path/to/bonsai-mcp bonsai-mcpClaude Desktop, Cursor, VS Code, and other clients: add this to the client's MCP config, then restart the client:
{ "mcpServers": { "bonsai-mcp": { "command": "uv", "args": ["run", "--directory", "/path/to/bonsai-mcp", "bonsai-mcp"] } } }On Windows, if the client can't find
uv, use its full path as thecommand(e.g.C:\\Users\\you\\.local\\bin\\uv.exe).
uv run builds the project into the repo's .venv on first launch
(editable, so your local edits take effect on the next restart) and caches
it after that.
3. Verify
With Blender running and the bridge started, run this from inside the cloned folder:
uv run bonsai-mcp doctordoctor pings the bridge and reports Blender / IfcOpenShell status and the
tools it exposes.
Per-client config paths, the Windows uv.exe path note, and optional
BONSAI_MCP_* settings are in docs/clients.md.
Example configs live in examples/; set the --directory
path to your clone.
Tools
Fourteen tools, each tagged [QUERY] (read-only) or [EDIT] (mutates state).
Category | Tool | Purpose |
QUERY |
| Scene summary plus an optional filtered object list (paged). |
QUERY |
| Per-object info for the current selection (capped). |
QUERY |
| IFC-backed elements filtered by class (inheritance-aware), name, storey, or an IfcOpenShell |
QUERY |
| IFC property and quantity sets for one or many objects (paged batches). |
QUERY |
| Capture the viewport: |
QUERY |
| Schema, counts, materials, classifications. |
QUERY |
| Site -> building -> storey -> space tree with element counts. |
QUERY |
| Quantity takeoff (areas, volumes, lengths) by class, optionally per storey. |
EDIT |
| Run IfcOpenShell / Bonsai API code. |
EDIT |
| Run arbitrary Python with full |
EDIT |
| Sync the scene after data-only IFC edits (names, psets); milliseconds, no disk I/O. |
EDIT |
| Rebuild geometry/placement for specific elements; targeted, no disk I/O. |
EDIT |
| Full scene rebuild from the in-memory model (slow, explicit escape hatch). |
EDIT |
| Write the model to disk: in place or save-as (guarded). Durability only. |
Every tool returns structured content alongside readable JSON text, and
the server also exposes MCP resources (bonsai://project,
bonsai://scene, per-element psets) and two workflow prompts
(model-audit, visual-verify).
Full reference with inputs, outputs, and examples: docs/tools.md.
Example prompt, with an IFC project open in Bonsai:
"List every wall in the model with its fire rating."
Safety
The bridge binds to 127.0.0.1 only and has no authentication, and
execute_blender_code runs arbitrary Python. Treat it like an open Python
REPL on your machine and never expose it to a network. See
docs/safety.md.
Documentation
Rendered site: show2instruct.github.io/bonsai-mcp
Client setup (Claude, Cursor, VS Code, OpenAI)
The changelog can be found on the GitHub Releases page.
Contributing
See CONTRIBUTING.md. Short version, with Python 3.10+
and uv:
uv venv
uv pip install -e ".[dev]"
uv run python -m ruff check src tests blender_addon scripts
uv run python -m pytestAdd tests and docs for behavior changes. Report security issues privately through GitHub Security Advisories (see SECURITY.md).
License
MIT. See LICENSE.
Disclaimer
This is not an official Bonsai release. Bonsai MCP is an independent project, not affiliated with or endorsed by the Bonsai (BlenderBIM) project, bonsaibim.org, or the Blender Foundation.
Available Tools
8 toolsexecute_blender_codeADestructive
[EDIT] Run arbitrary Python code inside Blender with full bpy access. Use ONLY when you need Blender-specific operations (viewport manipulation, rendering, object transforms, modifiers). For IFC/BIM data operations, ALWAYS prefer execute_ifc_code. LOCAL TRUSTED USE ONLY.
Inputs: code (required).
execute_ifc_codeADestructive
[EDIT] PREFERRED code execution tool. Runs IfcOpenShell / Bonsai API code with a pre-injected IFC namespace. bpy access is BLOCKED; use execute_blender_code only when you genuinely need Blender operations (viewport, rendering, object transforms). Pre-injected variables: ifc (the loaded IFC file or None), ifcopenshell, ifc_api (ifcopenshell.api), element_util (ifcopenshell.util.element), tool (bonsai.tool). Pre-injected helper functions: get_ifc_file() (loaded IFC file or raises), get_default_container() (active spatial container), save_and_load_ifc(path=None) (save the project and reload it; call this after IFC edits to make them visible in the viewport, since edits do NOT appear until the project is reloaded). Use this for: querying IFC entities, reading/writing properties, traversing the IFC model, calling ifcopenshell.api operations, and any BIM data work.
Inputs: code (required).
get_ifc_project_infoARead-only
[QUERY] Return IFC schema, project name, counts of sites/buildings/storeys, counts of common IFC entities, and material and classification summaries. Returns a clear error if no IFC project is loaded.
Inputs: no named parameters.
get_psetsARead-only
[QUERY] Return IFC property sets (psets) and quantity sets (qtos) for one or more objects. Accepts any mix of global_ids and names lists (Blender object names). Up to 100 targets per call. The response preserves input order in a results list.
Inputs: names, global_ids.
get_scene_infoARead-only
[QUERY] Return a summary of the current Blender scene (scene name, object count, selection, collections, IFC availability). When query is supplied, the response also includes an objects list filtered by the query. Supported queries: 'all', 'selected', 'walls', 'doors', 'windows', 'spaces', 'slabs', 'columns', 'beams', 'roofs', 'stairs', 'by_class', 'by_name', 'by_global_id'.
Inputs: name, query, global_id, ifc_class.
get_selected_objectsARead-only
[QUERY] Return name, type, location, dimensions, and (if available) IFC class and GlobalId for each currently selected object.
Inputs: no named parameters.
get_viewport_screenshotARead-only
[QUERY] Capture the Blender 3D viewport and return the image inline. Optionally aim the viewport first: view sets the direction (top/bottom/front/back/left/right = orthographic axis views, 'iso' = perspective isometric, 'camera' = scene camera) and fit frames the content ('all' or 'selected'). The render is downscaled so the longest edge fits max_size (default 800 px) and encoded as JPEG by default, keeping the response safely under MCP size limits. Scene render settings are restored afterwards; the viewport orientation persists.
Inputs: fit, view, format, quality, +3 more.
save_ifc_fileADestructive
[EDIT] Save the loaded IFC model. With no arguments it saves the project back to its own file (in-place, like File > Save IFC). Pass output_path for a save-as; that refuses to overwrite existing files unless overwrite=true. Pass reload=true to reload the project from the saved file afterwards, which rebuilds the Blender scene so IFC-level edits become visible in the viewport.
Inputs: reload, overwrite, output_path.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool has a clearly distinct purpose. execute_blender_code and execute_ifc_code are explicitly differentiated for Blender vs. IFC operations. The query tools (get_ifc_project_info, get_psets, get_scene_info, get_selected_objects) and save_ifc_file are non-overlapping.
All tool names follow a consistent verb_noun pattern (execute_, get_, save_). The naming clearly indicates action and target, making the set predictable for an agent.
With 8 tools covering code execution, queries, screenshots, and saving, the count is well-scoped for a BIM integration server. Each tool earns its place without redundancy or unnecessary complexity.
The tool surface covers core workflows: executing custom code (both Blender and IFC), querying project info and properties, capturing viewport, and saving. Minor gaps exist (e.g., no dedicated tool for creating/deleting entities), but these can be handled via execute_ifc_code.
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server exposing the Backtest360 engine API as tools for AI agents.
MCP server to assist with JxBrowser development.
MCP server for Boson Protocol — on-chain agentic commerce for physical & digital goods.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables AI clients to control Blender's 3D workflow via an embedded MCP server.459 PyPI61MIT
- AlicenseNot gradedqualityDmaintenanceConnects MCP-compatible clients to a live Blender scene for AI-assisted 3D workflows, enabling inspection and controlled operations on objects, materials, cameras, lights, render settings, animation, UVs, Geometry Nodes, imports, exports, and Python execution.1MIT
- AlicenseBqualityBmaintenanceMCP server for reading, viewing, and editing IFC models using IfcOpenShell and Bonsai. Enables querying model data, viewing via Blender's viewport, and making IFC-semantic edits without raw mesh operations.28MIT
- FlicenseNot gradedqualityCmaintenanceEnables remote control of Blender through MCP, allowing code execution, scene manipulation, rendering, and file transfer in a containerized environment.1-