Skip to main content
Glama

Bonsai-mcp - 通过 IfcOpenShell 实现 IFC 的 Blender 模型上下文协议集成

Bonsai-mcp 是BlenderMCP的一个分支,��扩展了 BlenderMCP 的功能,并通过 Bonsai 专门支持 IFC(工业基础类)模型。此集成是一个快速的概念验证,旨在演示将 Claude 或任何 LLM(尽管仅使用 Claude 桌面客户端进行了测试)连接到 Blender 以执行 IfcOpenShell 命令的功能。

特征

  • IFC 特定功能:查询 IFC 模型、分析空间结构和检查建筑元素
  • 五种强大的 IFC 工具:检查项目信息、列出实体、检查属性、探索空间结构和分析关系
  • 顺序思维:包括来自modelcontextprotocol/servers的顺序思维工具,用于结构化问题解决
  • 来自原始 BlenderMCP 实现的执行代码工具:在 Blender 中创建和修改对象、应用材质以及执行 Python 代码
  • 使用标准模型进行测试:已验证使用默认的 ifcopenshell 房屋模型( AC20-FZK-Haus.ifc

成分

该系统由两个主要组件组成:

  1. Blender Addon( addon.py :Blender 插件,在 Blender 中创建套接字服务器来接收和执行命令,包括 IFC 特定的操作
  2. MCP 服务器 ( blender_mcp_tools.py ) :一个实现模型上下文协议并连接到 Blender 插件的 Python 服务器

安装

先决条件

  • Blender 3.0 或更新版本
  • Python 3.10 或更高版本
  • uv 包管理器
  • Blender 的 Bonsai BIM 插件(用于 IFC 功能)

安装 uv:

苹果:

brew install uv

视窗:

powershell -c "irm https://astral.sh/uv/install.ps1 | iex" set Path=C:\Users\[username]\.local\bin;%Path%

对于其他平台,请参阅uv 安装指南

克隆存储库

git clone https://github.com/JotaDeRodriguez/Bonsai_mcp

Claude 用于桌面集成

编辑您的claude_desktop_config.json文件(Claude > 设置 > 开发人员 > 编辑配置)以包含:

{ "mcpServers": { "Bonsai-mcp": { "command": "uv", "args": [ "--directory", "\\your\\path\\to\\Bonsai_mcp", "run", "tools.py" ] } } }

安装Blender插件

  1. 从这个 repo 下载addon.py文件
  2. 打开 Blender
  3. 前往“编辑”>“首选项”>“附加组件”
  4. 点击“安装...”并选择addon.py文件
  5. 通过选中“接口:Blender MCP - IFC”旁边的框来启用该插件

用法

启动连接

  1. 在 Blender 中,转到 3D 视图侧栏(如果看不到,请按 N)
  2. 找到“Blender MCP - IFC”选项卡
  3. 点击“连接到 Claude”
  4. 确保 MCP 服务器正在运行

与 Claude 一起使用

连接后,您将在 Claude 的界面中看到一个锤子图标,其中包含用于 Blender MCP IFC 集成的工具。

IFC 工具

此 fork 添加了五个强大的 IFC 特定工具:

1. 获取ifc项目信息

获取有关 IFC 项目的基本信息,包括名称、描述和不同实体类型的数量。

例如:“这个 IFC 项目的基本信息是什么?”

2. 列出ifc实体

列出特定类型的 IFC 实体(墙壁、门、空间等)。

例如:“列出此 IFC 模型中的所有墙壁”或“显示这栋建筑中的窗户”

3. 获取ifc属性

通过 GlobalId 获取特定 IFC 实体的所有属性。

例如:“ID 为 1Dvrgv7Tf5IfTEapMkwDQY 的墙的属性是什么?”

4. 获取ifc空间结构

获取 IFC 模型的空间层次结构(场地、建筑、楼层、空间)。

例如:“向我展示这座建筑的空间结构”

5. 获取ifc关系

获取特定 IFC 实体的所有关系。

例如:“入口门的关系是什么?”

执行 Blender 代码

原始 MCP 实现的遗留功能。允许 Claude 在 Blender 中执行任意 Python 代码。请谨慎使用。

顺序思维工具

这种集成还包括顺序思维工具,该工具有助于解决问题和分析问题的详细、逐步的思维过程。

工具参数:

  • thought (字符串):当前的思考步骤
  • nextThoughtNeeded (布尔值): 是否需要另一个思考步骤
  • thoughtNumber (整数):当前的想法数量
  • totalThoughts (整数):估计需要的想法总数
  • isRevision (布尔值,可选):这是否改变了以前的想法
  • revisesThought (整数,可选):正在重新考虑哪个想法
  • branchFromThought (整数,可选):分支点思想编号
  • branchId (字符串,可选):分支标识符
  • needsMoreThoughts (布尔值,可选):是否需要更多想法

例如:“使用顺序思维来分析这座建筑的能源效率”

示例命令

以下是您可以要求 Claude 使用 IFC 模型执行的操作的一些示例:

  • “分析一下这个 IFC 模型,告诉我它有多少面墙、多少扇门、多少扇窗户”
  • “给我看看这个建筑模型的空间结构”
  • “列出此 IFC 模型中的所有空间及其属性”
  • “识别该建筑的所有结构元素”
  • “这面墙和其他元素之间是什么关系?”
  • “运用顺序思维,基于 IFC 模型为该建筑制定维护计划”

故障排除

  • 连接问题:确保 Blender 插件服务器正在运行,并且 MCP 服务器已在 Claude 中配置
  • IFC 模型未加载:请确认您已安装 Bonsai BIM 插件,并且已加载 IFC 文件
  • 超时错误:尝试简化您的请求或将其分解为更小的步骤

技术细节

IFC 集成使用 Bonsai BIM 模块访问 Blender 中的 ifcopenshell 功能。通信遵循与原始 BlenderMCP 相同的基于 JSON 的 TCP 套接字协议。

限制和安全注意事项

  • 原始项目中的execute_blender_code工具仍然可用,允许在Blender中运行任意Python代码。请谨慎使用并始终保存您的工作。
  • 复杂的 IFC 模型可能需要将操作分解为更小的步骤。
  • IFC 查询性能取决于模型的大小和复杂性。

致谢

待办事项

游标实现添加“get_selected_ifc_elements”描述

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

将 Claude 与 Blender 集成的模型上下文协议服务器,使用户能够通过自然语言命令分析和与 IFC(工业基础类)建筑模型交互。

  1. 特征
    1. 成分
      1. 安装
        1. 先决条件
        2. 克隆存储库
        3. Claude 用于桌面集成
        4. 安装Blender插件
      2. 用法
        1. 启动连接
        2. 与 Claude 一起使用
      3. IFC 工具
        1. 获取ifc项目信息
        2. 列出ifc实体
        3. 获取ifc属性
        4. 获取ifc空间结构
        5. 获取ifc关系
      4. 执行 Blender 代码
        1. 顺序思维工具
          1. 工具参数:
        2. 示例命令
          1. 故障排除
            1. 技术细节
              1. 限制和安全注意事项
                1. 致谢
                  1. 待办事项

                    Related MCP Servers

                    • -
                      security
                      F
                      license
                      -
                      quality
                      A Model Context Protocol server that allows management and execution of Blender Python scripts, enabling users to create, edit and run scripts in a headless Blender environment through natural language interfaces.
                      Last updated -
                      4
                      Python
                    • A
                      security
                      F
                      license
                      A
                      quality
                      A starter template for building Model Context Protocol servers that can be integrated with Cursor or Claude Desktop, allowing developers to create custom tools and extensions for AI assistants.
                      Last updated -
                      1
                      6
                      9
                      TypeScript
                      • Apple
                    • -
                      security
                      F
                      license
                      -
                      quality
                      A Model Context Protocol server that bridges AI assistants like Claude with Wordware's specialized agent capabilities, allowing dynamic loading and access to any Wordware flow through a standardized interface.
                      Last updated -
                      Python
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol server that enables interaction with Foundry tools through natural language, allowing users to create projects, build contracts, run tests, and manage Ethereum development environments.
                      Last updated -
                      1
                      Python
                      MIT License

                    View all related MCP servers

                    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/JotaDeRodriguez/Bonsai_mcp'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server