Grasshopper MCP Bridge Server
Project description
Grasshopper MCP Bridge
Grasshopper MCP Bridge 是一個連接 Grasshopper 和 Claude Desktop 的橋接服務器,使用 Model Context Protocol (MCP) 標準協議。
功能特點
- 通過 MCP 協議連接 Grasshopper 和 Claude Desktop
- 提供直觀的工具函數,用於創建和連接 Grasshopper 組件
- 支持高層次意圖識別,可以從簡單描述自動創建複雜的組件模式
- 包含組件知識庫,了解常用組件的參數和連接規則
- 提供組件指南資源,幫助 Claude Desktop 正確連接組件
系統架構
該系統由以下部分組成:
- Grasshopper MCP 組件 (GH_MCP.gha):安裝在 Grasshopper 中的插件,提供 TCP 服務器接收命令
- Python MCP 橋接服務器:連接 Claude Desktop 和 Grasshopper MCP 組件的橋接服務器
- 組件知識庫:包含組件信息、模式和意圖的 JSON 文件
安裝說明
前提條件
- Rhino 7 或更高版本
- Grasshopper
- Python 3.8 或更高版本
- Claude Desktop
安裝步驟
-
安裝 Grasshopper MCP 組件
將
GH_MCP.gha文件複製到 Grasshopper 組件文件夾:%APPDATA%\Grasshopper\Libraries\ -
安裝 Python MCP 橋接服務器
使用 pip 安裝:
pip install grasshopper-mcp或從源代碼安裝:
git clone https://github.com/alfredatnycu/grasshopper-mcp.git cd grasshopper-mcp pip install -e .
使用方法
-
啟動 Rhino 和 Grasshopper
-
啟動 MCP 橋接服務器
在命令行中運行:
grasshopper-mcp -
在 Claude Desktop 中添加 MCP 服務器
在 Claude Desktop 的設置中添加以下 MCP 服務器配置:
{ "mcpServers": { "grasshopper": { "command": "grasshopper-mcp", "args": [] } } }
-
使用 Claude Desktop 與 Grasshopper 交互
現在您可以使用 Claude Desktop 向 Grasshopper 發送命令,例如:
- "在 Grasshopper 中創建一個 3D Voronoi"
- "添加一個圓形組件"
- "連接點和圓形組件"
可用工具
add_component:添加組件到 Grasshopper 畫布connect_components:連接兩個組件create_pattern:根據高層次描述創建組件模式get_available_patterns:獲取可用的模式列表clear_document:清空 Grasshopper 文檔save_document:保存 Grasshopper 文檔load_document:加載 Grasshopper 文檔get_document_info:獲取文檔信息
開發者指南
項目結構
grasshopper-mcp/
├── grasshopper_mcp/ # Python 包
│ ├── __init__.py
│ └── bridge.py # MCP 橋接服務器
├── GH_MCP/ # Grasshopper 組件源代碼
│ ├── GH_MCP/
│ │ ├── Commands/ # 命令處理器
│ │ ├── Models/ # 數據模型
│ │ ├── Resources/ # 資源文件
│ │ └── Utils/ # 工具類
│ └── GH_MCP.sln # Visual Studio 解決方案
├── setup.py # Python 包配置
└── README.md # 說明文檔
添加新功能
-
添加新的 Grasshopper 命令
在
GH_MCP/Commands/目錄中創建新的命令處理器,並在GrasshopperCommandRegistry.cs中註冊。 -
添加新的 MCP 工具
在
grasshopper_mcp/bridge.py中使用@server.tool裝飾器添加新的工具函數。 -
擴展組件知識庫
在
ComponentKnowledgeBase.json中添加新的組件、模式或意圖。
貢獻指南
歡迎提交 Pull Request 或 Issue 來改進這個項目。在提交代碼前,請確保:
- 代碼符合項目的編碼風格
- 添加了適當的測試
- 更新了文檔
許可證
MIT 許可證
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grasshopper_mcp-0.1.0.tar.gz.
File metadata
- Download URL: grasshopper_mcp-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db63435f443408073d9226301ec38b3bc3ce60dbf8817bb670d8ff3cc937827d
|
|
| MD5 |
225ac9636df023969831985a82c4c0df
|
|
| BLAKE2b-256 |
415561f5782aac802821a99aa42fac73c09451d90e6d538c8d46e0d84b6c854e
|
File details
Details for the file grasshopper_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: grasshopper_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e81166d45bf2122d6c69d87952f617c48df7a6fc6d6ad80ead3751dcd4f9bc8d
|
|
| MD5 |
435c87c2704a2695ed96d3c8bcd5e2ac
|
|
| BLAKE2b-256 |
8e27cbed5f1824207ba9dc88e04a58a34f7a173abad9398857842535c7bdfdb7
|