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.
π 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
π 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
βοΈ Configuration
Add to your claude_desktop_config.json:
π Live Rhino Connection (Optional)
To enable real-time Rhino/Grasshopper control:
Open Rhino 7 or 8
Run
EditPythonScriptcommandOpen and run
rhino_listener/rhino_bridge_listener.pyYou'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
π€ 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
π― 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