RhinoMCP
RhinoMCP 通过模型上下文协议 (MCP) 将 Rhino3D 连接到 Claude AI,使 Claude 能够直接与 Rhino3D 交互并控制 Rhino3D,以实现 AI 辅助的 3D 建模、分析和设计工作流程。
项目概述
这种集成由两个主要部分组成:
Rhino 插件:在 Rhino 的 Python 编辑器中运行的套接字服务器,为 Rhino 的功能提供通信接口。
MCP 服务器:模型上下文协议的实现,将 Claude AI 连接到 Rhino 插件,从而实现 AI 控制的操作。
Related MCP server: SketchupMCP
特征
Python与Rhino之间基于Socket的双向通信
用于 Claude AI 集成的模型上下文协议服务器
支持 NURBS 曲线创建(初始测试功能)
在 Rhino 上下文中执行 Python 脚本
兼容 Claude Desktop 和 Windsurf 客户端
安装
要求
Rhinoceros 3D(版本 7 或 8)
Python 3.10 或更高版本
Windows 10 或 11
使用 uv 安装(推荐)
# 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 服务器
打开 Rhino
在命令行中输入
EditPythonScript以打开 Rhino 的 Python 编辑器从
src/rhino_plugin/rhino_server.py打开 Rhino 服务器脚本运行脚本(F5 或单击运行按钮)
确认输出面板中显示“Rhino Bridge started!”
步骤 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执照
贡献
欢迎贡献代码!欢迎提交 Pull 请求。