Rhino 3D建模工具

Rhino MCP是一个AI驱动的3D建模工具,提供135+工具用于几何创建、表面/曲线/网格操作、变换、布尔运算、图层/材质/组/块管理、视图、注释和分析,适用于Rhino 8环境。

  • by quocvibui
  • Python
  • 本地部署
  • 6 星标
  • 更新于
在 GitHub 查看 quocvibui/rhino-mcp

使用说明

犀牛MCP

通过模型上下文协议在Rhino 8中实现AI驱动的3D建模。

概述

MCP服务器,配备135多种工具,用于Rhino 8中的代码执行、几何创建、曲面/曲线/网格操作、变换、布尔值、层/材质/组/块管理、视图、注释和分析。

主要特点:

  • 135个全面的3D建模工具
  • TCP套接字上的安全JSON协议
  • 模块化架构,易于扩展
  • 兼容CPython 3(Rhino 8)
  • 直接脚本API(在没有Claude的情况下工作)

快速开始

1.安装依赖项

pip install -r requirements.txt

2.启动Rhino监听器

在Rhino 8中,运行:

_-RunPythonScript "/path/to/rhino-mcp/server.py" _Enter

您应该看到:

============================================================
RhinoMCP Listener
============================================================
Starting background listener thread...
Listener started successfully
135+ commands ready
============================================================

3.配置克劳德桌面

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
	"mcpServers": {
		"rhino": {
			"command": "/usr/local/bin/python3",
			"args": ["/path/to/rhino-mcp/main.py"]
		}
	}
}

4.重新启动克劳德桌面和测试

尝试: Get scene info from Rhino and create a box at origin

5.自定义您的Claude项目

我们目前的Rhino MCP允许代码执行,这意味着Claude可以直接执行代码 在Rhino。为了得到最好的结果。将文档放入 resources/ 放入您的项目文件夹。将此说明添加到项目中:

If you have problems with debugging, search up: "https://developer.rhino3d.com/api/RhinoScriptSyntax/" or "RhinoAPI", "RhinoScriptSyntax"

文档

建筑

┌─────────────────┐
│  Claude Desktop │ (Python 3.10+)
└────────┬────────┘
         │ MCP Protocol
         ▼
┌─────────────────┐
│    main.py      │ FastMCP server with 135+ tools
│    tools/       │ Modular tool definitions
└────────┬────────┘
         │ JSON over TCP (localhost:54321)
         ▼
┌─────────────────┐
│   server.py     │ Socket server (CPython 3 - Rhino 8)
│   rhino/        │ RhinoScriptSyntax wrappers
└─────────────────┘
         │
         ▼
    Rhino 8 API

三层:

  1. MCP层 (main.py, tools/)Python 3.10+,向Claude公开了135+个工具
  2. 套接字服务器 (server.py)CPython 3在Rhino 8内部运行
  3. Rhino模块 (rhino/)-按API类别组织

文件结构

rhino-mcp/
├── main.py                    # MCP server entry point
├── server.py                  # Rhino socket server
├── test.py                    # Test suite (185+ tests)
├── tools/                     # MCP tool definitions (16 modules)
│   ├── utils.py               # Shared socket communication
│   ├── geometry.py            # Geometry creation tools
│   ├── surface.py             # Surface/solid tools
│   ├── curve.py               # Curve tools
│   ├── mesh.py                # Mesh tools
│   ├── transformation.py      # Transform tools
│   ├── layer.py               # Layer management tools
│   ├── object.py              # Object property tools
│   ├── selection.py           # Selection tools
│   ├── document.py            # Document/scene tools
│   ├── group.py               # Group tools
│   ├── view.py                # View/camera tools
│   ├── block.py               # Block instance tools
│   ├── material.py            # Material tools
│   ├── annotation.py          # Annotation tools
│   ├── userdata.py            # User data tools
│   └── utility.py             # Measurement + code execution
├── rhino/                     # RhinoScriptSyntax wrappers (16 modules)
│   ├── commands.py            # High-level command routing (135+ commands)
│   ├── curve.py               # Curve functions
│   ├── surface.py             # Surface functions
│   ├── mesh.py                # Mesh functions
│   ├── object.py              # Object manipulation
│   ├── selection.py           # Selection functions
│   ├── layer.py               # Layer functions
│   ├── geometry.py            # Geometry functions
│   ├── plane.py               # Plane functions
│   ├── document.py            # Document functions
│   ├── group.py               # Group functions
│   ├── view.py                # View/camera functions
│   ├── block.py               # Block functions
│   ├── material.py            # Material functions
│   ├── annotation.py          # Annotation functions
│   ├── userdata.py            # User data functions
│   └── utility.py             # Utility functions
├── script/                    # Example scripts
│   ├── linear_array.py
│   ├── spiral.py
│   └── ...
└── resources/                 # Drop into your Claude Project folder
    └── ...

使用示例

# Geometry
Create a box 10x10x10 at origin
Create a sphere at (20,0,0) with radius 5

# Transformations
Select all objects
Move them by (10, 0, 0)
Rotate them 45 degrees around origin

# Booleans
Create two overlapping boxes
Select all and boolean union them

# Layers
Create layer "Walls" with red color
Set current layer to "Walls"

# Analysis
Measure the distance between (0,0,0) and (10,0,0)
Select the circle and measure its area

# Mesh
Create a mesh from selected surfaces
Boolean union the selected meshes

# Views
Set display mode to Wireframe
Zoom to fit all objects

# Materials
Add a red material to the selected object
Set material transparency to 50%

# Code Execution
Create for me a spiral staircase in Rhino

测试

运行全面的测试套件:

python3 test.py

测试所有135+个命令和错误处理(总共185+个测试)。看 测试.md 了解详情。

故障排除

无法连接到Rhino

  • 确保Rhino 8在侦听器处于活动状态时运行
  • 检查端口54321是否可用

Rhino中的语法无效

  • server.py和rhino/模块使用CPython 3(rhino 8)
  • 验证 rhino/ 模块可访问

MCP服务器故障

  • 检查是否已安装Python 3.10+
  • 运行: pip install -r requirements.txt
  • 在Claude配置中使用绝对路径

工具不在Claude中

  • 更改配置后重新启动Claude Desktop
  • 检查日志: ~/Library/Logs/Claude/

需求

  • Python 3.10+ (适用于MCP服务器)
  • 犀牛8 适用于macOS(CPython 3附带)
  • 主控程序 和 fastmcp 包裹

已测试

  • macOS(苹果硅)
  • Rhino 8 for macOS
  • Python 3.10+

所有185+项测试均通过。欢迎其他平台的社区贡献。

注: 所有命令都被分派到Rhino的UI线程,以防止macOS线程崩溃。

许可证

MIT许可证-请参阅 许可证 文件以获取详细信息。