Skip to main content

An MCP server for generating and managing Grasshopper Python components

Project description

Sand Martin

Sand Martin is an MCP (Model Context Protocol) server that enables real-time orchestration of the Grasshopper canvas within Rhino. It allows Large Language Models (like Claude) to create components, inject Python code, and wire nodes together directly in a live Grasshopper session.

Demo

Sand Martin Demo 1 Sand Martin Demo 2

Architecture

Sand Martin uses a Client-Server model:

  1. SandMartin.Host (C#): A Grasshopper plugin (.gha) that runs an internal HTTP server inside the Rhino process. It has direct access to the Grasshopper.Kernel API.
  2. Sand Martin Bridge (Python): A lightweight MCP server that translates LLM requests into commands for the Host server.

Getting Started

1. Requirements

  • Rhino 8 (macOS/Windows)
  • .NET SDK 6.0+ (for building the Host)
  • Python 3.10+

2. Install the Python Bridge

You can install the Sand Martin bridge directly from PyPI:

pip install sand-martin

3. Build & Install the Host Plugin

From the root directory:

Configuration for Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "sand-martin": {
      "command": "python",
      "args": ["/PATH/TO/YOUR/sand-martin/src/sand_martin/server.py"]
    }
  }
}

Note: Replace /PATH/TO/YOUR/ with the actual absolute path to this repository.

Usage

  1. Start Rhino and open Grasshopper.
  2. Launch Claude Desktop.
  3. You can now ask Claude to:
    • "Create a Python component that calculates a Fibonacci sequence."
    • "Connect a Slider to the input of my component."
    • "Show me the current state of my canvas."

Security

Sand Martin includes built-in security features to protect your environment:

  • Auth Token: A unique token is generated every time the server starts. You must set this in your environment as SAND_MARTIN_TOKEN.
  • Code Gating: You can disable code injection at any time by setting AllowCodeInjection to False on the Grasshopper component.
  • Localhost Only: The server only accepts connections from 127.0.0.1.

See SECURITY.md for more details.

⚠️ Warning: Always set the Run toggle to False on the Sand Martin component when not in use.

Project Structure

  • src/SandMartin.Host/: C# source for the Grasshopper plugin.
  • src/sand_martin/: Python source for the MCP server.
  • sand-martin.sln: Visual Studio Solution file.
  • pyproject.toml: Python project configuration.

License

This project is licensed under the Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sand_martin-0.1.1.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sand_martin-0.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file sand_martin-0.1.1.tar.gz.

File metadata

  • Download URL: sand_martin-0.1.1.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for sand_martin-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a00448e1f33dc5ea243eaf2513bf8f035a7b785cac987d6cd10ef3e6bc9fa25b
MD5 9122f00ebf8a48360f26cca9cdf9586c
BLAKE2b-256 7840fed6b2f1176b7e97781af68adf344ce9a65bab499b6237bf7f50d22d820f

See more details on using hashes here.

File details

Details for the file sand_martin-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sand_martin-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for sand_martin-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dffb41296643211d43c42d8cb84e478209a69382942e6a724cf8208d6ff727db
MD5 b89fc44abf5d98af82a43170a9335eef
BLAKE2b-256 f0f677c0e696641cb9cf6a279c7812087f84ff4c7fe6a3b73a6bb5dd24751c6d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page