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 (
src/rhino_gh_mcp_uv/): Python server implementing the Model Context Protocol - Rhino Plugin (
plugins/rhino_mcp_client.py): Socket server running inside Rhino (port 9876) - Grasshopper Plugin (
plugins/GHCodeMCP_new.py): HTTP server running inside Grasshopper (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
- Open Rhino 7
- Open the Python Editor:
- Click on the "Tools" menu
- Select "Python Script" -> "Run.."
- Navigate to and select
plugins/rhino_mcp_client.py
- The script will start automatically and you should see these messages in the Python Editor:
RhinoMCP script loaded. Server started automatically. To stop the server, run: stop_server()
Installing the Grasshopper Plugin
- Open Grasshopper
- Add a GHPython component to your canvas
- Open the component editor
- Load the script from
plugins/GHCodeMCP_new.py - The HTTP server will start automatically on port 9999
Running the MCP Server
With UV, you can run the server in several ways:
-
Using the installed script:
uv run rhino-gh-mcp-uv
-
Using the module directly:
uv run python -m rhino_gh_mcp_uv.server
-
For development:
uv run python src/rhino_gh_mcp_uv/main.py
Claude Desktop Integration
To integrate with Claude Desktop, add this configuration to your claude_desktop_config.json:
{
"mcpServers": {
"rhino-gh-mcp-uv": {
"command": "uv",
"args": ["run", "rhino-gh-mcp-uv"],
"cwd": "/path/to/rhino_gh_mcp_uv"
}
}
}
Usage
Starting the Complete System
-
Start Rhino plugin:
- Open Rhino 7
- Run
plugins/rhino_mcp_client.pyin the Python Editor - Verify you see the startup messages
-
Start Grasshopper plugin (optional):
- Open Grasshopper
- Load
plugins/GHCodeMCP_new.pyin a GHPython component - The HTTP server starts automatically
-
Start Claude Desktop:
- Claude will automatically start the MCP server when needed
- The connection between Claude and Rhino/Grasshopper will be established automatically
Managing the Connection
- Stop the Rhino server: In the Python Editor, type
stop_server()and press Enter - Check server status: Use the logging output in both Rhino and the MCP server
- Restart connections: Simply restart the respective components
Development
Project Structure
rhino_gh_mcp_uv/
├── src/rhino_gh_mcp_uv/ # Main MCP server package
│ ├── __init__.py
│ ├── server.py # Main MCP server
│ ├── rhino_tools.py # Rhino integration tools
│ ├── grasshopper_tools.py # Grasshopper integration tools
│ ├── replicate_tools.py # AI rendering tools
│ ├── utility_tools.py # Web search and email tools
│ └── main.py # Entry point
├── plugins/ # Rhino/Grasshopper plugins
│ ├── rhino_mcp_client.py # Rhino socket server
│ ├── GHCodeMCP_new.py # Grasshopper HTTP server
│ └── *.gh # Grasshopper definition files
├── pyproject.toml # UV project configuration
├── .env.sample # Environment variables template
└── README.md # This file
Adding Dependencies
# Add a new dependency
uv add package-name
# Add a development dependency
uv add --dev package-name
# Update all dependencies
uv sync --upgrade
Running Tests
# Run the server in development mode
uv run python src/rhino_gh_mcp_uv/main.py
# Test individual components
uv run python -c "from rhino_gh_mcp_uv.rhino_tools import RhinoConnection; print('Import successful')"
Benefits of UV Migration
- Faster dependency resolution: UV is significantly faster than pip
- Better dependency management: More reliable dependency resolution
- Lockfile support: Ensures reproducible builds
- Modern Python packaging: Uses the latest Python packaging standards
- Cross-platform compatibility: Better support across different operating systems
- Development workflow: Streamlined development and deployment process
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 both Rhino and Grasshopper plugins are running
- Import errors: Run
uv syncto ensure all dependencies are installed
Logging
The system provides comprehensive logging:
- MCP Server: Logs to console when running
- Rhino Plugin: Logs to Rhino command line and log files
- Grasshopper Plugin: Logs to Grasshopper console
Log files are stored in platform-specific locations:
- macOS:
~/Library/Application Support/RhinoMCP/logs/ - Windows:
%LOCALAPPDATA%/RhinoMCP/logs/ - Linux:
~/.rhino_mcp/logs/
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 landscape_mcp-0.1.2.tar.gz.
File metadata
- Download URL: landscape_mcp-0.1.2.tar.gz
- Upload date:
- Size: 79.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d463795d9673156811b536460dbda70ff8c26a9c10708d3c7b387555e0483022
|
|
| MD5 |
8ba5de20a8cb2820239403694e6382c0
|
|
| BLAKE2b-256 |
47a4c602c854384406be640734a009ed2d2309ce889cb1bc7ed424ee8fb277d2
|
File details
Details for the file landscape_mcp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: landscape_mcp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9ce53170e7b1f375439d51f970cbc909ffe3985c5bc2a223f143abfcfb02cbb
|
|
| MD5 |
4effcc5f19ee3b7234fa35bbe6b2372a
|
|
| BLAKE2b-256 |
7795200b3f2b3af7e49f590c85b28168e4af1837a12a38918c6b0f7aa33e3a64
|