3D建模AI控制工具

RhinoMCP通过模型上下文协议(MCP)将Rhino3D与Claude AI连接,实现AI辅助的3D建模、分析和设计工作流程。

  • by fernandomaytorena
  • Python
  • 本地部署
  • 13 星标
  • 更新于
在 GitHub 查看 a01110946/RhinoMCP

使用说明

RhinoMCP

RhinoMCP通过模型上下文协议(MCP)将Rhino3D连接到Claude AI,使Claude能够直接与Rhino3D交互和控制Rhino3D,以实现AI辅助的3D建模、分析和设计工作流程。

项目概述

这种集成由两个主要部分组成:

  1. Rhino插件:在Rhino的Python编辑器中运行的套接字服务器,为Rhino的功能提供通信接口。
  2. MCP服务器:模型上下文协议的实现,将Claude AI连接到Rhino插件,实现AI控制的操作。

特性

  • Python和Rhino之间基于Socket的双向通信
  • 用于Claude AI集成的模型上下文协议服务器
  • 支持NURBS曲线创建(初始测试功能)
  • Rhino上下文中的Python脚本执行
  • 与Claude Desktop和Windsurf客户端兼容

安装

需求

  • 犀牛3D(版本7或8)
  • Python 3.10或更高版本
  • Windows 10或11

使用紫外线进行安装(推荐)

# Create and activate a virtual environment 
mkdir -p .venv
uv venv .venv
source .venv/Scripts/activate  # On Windows with Git Bash

# Install the package
uv pip install -e .

使用pip安装

# Create and activate a virtual environment
python -m venv .venv
.venv\Scripts\activate  # On Windows

# Install the package
pip install -e .

用法

步骤1:启动Rhino Bridge服务器

  1. 打开Rhino
  2. 类型 EditPythonScript 在命令行中打开Rhino的Python编辑器
  3. 从以下位置打开Rhino服务器脚本 src/rhino_plugin/rhino_server.py
  4. 运行脚本(F5或单击运行按钮)
  5. 确认您在输出面板中看到“Rhino Bridge已启动!”

步骤2:启动MCP服务器

# Activate your virtual environment
source .venv/Scripts/activate  # On Windows with Git Bash

# Start the MCP server
rhinomcp

或者使用自定义设置运行:

rhinomcp --host 127.0.0.1 --port 5000 --rhino-host 127.0.0.1 --rhino-port 8888 --debug

步骤3:连接Claude Desktop或Windsurf

配置Claude Desktop或Windsurf以连接到MCP服务器:

ws://127.0.0.1:5000

示例:创建NURBS曲线

当连接到Claude时,您可以要求它在Rhino中创建NURBS曲线,并给出如下提示:

Create a NURBS curve in Rhino using points at (0,0,0), (5,10,0), (10,0,0), and (15,10,0).

发展

设置开发环境

# Clone the repository
git clone https://github.com/FernandoMaytorena/RhinoMCP.git
cd RhinoMCP

# Create and activate virtual environment
uv venv .venv
source .venv/Scripts/activate  # On Windows with Git Bash

# Install development dependencies
uv pip install -e ".[dev]"

运行测试

pytest

代码的风格

此项目使用Ruff进行linting和格式化:

ruff check .
ruff format .

项目结构

RhinoMCP/
├── src/
│   ├── rhino_plugin/  # Code that runs inside Rhino
│   │   └── rhino_server.py
│   └── rhino_mcp/     # MCP server implementation
│       ├── rhino_client.py
│       └── mcp_server.py
├── tests/             # Test modules
├── docs/              # Documentation
├── config/            # Configuration files
├── ai/                # AI documentation and prompts
├── setup.py           # Package installation
├── requirements.txt   # Package dependencies
└── README.md          # Project documentation

许可证

MIT许可证

贡献

欢迎投稿!请随时提交拉取请求。