Rhino and Grasshopper integration through the Model Context Protocol with uv package management
Project description
RhinoMCP with UV Package Management
RhinoMCP connects Rhino, Grasshopper and more to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Rhino + Grasshopper. This version uses UV for modern, fast package management and dependency resolution.
Features
Rhino Integration
- Two-way communication: Connect Claude AI to Rhino through a socket-based server
- Object manipulation and management: Create and modify 3D objects in Rhino including metadata
- Layer management: View and interact with Rhino layers
- Scene inspection: Get detailed information about the current Rhino scene (incl. screencapture)
- Code execution: Run arbitrary Python code in Rhino from Claude
Grasshopper Integration
- Code execution: Run arbitrary Python code in Grasshopper from Claude - includes the generation of gh components
- Canvas inspection: Get detailed information about your Grasshopper definition, including component graph and parameters
- Component management: Update script components, modify parameters, and manage code references
- External code integration: Link script components to external Python files for better code organization
- Real-time feedback: Get component states, error messages, and runtime information
- Non-blocking communication: Stable two-way communication via HTTP server
AI Integration
- Replicate API: Access thousands of AI models via API, including stable diffusion variants
- Web search: Integrated web search capabilities
- Email integration: Gmail integration for email search and management
Architecture
The system consists of three main components:
- MCP Server (
rhino_gh_mcp_uv/): Python server implementing the Model Context Protocol - Rhino Plugin (
../rhino_script_client/rhino_client.py): Socket server running inside Rhino (port 9876) - Grasshopper Component (
../rhino_gh_mcp/rhino_gh_mcpComponent.cs): C# Grasshopper component running HTTP server (port 9999)
Installation
Prerequisites
- Rhino 7 or newer
- Python 3.10 or newer
- UV package manager
- A Replicate API token (optional, for AI-powered features)
Setting up the Environment
-
Install UV (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh # or on Windows: # powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
-
Clone and setup the project:
cd rhino_gh_mcp_uv uv sync # This creates a virtual environment and installs all dependencies
-
Configure environment variables (optional):
cp .env.sample .env # Edit .env file with your API tokens
Installing the Rhino Plugin
-
Build the Rhino Plugin:
- Open
../rhino_script_client/rhino_script_client.slnin Visual Studio - Build the project to create the
.rhpplugin file - The plugin will be installed automatically when Rhino starts
- Open
-
Start the Rhino MCP Service:
- In Rhino, run the command
ToggleMCPServiceor use the UI panel - The service will start a socket server on port 9876
- Alternatively, you can run
../rhino_script_client/rhino_client.pydirectly in the Python Editor
- In Rhino, run the command
Installing the Grasshopper Component
-
Build the Grasshopper Component:
- Open
../rhino_gh_mcp/rhino_gh_mcp.slnin Visual Studio - Build the project to create the
.ghacomponent file - The component will be available in Grasshopper under the "MCP" tab
- Open
-
Start the Grasshopper MCP Server:
- Open Grasshopper in Rhino
- Add the "rhino_gh_mcp MCP Server" component to your canvas
- Set the "RunServer" input to
Trueto start the HTTP server on port 9999 - Optionally set "CategoryFilter" to prioritize specific component categories (e.g., "MCP,Math") - this prioritizes components from these categories but allows access to all components
MCP Client Configuration
For Published Package:
{
"mcpServers": {
"rhino-gh-mcp": {
"command": "uvx",
"args": ["rhino-gh-mcp"]
}
}
}
For Local Development:
{
"mcpServers": {
"rhino-gh-mcp": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/rhino_gh_mcp_uv", "python", "-m", "rhino_gh_mcp_uv.server"],
"cwd": "/absolute/path/to/rhino_gh_mcp_uv"
}
}
}
Usage
Starting the Complete System
-
Start Rhino:
- Open Rhino 7 or 8
- Start the Rhino MCP service (see "Installing the Rhino Plugin" above)
-
Start Grasshopper MCP Server (optional, for Grasshopper features):
- Open Grasshopper
- Add the "rhino_gh_mcp MCP Server" component
- Set "RunServer" to
True
-
Start Claude Desktop or Cursor IDE:
- The MCP server will be started automatically when needed
- The connection between Claude/Cursor and Rhino/Grasshopper will be established automatically
Managing the Connection
- Stop the Rhino server: Run the
ToggleMCPServicecommand again or use the UI panel - Stop the Grasshopper server: Set the "RunServer" input on the MCP Server component to
False - Check server status: Use the "Status" output on the Grasshopper component or check the Rhino command line
- Restart connections: Simply restart the respective components
Development
Adding Dependencies
uv add package-name # Add dependency
uv add --dev package-name # Add dev dependency
uv sync --upgrade # Update all dependencies
Troubleshooting
Common Issues
- UV not found: Make sure UV is installed and in your PATH
- Port conflicts: Ensure ports 9876 (Rhino) and 9999 (Grasshopper) are available
- Connection issues:
- Check that the Rhino MCP service is running
- Check that the Grasshopper MCP Server component has "RunServer" set to
True - Verify both components are built and loaded correctly
- Import errors: Run
uv syncto ensure all dependencies are installed - Component not found: Make sure the Grasshopper component is built and the
.ghafile is in the correct location
License
MIT License - see LICENSE file for details.
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 rhino_gh_mcp-0.1.8.tar.gz.
File metadata
- Download URL: rhino_gh_mcp-0.1.8.tar.gz
- Upload date:
- Size: 79.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d6ce70e8ba92082e94b45c04f986f7306c0bfd6215c92708de67aef4078afff
|
|
| MD5 |
661640397d615694ec639da73ac4aff3
|
|
| BLAKE2b-256 |
8b30c51b9066df927bb5ba9ae563620c7a07f696ace96bb0eefd271150688bc0
|
File details
Details for the file rhino_gh_mcp-0.1.8-py3-none-any.whl.
File metadata
- Download URL: rhino_gh_mcp-0.1.8-py3-none-any.whl
- Upload date:
- Size: 26.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77add8d2b4801b2c808244c7f4399e3f7f68d604c42394dabfce9b1e0ccd4663
|
|
| MD5 |
edaae36d9cc31f35575057e5489f9c99
|
|
| BLAKE2b-256 |
8eae37c7592abce5ca0dffc0323662528684a4bc3007b8857dc92db7996261df
|