Skip to main content
Glama
Bonsai MCP

Bonsai MCP

Bonsai MCP

CI License: MIT Python 3.10+ Docs

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)

Bonsai MCP workflow: an MCP client drives the bonsai-mcp server, which talks to the Blender add-on and the IFC model loaded in Bonsai

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 IfcOpenShell selector queries in list_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.git

Quick start

1. Install the Blender add-on

  1. 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.

  2. Pick blender_addon/bonsai_bridge.py from the repo you cloned (that exact file, not scripts/package_addon.py), or install the bonsai_mcp_bridge-X.Y.Z.zip attached to the matching GitHub release the same way. Then tick Bonsai MCP Bridge to enable it.

  3. 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-mcp
  • Claude 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 the command (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 doctor

doctor 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

get_scene_info

Scene summary plus an optional filtered object list (paged).

QUERY

get_selected_objects

Per-object info for the current selection (capped).

QUERY

list_elements

IFC-backed elements filtered by class (inheritance-aware), name, storey, or an IfcOpenShell selector query (properties, materials, attributes); paged.

QUERY

get_psets

IFC property and quantity sets for one or many objects (paged batches).

QUERY

get_viewport_screenshot

Capture the viewport: view or azimuth/elevation, direction-aware fit, per-storey floor plans, shading incl. color-by-class, plus structured viewport state with depth.

QUERY

get_ifc_project_info

Schema, counts, materials, classifications.

QUERY

get_spatial_structure

Site -> building -> storey -> space tree with element counts.

QUERY

get_quantities

Quantity takeoff (areas, volumes, lengths) by class, optionally per storey.

EDIT

execute_ifc_code

Run IfcOpenShell / Bonsai API code. bpy blocked.

EDIT

execute_blender_code

Run arbitrary Python with full bpy access.

EDIT

refresh_view

Sync the scene after data-only IFC edits (names, psets); milliseconds, no disk I/O.

EDIT

refresh_geometry

Rebuild geometry/placement for specific elements; targeted, no disk I/O.

EDIT

reload_project

Full scene rebuild from the in-memory model (slow, explicit escape hatch).

EDIT

save_ifc_file

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

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 pytest

Add 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 tools
execute_blender_codeA
Destructive

[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_codeA
Destructive

[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_infoA
Read-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_psetsA
Read-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_infoA
Read-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_objectsA
Read-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_screenshotA
Read-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_fileA
Destructive

[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

    A4.4/5.0

    Scored across 8 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects 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.
      1
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      MCP 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.
      28
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables remote control of Blender through MCP, allowing code execution, scene manipulation, rendering, and file transfer in a containerized environment.
      1
      -