Grasshopper MCP
Enables remote execution of Python code in Rhino/Grasshopper, allowing AI to automate computational design workflows, generate scripts, and interact with the Grasshopper canvas in real-time.
Powers ML-based layout optimization features including DBSCAN and K-means clustering for component grouping, K-NN position prediction for component placement, and pattern learning for Grasshopper definitions.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
š Rhino Grasshopper MCP - AI-Powered Computational Design Assistant
An MCP (Model Context Protocol) server that brings AI capabilities directly into Rhino/Grasshopper workflows, featuring ML-based automatic layout optimization - a capability not found in any other publicly available tool.
šÆ What Makes This Different?
Unlike basic Grasshopper-to-LLM connectors that only generate code, this tool includes:
š§ ML-Based Auto Layout (Industry First)
DBSCAN clustering for automatic component grouping
K-means clustering for fixed group counts
User pattern learning with persistent preferences
K-NN position prediction for optimal new component placement
Wire crossing minimization algorithm
š AI Mentoring System
Performance prediction: Estimates optimization impact (e.g., "15-30% improvement expected")
Pattern detection: Identifies inefficient patterns and suggests better alternatives
Auto-grouping: Analyzes wire connectivity to suggest logical component groups
Layout anomaly detection: Finds isolated, overlapping, or misaligned components
š Live Rhino Integration
Real-time connection to running Rhino/Grasshopper instances
Execute Python code remotely in Rhino
Get canvas state and trigger solves
No file-based workflow required
Related MCP server: RhinoMCP
š Features Overview
Category | Features |
Rhino Bridge | Live connection, remote Python execution, canvas state |
GH File Ops | Parse .gh/.ghx files, analyze structure, extract components |
Component Library | Searchable database of 500+ GH components |
Code Generation | GHPython and C# script templates |
AI Mentoring | Performance prediction, alternatives, auto-grouping |
ML Layout | Clustering, position prediction, crossing minimization |
š ļø Installation
git clone https://github.com/dongwoosuk/rhino-grasshopper-mcp.git
cd rhino-grasshopper-mcp
python -m venv .venv
.venv\Scripts\activate # Windows
pip install -e .āļø Configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"grasshopper": {
"command": "path/to/rhino_grasshopper_mcp/.venv/Scripts/python.exe",
"args": ["-m", "rhino_grasshopper_mcp"]
}
}
}š Live Rhino Connection (Optional)
To enable real-time Rhino/Grasshopper control:
Open Rhino 7 or 8
Run
ScriptEditorin Rhino 8 and select Python 3Open and run
rhino_listener/rhino_bridge_listener.pywith Python 3. Keep the cloned repository structure: the listener also needs its siblinggraph_operations.pyandrhino_grasshopper_mcp/port_layout.py. New batch graphs use Elefront EF Data Description (R6); install Elefront before usinggh_apply_graph. Do not launch this listener with the legacyEditPythonScript/ IronPython editor.You'll see:
Rhino Bridge Listener started on localhost:8080
š Available Tools
Rhino Bridge (requires listener)
Tool | Description |
| Check connection status |
| Execute Python in Rhino |
| Get current canvas state |
| Load a .gh file |
| Trigger recompute |
AI Mentoring Tools
Tool | Description |
| Predict optimization impact |
| Detect patterns, suggest better approaches |
| Analyze connectivity, suggest groupings |
| ML clustering analysis |
| K-NN based position prediction |
Pattern Detection Examples
The suggest_alternatives tool detects these inefficient patterns:
Pattern | Better Alternative |
Multiple Move components | Single Transform Matrix |
Flatten + Graft sequence | Path Mapper |
Python loops for geometry | Native GH components |
Serial Boolean operations | Batch Boolean |
Expression for simple math | Native Math components |
šļø Architecture
rhino_grasshopper_mcp/
āāā rhino_grasshopper_mcp/
ā āāā bridge.py # Main MCP server
ā āāā rhino_bridge.py # TCP client to Rhino
ā āāā gh_file_ops.py # .gh/.ghx parsing
ā āāā component_library.py # Component database
ā āāā code_generator.py # Code templates
ā āāā mentoring/
ā āāā ml_layout_learner.py # DBSCAN/K-means
ā āāā advanced_layout_learner.py # Advanced learning
ā āāā persistent_layout_learner.py # User patterns
ā āāā performance_predictor.py # Optimization prediction
ā āāā alternative_suggester.py # Pattern detection
ā āāā auto_grouper.py # Wire-based grouping
ā āāā wire_crossing_detector.py # Crossing detection
ā āāā crossing_minimizer.py # Layout optimization
āāā rhino_listener/
ā āāā rhino_bridge_listener.py # Run IN Rhino
āāā pyproject.tomlš¤ ML Layout System Details
How It Works
Feature Extraction: Analyzes component positions, types, and connections
Clustering: Groups components using DBSCAN or K-means
Pattern Learning: Stores user preferences in
layout_preferences.jsonPosition Prediction: Uses K-NN to suggest optimal positions for new components
Anomaly Detection: Identifies layout issues (isolated nodes, overlaps, wrong flow direction)
Supported Analyses
# Example: ML clustering analysis
result = ml_layout_analysis(gh_file_path, method="dbscan")
# Returns: clusters, anomalies, optimization suggestions
# Example: Position prediction
result = predict_component_position(gh_file_path, "Panel", near_component="Slider")
# Returns: predicted X, Y coordinates based on learned patternsšÆ Use Cases
Design Automation: Let AI handle repetitive Grasshopper tasks
Code Review: Get suggestions for optimizing definitions
Learning: AI mentoring for Grasshopper best practices
Layout Cleanup: Automatic organization of messy definitions
Team Standards: Consistent component arrangement across projects
š License
MIT License - see LICENSE file.
š Acknowledgments
Built on the Model Context Protocol by Anthropic
Grasshopper by David Rutten / McNeel
scikit-learn for ML algorithms
š¬ Contact
Dongwoo Suk - Computational Design Specialist
GitHub: dongwoosuk
LinkedIn: dongwoosuk
Graph and layout update
See upgrade notes and validation for measured-port layout, batch graph tools, Rhino 8 Python 3 defaults and Elefront Name View descriptions. Keep the repository folder structure when updating the listener.
This server cannot be deployed
Maintenance
Related MCP Connectors
AI for Revit: 450+ tools, 1 undo step. Windows, Revit 2024ā2027 (2021ā2023 included). Free account.
AI Hub for AEC ā 50+ 3D formats, clash detection, ACC integration via Autodesk Platform Services.
Parametric 3D CAD for AI agents: build print-ready parts, check them, export STL, 3MF or STEP.
AI clash detection in Navisworks Manage 2025ā2027 on your PC. Needs the free plug-in.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that enables designers to interact with Rhino and Grasshopper via LLMs, analyze .3dm files, perform 3D modeling, and automatically generate GHPython code in Grasshopper based on user guidance.832MIT
- AlicenseNot gradedqualityCmaintenanceConnects Rhino and Grasshopper to Claude AI via the Model Context Protocol, enabling prompt-assisted 3D modeling, scene manipulation, and control through tools like object creation, layer management, and code execution.29MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI-powered 3D modeling in Rhino 8 through 135+ tools for geometry, transformations, booleans, layers, materials, and more, using natural language.6MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI clients such as Codex, Claude, and Cursor to control Rhino and Grasshopper through natural language, including creating and modifying geometry, managing layers, inspecting scenes, and running Grasshopper operations.MIT