GOLEM-3DMCP
"Shaped from clay, brought to life by words"
The most powerful MCP server for Rhinoceros 3D — 105 tools giving AI full read/write access to Rhino 8.
______________________________________________________________________
GOLEM-3DMCP实施 模型上下文协议 为AI代理提供Rhino 8的直接编程控制——创建几何体、运行布尔值、驱动Grasshopper、捕获视口和执行任意Python脚本,所有这些都是通过自然语言完成的。
适用于 克劳德代码, 光标, 帆板运动,以及任何MCP兼容主机。
______________________________________________________________________
演示——一座完全由人工智能建造的城市
通过GOLEM-3DMCP在Rhino 8中生成的整个城市——道路、摩天大楼、房屋、树木、人、车辆、体育场、桥梁、摩天轮、港口、风力涡轮机和浮动的GOLEM全息图。所有这些都是由Claude Code使用自然语言命令创建的。
Watch the full demo on YouTube
Full city overview — ground, roads, buildings, park, harbor, sky
Skyline view — skyscrapers, bridge, wind turbines, floating GOLEM hologram
Close-up — GOLEM monument plaza, residential buildings, fountain
Street level — vehicles, people, street lamps, stadium, harbor with boats
______________________________________________________________________
安装
pip install golem-3dmcp就是这样。从零到AI驱动的Rhino的三个命令:
# 1. Install
pip install golem-3dmcp
# 2. Deploy the Rhino plugin (one-time)
golem install-rhino
# 3. Verify everything works
golem doctor连接到您的AI代理
添加到您的MCP配置(Claude Code、Cursor、Windsurf等):
{
"mcpServers": {
"golem-3dmcp": {
"command": "uvx",
"args": ["golem-3dmcp"]
}
}
}开始通过AI与Rhino对话。
______________________________________________________________________
9个类别的105个工具
| 类别 | 工具 | 亮点 |
|---|---|---|
| 场景智能 | 10 | 文档信息、图层、对象、组、块——完全分页 |
| 几何图形创建 | 38 | 点、曲线、NURBS、实体、网格、SubD、文本、尺寸、图案填充 |
| 几何运算 | 19 | 布尔并集/差分/交集、修剪、分割、偏移、圆角、倒角 |
| 表面操作 | 12 | 放样、扫1/2、旋转、拉伸、网状曲面、贴片、边缘曲面、展开 |
| 对象操纵 | 21 | 移动、复制、旋转、缩放、镜像、阵列、连接、分解、分组、属性 |
| 蚱蜢 | 9 | 打开定义、设置/获取参数、重新计算、烘焙、检查组件 |
| 视口和可视化 | 13 | 截图(base64 PNG)、相机控制、命名视图、显示模式 |
| 文件操作 | 9 | 保存、打开、导入、导出(STL、OBJ、STEP、IGES、FBX、3MF、DWG、PDF…) |
| 脚本执行 | 4 | 使用完整的RhinoCommon访问权限执行任意Python,运行Rhino命令 |
看 工具参考 提供完整的API参数和示例。
______________________________________________________________________
建筑
AI Agent (Claude Code / Cursor / Windsurf)
|
| MCP (stdio, JSON-RPC)
v
+---------------------------+
| GOLEM MCP Server |
| Python 3.10+ |
| FastMCP + 9 tool |
| modules |
+---------------------------+
|
| TCP 127.0.0.1:9876
| Length-prefixed JSON
v
+---------------------------+
| Rhino Plugin |
| Python 3.9 (embedded) |
| TCP Server |
| 9 handler modules |
+---------------------------+
|
| RhinoCommon + rhinoscriptsyntax
v
+---------------------------+ +-------------------------+
| Rhinoceros 3D | | Grasshopper |
| Document, Geometry, | | Sub-server :9877 |
| Layers, Views | | Definitions, Params |
+---------------------------+ +-------------------------+______________________________________________________________________
快速入门示例
创建和组合几何图形:
Create a 100 x 50 x 30 box on a layer called 'Structure',
then boolean-union it with a sphere of radius 20 centred at [50, 25, 30].查询场景:
List all objects on the 'Walls' layer and tell me their volumes.驱动蚱蜢:
Open parametric_facade.gh, set the 'PanelCount' slider to 24,
recompute, and bake the result to a 'Facade' layer.捕获视口:
Set perspective view to shaded mode, zoom to extents, and capture a screenshot.执行任意Python:
import Rhino.Geometry as rg
pts = [rg.Point3d(i*10, 0, i**2) for i in range(20)]
crv = rg.Curve.CreateInterpolatedCurve(pts, 3)
sc.doc.Objects.AddCurve(crv)
__result__ = {"point_count": len(pts), "length": crv.GetLength()}______________________________________________________________________
加载Rhino插件
- 打开Rhino 8
- 打开脚本编辑器:
Tools > Python Script > Edit - 打开
startup.py(由部署golem install-rhino)然后单击 跑
GOLEM-3DMCP: Starting server on 127.0.0.1:9876...
GOLEM-3DMCP: Server started successfully!
GOLEM-3DMCP: 135 handler methods registered.每次Rhino启动时自动启动: Tools > Options > RhinoScript > Startup Scripts > Add startup.py
______________________________________________________________________
配置
| 变量 | 默认值 | 描述 |
|---|---|---|
GOLEM_RHINO_HOST | 127.0.0.1 | Rhino插件主机 |
GOLEM_RHINO_PORT | 9876 | Rhino插件TCP端口 |
GOLEM_GH_PORT | 9877 | Grasshopper子服务器端口 |
GOLEM_TIMEOUT | 30 | 命令超时(秒) |
GOLEM_HEAVY_TIMEOUT | 120 | 重操作超时(秒) |
______________________________________________________________________
需求
| 要求 | 版本 |
|---|---|
| 犀牛3D | 8.x(macOS) |
| Python | 3.10+ |
| macOS | 12蒙特利或更新版本 |
Rhino插件在Rhino的嵌入式Python 3.9中运行,没有任何外部依赖。
______________________________________________________________________
故障排除
| 问题 | 快速修复 |
|---|---|
| 连接被拒绝 | 启动Rhino+运行 startup.py |
| 端口已在使用中 | lsof -i :9876 然后终止该进程 |
| MCP服务器不在Claude中 | 检查您的MCP配置JSON |
| 蚱蜢工具失灵 | 先在Rhino中打开蚱蜢 |
| Python版本错误 | MCP服务器需要Python 3.10+ |
跑 golem doctor 自动诊断问题。
看 故障排除指南 详细的解决方案。
______________________________________________________________________
文档
______________________________________________________________________
测试
# Unit tests (no Rhino needed)
pytest tests/ -v --ignore=tests/test_integration.py
# Full suite (integration tests auto-skip if Rhino not running)
pytest tests/ -v
# Integration tests only (requires Rhino + plugin running)
pytest tests/test_integration.py -v -m integration______________________________________________________________________
分支策略
此存储库使用两个分支:
| 分支 | 目的 |
|---|---|
main | GOLEM-3DMCP源代码开发——功能、错误修复、文档 |
claude/pypi-package-setup-PMCI5 | PyPI打包和发布——构建配置、版本控制、发布脚本 |
- 开发 上
main--所有工具模块、Rhino插件、测试和文档都在这里。 - 发布 来自PyPI分支——打包结构(
pyproject.toml,src/布局、发布脚本)是单独管理的,因此发布不会污染开发历史。
main ← development
└── claude/pypi-package-setup-PMCI5 ← PyPI releases (pip install golem-3dmcp)______________________________________________________________________
项目结构
golem-3dmcp/
├── src/golem_3dmcp/ # MCP Server (pip install golem-3dmcp)
│ ├── cli.py # CLI entry point (golem command)
│ ├── server.py # FastMCP server
│ ├── connection.py # TCP client (singleton, thread-safe)
│ ├── protocol.py # Wire format: 4-byte length prefix + JSON
│ ├── config.py # Environment variable configuration
│ ├── models/ # Pydantic data models
│ ├── tools/ # 9 MCP tool modules
│ └── _rhino_plugin/ # Bundled Rhino plugin (deployed via CLI)
├── tests/ # 226 tests (pytest)
├── docs/ # Architecture, protocol spec, tool reference
└── pyproject.toml # Package definition______________________________________________________________________
贡献
我们欢迎捐款!以下是如何开始:
开发设置
# Clone the repository
git clone https://github.com/TheKingHippopotamus/GOLEM-3DMCP-Rhino-.git
cd GOLEM-3DMCP-Rhino-
# Create virtual environment (Python 3.10+ required)
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install代码质量
合并前必须通过所有CI检查:
# Lint
ruff check src/ tests/
# Type check (strict mode)
mypy src/golem_3dmcp/ --ignore-missing-imports
# Unit tests (no Rhino needed)
pytest tests/ -v --ignore=tests/test_integration.py
# Integration tests (requires Rhino 8 + plugin running)
pytest tests/test_integration.py -v -m integration需要了解的关键事项
- 两个Python运行时 --MCP服务器运行在Python 3.10+上,但是
_rhino_plugin/在Rhino的嵌入式Python 3.9中运行。它们通过TCP进行通信。不要在插件中添加3.10+语法。 _rhino_plugin/被排除在mypy之外 --它使用Rhino特定的导入(Rhino.*,Grasshopper.*,clr)这在标准环境中是不存在的。- 工具注册 --工具使用
@mcp.tool()装饰师。每个工具模块导入mcp从server.py.在中添加新工具src/golem_3dmcp/tools/并在中注册该模块server.py:main(). - 线程安全 —
RhinoConnection是一个线程安全的单例,在套接字I/O周围有一个锁。不要绕过send_command(). - 协议 --TCP消息使用4字节长度前缀JSON。看
protocol.py对于线格式。
拉取请求流程
- 从以下位置创建要素分支
main - 进行更改
- 确保所有检查均已通过(
ruff,mypy,pytest) - 提交一份带有清晰描述的PR
看 贡献.md 完整的指南。
______________________________________________________________________
许可证
MIT许可证。看 许可证 了解详情。
______________________________________________________________________
Glama上的MCP服务器
______________________________________________________________________
学分
Created by King Hippopotamus
Built by NEXUS AI — 195 autonomous agents | 20 departments | 11 tiers
______________________________________________________________________
内置: FastMCP · RhinoCommon · 鼻脚本语法 · Grasshopper SDK
______________________________________________________________________
"From formless clay, through the power of words, form emerges."
