Grasshopper MCP

Grasshopper MCP

Enables AI-powered computational design in Rhino/Grasshopper with ML-based automatic layout optimization, component clustering, performance prediction, and real-time code execution in running Rhino instances.

Category
Visit Server

README

šŸš€ 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.

Version Status License: MIT Python 3.10+

šŸŽÆ 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

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:

  1. Open Rhino 7 or 8
  2. Run EditPythonScript command
  3. Open and run rhino_listener/rhino_bridge_listener.py
  4. You'll see: Rhino Bridge Listener started on localhost:8080

šŸ“š Available Tools

Rhino Bridge (requires listener)

Tool Description
rhino_status Check connection status
rhino_execute_python Execute Python in Rhino
gh_canvas_state Get current canvas state
gh_load_definition Load a .gh file
gh_solve Trigger recompute

AI Mentoring Tools

Tool Description
predict_performance Predict optimization impact
suggest_alternatives Detect patterns, suggest better approaches
auto_group Analyze connectivity, suggest groupings
ml_layout_analysis ML clustering analysis
predict_component_position 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

  1. Feature Extraction: Analyzes component positions, types, and connections
  2. Clustering: Groups components using DBSCAN or K-means
  3. Pattern Learning: Stores user preferences in layout_preferences.json
  4. Position Prediction: Uses K-NN to suggest optimal positions for new components
  5. 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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured