BC

brookstalley/cordyceps

Developer tools
114 stars 9 forks Quality 79 Trend 15MIT

Give AI agents or scripts direct control over your parametric design canvas and Rhino rendering tools.

Overview

Give AI agents or scripts direct control over your parametric design canvas and Rhino rendering tools.

README

Cordyceps

MCP server for Grasshopper. Give AI agents or scripts direct control over your parametric design canvas and Rhino rendering tools.

Model Context Protocol (MCP) provides a standardized interface for controlling applications — whether from AI assistants or your own code.

Features

  • Full Grasshopper control — add components, wire connections, set values, manage groups
  • Rhino integration — bake geometry, manage layers, apply PBR materials, render scenes
  • Natural language — describe what you want and let AI build it
  • Direct scripting — call tools from Python or any MCP client, no AI required

Requirements

  • Rhino 8.21+ (requires .NET 8)
  • For AI use: Claude Desktop, Claude Code, Cursor, VS Code, or any MCP-compatible assistant
  • For scripting: Any MCP client library (Python, TypeScript, etc.)

Installation

  1. In Rhino 8, run the PackageManager command (or Tools → Package Manager)
  2. Search for Cordyceps and click Install
  3. Restart Rhino

The Package Manager downloads the plugin, places it in the right folder, and unblocks it for you — and future updates are one click.

Manual install

  1. Download Cordyceps.gha — always the current release (see all releases)

  2. Copy to your Grasshopper components folder: File → Special Folders → Components Folder

  3. Unblock the file so Rhino will load it:

    • Windows: right-click → Properties → check “Unblock” → OK
    • macOS: clear the quarantine flag (e.g. xattr -dr com.apple.quarantine )
  4. Restart Rhino

Usage

  1. Drop the Cordyceps component on your canvas (Params → Util → Cordyceps)

    The server starts on port 26929 by default. Optional inputs:

    • HttpPort: Change the HTTP port
    • DebugLevel: Set to 1+ to see request/response traffic in Rhino
  2. Configure your MCP client:

  3. Start building — describe what you want in natural language

Example

Make an animated GIF that shows the full journey from parametric modeling
to photorealistic render. The subject is a small collection of geometric
forms — maybe five or six objects with varied shapes, scales, and
proportions. Arrange them as a pleasing composition.

The AI builds everything autonomously — creating parametric geometry in Grasshopper, baking to Rhino, applying PBR materials, configuring the render environment and lighting, and capturing a smooth orbiting animation.

Scripting

Call tools directly from Python or any MCP client library:

from mcp import ClientSession

async with ClientSession(transport) as session:
    # Add a slider and circle
    slider = await session.call_tool('gh_canvas', {
        'action': 'add', 'type': 'Number Slider', 'x': 50, 'y': 50
    })
    circle = await session.call_tool('gh_canvas', {
        'action': 'add', 'type': 'Curve/Circle', 'x': 200, 'y': 50
    })

    # Connect slider output to circle radius
    await session.call_tool('gh_wire', {
        'action': 'connect',
        'sourceId': slider['id'], 'sourceParam': '0',
        'targetId': circle['id'], 'targetParam': 'R'
    })

See the MCP Python SDK for transport setup and client details.

Tools

Cordyceps provides 7 tools with over 100 actions — consolidated to minimize context window usage. Related operations are grouped under a single tool with an action parameter.

Grasshopper

Tool Description
gh_canvas Components, values, groups, a compact outline of the whole definition, baking, variable parameters, data modifiers (flatten/graft/simplify/reverse)
gh_wire Connection management
gh_document Save, clear, snapshots (max 20 kept, oldest evicted), solver control, canvas capture (agents cannot call undo/redo — use snapshots)
gh_script Script component configuration
gh_inspect Connection/liveness probe, status, outputs, data-tree shape (paths and counts without the data), data tracing, debugging

Every call that changes the Grasshopper canvas is one Grasshopper undo step: press Ctrl+Z in Grasshopper to undo an agent’s last call. A call that fails partway leaves the canvas as it was.

Rhino

Tool Description
rhino_scene Objects, layers, selection, visibility
rhino_render Viewport, camera, materials, lighting, environments, render

Documentation

Cordyceps exposes guides and patterns to MCP clients as resources. Your AI assistant can read these automatically when it needs guidance on data trees, type systems, component patterns, or rendering workflows.

Browse the documentation directly: src/Cordyceps/Knowledge/

Troubleshooting

Problem Solution
Plugin won’t load Verify Rhino 8.21+. If you installed manually, unblock the .gha file (Windows) or clear its quarantine flag (macOS) — the Package Manager does this for you.
Can’t connect Ensure Cordyceps component is on canvas. Check the port.
Claude Desktop can’t connect Ensure Node.js is installed. Check Rhino is running with Cordyceps. Restart Claude Desktop after config changes.
“No component type is named …” when adding The type name is not exact. Use gh_canvas(action='search', query='...') to find exact names.
“Component not found” / “No object named …” for an id The id names nothing on the canvas. Pass a GUID, an 8+ hex-digit GUID prefix, or a unique nickname; gh_canvas(action='list') or outline shows what exists.
“… is the default nickname of …, so it never selects what this action removes” delete, group_delete and gh_wire disconnect/clear refuse a default nickname such as Circle (or the group name Group), even when only one object has it. So does a call that removes an existing port (gh_canvas zoomable remove or a shrinking set_count; gh_script set/configure dropping or renaming a port), with the error starting This call removes …. Pass the id the error prints, or rename the object first.
No command output Set DebugLevel input to 1 to see traffic in Rhino command history.

Building

dotnet build src/Cordyceps/Cordyceps.csproj -c Release

Only Release builds are supported — a Debug build (the dotnet build default) fails with an error.

Acknowledgements

  • grasshopper-mcp by Alfred Chen — the project that inspired Cordyceps.
  • Hyperceps by Yibin Yang — a fork of Cordyceps that pushed it somewhere genuinely new. The strict naming rules Cordyceps now uses for component types, ports and canvas objects (exact names, nothing ever guessed, and errors that list the candidates and say how to write the call), the canvas outline (gh_canvas(action='outline')) and the data-tree summary (gh_inspect(action='tree')) are adapted from Hyperceps, with thanks. Yibin’s work on making a whole block of edits in one validated call and on slider sweeps is shaping where Cordyceps goes next.

Changelog · Inspired by grasshopper-mcp by Alfred Chen · Naming rules, canvas outline and data-tree summary adapted from Hyperceps by Yibin Yang · MIT License

View the full README on GitHub

Install

npx -y mcp-remote http://127.0.0.1:26929/mcp
New to MCP? Start with the mcpskill.org guide →

Configuration

{ "mcpServers": { "cordyceps": { "command": "npx", "args": ["-y", "mcp-remote", "http://127.0.0.1:26929/mcp"] } } }