LAMCP
LAmbda MCP: teach your LLM to do Grasshopper tricks.
Lets Claude Code (or any MCP client) introspect and mutate a
live Grasshopper session in real time: inspect the canvas,
wire components, read/write slider values, run RhinoCommon
calls, hot-reload modules -all from inside an AI agent loop, without rebuilding userobjects or restarting Rhino.
Quick start
-
Register with Claude Code:
claude mcp add lamcp --scope user -- uvx lamcp
-
Install it in Grasshopper: download
Lamcp_Bridge.ghuserand drop it into your Grasshopper Components folder (Grasshopper → File → Special Folders → Components Folder). -
Activate it: restart Grasshopper, drop the
LAMCP Bridgecomponent (under theLAMCPtab) on the canvas, wire aBoolean Toggleset toTrueintoenable.
Done!
See Setup for alternative install paths
(without uvx, project-scoped, paste-from-source) and the
Tools exposed section for what's available.
Architecture
LLM ──MCP stdio──▶ lamcp (Python 3.10+)
│
│ HTTP POST /exec {"code": "...", "timeout": 30}
▼
LAMCP Bridge GH component (Rhino 8 CPython 3.9)
├─ http.server on 127.0.0.1:8765
├─ exec() with shared globals
└─ returns {stdout, stderr, result, error}
Why split: Rhino 8's CPython runtime is pinned to 3.9. fastmcp and the
underlying mcp SDK require 3.10+. So the MCP-speaking half runs in a
system Python and forwards over loopback HTTP to a stdlib-only HTTP server
living inside Rhino as a regular Grasshopper component.
Setup
1. Register with Claude Code
LAMCP is a dev tool you'll want available everywhere, so register it at
user scope. The friction-free path uses
uvx so no explicit install of lamcp is
needed — it'll be fetched and cached on first invocation:
claude mcp add lamcp --scope user -- uvx lamcp
Or, if you'd rather install lamcp into your environment first:
pip install lamcp # or: uv tool install lamcp
claude mcp add lamcp --scope user -- lamcp
Pick the right
--scope. Without--scope,claude mcp adddefaults to local scope, which only loads the server when Claude Code is launched from the exact directory you ran the command in. That's almost never what you want for a dev tool. Your options:
Scope Stored in Use when user~/.claude.json(top-levelmcpServers)You want LAMCP available in every project project<repo>/.mcp.json(committed to git, shared with collaborators)Your whole team should get LAMCP for one project local~/.claude.jsonunder the current project entry (default)You're temporarily trying it in one directory
Verify the registration:
claude mcp list
The new tools are available in any new Claude Code conversation.
Using a different MCP client? Point it at the
lamcpcommand (oruvx lamcp) over stdio.
2. Install the bridge in Grasshopper
Option A — drop the pre-built userobject (recommended).
- Download
Lamcp_Bridge.ghuserfrom the latest release. - In Grasshopper: File → Special Folders → Components Folder. Move the
.ghuserfile there. - Restart Grasshopper.
LAMCP Bridgeappears under theLAMCPtab. - Drop it on the canvas, wire a
Boolean Toggle(set toTrue) intoenable. Thestatusoutput readslistening on http://127.0.0.1:8765.
Option B — paste the source manually (for hacking).
- Drop a Python 3 Script component on the canvas. Paste the contents of
grasshopper/Lamcp_Bridge/code.pyin. - Add two inputs:
enable(bool) andport(int). Add one output:status. - Wire a
Boolean Toggle(set toTrue) intoenable. - The
statusoutput should readlistening on http://127.0.0.1:8765.
Either way, your MCP client now has a run_python_script tool that
exec()s code inside your live Rhino session.
Tools exposed
| Tool | Purpose |
|---|---|
run_python_script |
exec() arbitrary Python inside Rhino, capture stdout / stderr / repr(_) |
unload_python_modules |
drop sys.modules[prefix.*] so the next import re-reads from disk |
bridge_health |
ping the bridge to verify it's reachable |
list_grasshopper_objects |
enumerate canvas objects (type, nickname, GUID, pivot, runtime messages) |
add_python_component |
drop a Rhino 8 Python 3 script component (code + I/O params) onto canvas |
add_reloader_component |
drop the COMPAS side-by-side hot-reload bootstrap (enable_reloader()) |
set_script_venv |
repoint # venv: directive of script components at one environment |
solve_grasshopper |
re-solve safely via ScheduleSolution on the UI thread |
save_grasshopper_document |
save the active document to disk |
add_group |
wrap canvas objects in a named Grasshopper group |
add_param_marker |
drop a named floating parameter as a labeled pass-through bus |
describe_canvas_structure |
inspect objects, groups, params, and source connections on the canvas |
upgrade_components |
replace userobject-based components with the latest installed version |
search_components |
find installed components by name; returns type GUID + parameter order |
inspect_component_data |
read the data on a component's outputs (counts, tree paths, samples) |
capture_grasshopper_canvas |
screenshot the canvas (zoom-to-fit, view restored) as an inline PNG |
capture_rhino_viewport |
screenshot the active Rhino viewport, optionally reframed, as inline PNG |
Return contract for run_python_script
{
"stdout": "...", // captured stdout
"stderr": "...", // captured stderr
"result": "repr of _", // assign to `_` to return a value
"error": null // formatted traceback if exception raised
}
Globals persist between calls, so you can import once and reuse:
# call 1
import scriptcontext as sc; doc = sc.doc.ActiveDoc
# call 2
print(doc.Name) # `doc` is still bound
Environment variables
| Variable | Default | Purpose |
|---|---|---|
LAMCP_BRIDGE_URL |
http://127.0.0.1:8765 |
URL of the bridge's HTTP server |
Caveats
- UI thread: code runs on the HTTP server thread, not the Rhino UI
thread. Most read-only
RhinoCommon/Grasshopperaccess works cross-thread, but heavy mutations (bulkRemoveObject, etc.) can crash Rhino. Eto-based UI marshalling is a planned addition. isinstancedoesn't always work: in Rhino 8 CPython,isinstanceagainst concrete .NET types often returns False due to interface interop. Useobj.GetType().Name == "..."instead.RemoveSource(IGH_Param)is a silent no-op: use theRemoveSource(Guid)overload.float(System.Decimal)raises: wrap withSystem.Convert.ToDouble(x)orfloat(str(x)).
Security
The bridge listens on 127.0.0.1 only and accepts no auth: it runs
arbitrary Python in your Rhino with no sandboxing. Never expose it
beyond localhost, and stop it (enable=False) when you're done.
Development
Install with the dev extra to pull in ruff:
pip install -e ".[dev]"
Lint + format checks (same commands CI runs):
ruff check . # lint
ruff format --check . # formatting (non-destructive)
Auto-fix:
ruff check . --fix # fix lint issues
ruff format . # reformat
For one-off runs without installing into your env, uvx ruff ... works
identically.
Releases are tag-driven — see RELEASING.md.
License
MIT
Metadata
Release files for lamcp 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lamcp-0.8.0.tar.gz | 1.3 MB | With provenance | Details for lamcp-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lamcp-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for lamcp-0.8.0-py3-none-any.whl |
Total release size: 1.4 MB
Release files / lamcp-0.8.0.tar.gz
| Download URL | lamcp-0.8.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aeb81ca61a00fc5369818955add3dd11252271169353629bc11ca61af7db2ffb
|
|
BLAKE2b-256 checksum How to use checksums |
d23b2219f102bb8a6710f88b2f46baeb1d79bf0db218d739e60dad93f1f28591
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.
Transparency logRelease files / lamcp-0.8.0-py3-none-any.whl
| Download URL | lamcp-0.8.0-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3dee8aebd2edc16998a4677e69f3daeb967aa993f78ad62a423fc49b136f4bcc
|
|
BLAKE2b-256 checksum How to use checksums |
a12eac938f6fbee7eeb27782832175b1c699cd8f7acc6df683e8aec389b402aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.
Transparency logSecurity for lamcp 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for lamcp-0.8.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.