Skip to main content
Glama

Monorail

MCP server for real-time design collaboration in Figma. Claude and humans work in the same canvas — no export/import, no copy/paste.

"I've sold monorails to Brockway, Ogdenville, and North Haverbrook — and by gum, it put them on the map!"

Installation

Prerequisites

  • Node.js 18+ (node --version)

  • An MCP client (Claude Code, Claude Desktop, Cursor, etc.)

  • Figma account with Slides access

Build

git clone git@github.com:mattcreager/monorail-mcp.git
cd monorail-mcp
npm install && npm run build

cd figma-plugin
npm install && npm run build
cd ..

Both builds are required: the first produces the MCP server in dist/, the second bundles the Figma plugin to figma-plugin/code.js, which is what Figma actually loads.

Configure your MCP client

Add Monorail to your MCP client config. For Claude Desktop, edit claude_desktop_config.json:

{
  "mcpServers": {
    "monorail": {
      "command": "node",
      "args": ["/full/path/to/monorail-mcp/dist/src/index.js"]
    }
  }
}

Use the full absolute path. Restart your MCP client after adding the config.

Load the Figma Plugin

  1. Open Figma (desktop app or browser)

  2. Go to Plugins > Development > Import plugin from manifest...

  3. Select monorail-mcp/figma-plugin/manifest.json

This is a one-time setup.

Verify

  1. Open a Figma Slides document

  2. Run the plugin: Plugins > Development > Monorail

  3. Check for the green "Connected" indicator

  4. In your MCP client, run monorail_status to confirm

Related MCP server: Claude Talk to Figma MCP

Quick Start

# Create a deck from a brief
You: "Build a 6-slide deck for the Q1 review. Audience is the exec team."
Claude: [monorail_push — slides appear in Figma]

# Edit in Figma, then sync
You: [move slides around, tweak text directly in Figma]
Claude: [monorail_pull — sees your changes]

# Surgical updates
Claude: [monorail_patch — updates specific text, preserves your formatting]

# Visual QA
Claude: [monorail_screenshot — sees the rendered result, iterates]

The core loop: push > pull > patch > screenshot > repeat.

Tools

Monorail provides 14 tools organized into five categories.

Connection

Tool

Description

monorail_status

Check if the Figma plugin is connected via WebSocket

Deck Operations

The core collaboration loop. Push slides, pull state, patch elements.

Tool

Description

monorail_pull

Get deck state from Figma (full, summary, or single slide)

monorail_push

Create or replace slides from IR specification

monorail_patch

Edit, add, or delete elements by Figma node ID

monorail_clone

Clone a slide and update text content (preserves styling)

Visual

Inspect, export, and create visual content.

Tool

Description

monorail_screenshot

Export a slide as PNG (gives AI "eyes" to see renders)

monorail_export

Export any node as SVG or PNG (vectors, components, icons)

monorail_css

Extract CSS and raw paint data from a node

monorail_primitives

Low-level design: frames, text, shapes, paths, arrows, gradients; reveal on any op for native build steps

monorail_motion

Native object animations: list styles, apply/inspect/clear reveals on one slide

Discovery

Explore the Figma document structure.

Tool

Description

monorail_find

Search for nodes by type and/or name

monorail_component

Get component info, variant properties, siblings

monorail_capture

Full node tree with design system tokens and template slots

Deck Management

Tool

Description

monorail_delete

Delete slides by Figma node ID

monorail_reorder

Reorder slides to match a specified order

See docs/references/mcp-tools.md for parameters, examples, and workflow patterns.

Slide Archetypes

Constrained slide templates. Constraints force clarity — if content doesn't fit, edit the content.

Archetype

Purpose

Key Constraints

title

Opening, sections

Headline ≤8 words

section

Divider

Phrase ≤5 words

big-idea

Key insight, the turn

Headline ≤12, subline ≤20

bullets

Supporting points

3 bullets max, ≤10 words each

two-column

Comparison, text+visual

2 content blocks

quote

Testimonial

Quote ≤30 words + attribution

chart

Data evidence

Headline + chart + takeaway

timeline

Process, roadmap

3-5 stages

comparison

Options, before/after

2-4 cols, 3-5 rows

summary

Closing, next steps

3 items max

position-cards

3-column cards with badges

Complex layout

video

Video embed placeholder

Headline + URL + caption

See docs/references/archetypes.md for full specifications.

Workflow Patterns

Edit existing content (most common):

monorail_pull → monorail_patch → repeat

Bootstrap a new deck:

monorail_push (IR) → monorail_pull (get IDs) → monorail_patch (refine)

Clone with variations:

monorail_capture (structure + slots) → monorail_clone (new content)

Visual QA:

monorail_push → monorail_screenshot → iterate

Design-to-code extraction:

monorail_find → monorail_css → monorail_export (SVG)

Custom slide layout (no archetypes):

monorail_primitives (frames, text, shapes, gradients)

Component exploration:

monorail_find (type: COMPONENT) → monorail_component (variants)

How It Works

Claude (MCP client)                  Figma Plugin
  │                                       │
  │  monorail_push                        │
  ├──────────────────────────────────────►│  Creates slides from IR
  │        (WebSocket on port 9876)       │
  │                                       │
  │                             Human edits in Figma
  │                                       │
  │  monorail_pull                        │
  │◄──────────────────────────────────────┤  Returns deck state + IDs
  │                                       │
  │  monorail_patch                       │
  ├──────────────────────────────────────►│  Surgical element updates
  │                                       │
  │  monorail_screenshot                  │
  ├──────────────────────────────────────►│  Visual QA (AI "sees" it)
  │                                       │
  └───────────── repeat ──────────────────┘

The MCP server communicates with Claude over stdio and with the Figma plugin over WebSocket. Both parties work in the same Figma document — Claude proposes, human edits, Claude sees changes and adapts.

Development

MCP Server

npm install
npm run build        # Build once
npm run dev          # Watch mode
npm run start        # Run directly
npm test             # Build, then run the unit tests

Tests

npm test             # build + node --test
npm run test:only    # skip the build (dist/ already current)

Node's built-in runner, no test dependencies. Coverage is deliberately narrow: the pure geometry behind monorail_primitives — path coordinate normalisation, auto-layout axis mapping, direction and dash resolution — lives in shared/geometry.ts precisely so it can be tested without Figma. The plugin imports it, so these tests exercise shipped code.

Each test names the bug it prevents, and all of them are regressions that actually shipped. Reverting the path fix turns 4 of them red.

The bridge has its own tests: test/proxy.test.js and test/server.test.js drive the real proxy and MCP server with a fake plugin (test/fake-plugin.js) on ephemeral ports, and test/plugin.test.js / test/plugin-ui.test.js run the plugin's code.js and ui.html in a VM. node test/repro-wedge.js replays the 2026-09-27 proxy wedge against any build (see docs/proxy-wedge-2026-09.md).

Several sessions, one plugin

Every MCP server connects to a shared proxy (src/proxy.ts, ws://localhost:9877; the plugin connects to it on 9876). The first server that finds none starts it, logging to ~/Library/Logs/monorail-proxy.log. The plugin serves one request at a time: the others wait in the proxy's queue, oldest first, each for at most its own timeout, and fail with who held the plugin if their turn never comes. A read the plugin never answers is released at its timeout; an edit keeps the plugin until it answers (up to 2 minutes more), so two edits never interleave. A cancelled tool call withdraws its request. If the proxy restarts, servers and the plugin reconnect by themselves. monorail_status shows the proxy, who holds the plugin, the queue, and whether the plugin is paired. Knobs: MONORAIL_HOST_LABEL, MONORAIL_TIMEOUT_MS, MONORAIL_PROXY_SPAWN=0, MONORAIL_PROXY_LOG, MONORAIL_DIRECT=1.

Both ports listen on this machine only. The proxy refuses browser handshakes on 9877, and an MCP server (or script) must send the token in ~/.monorail/token when it registers. The plugin pairs once: monorail_status prints a pairing code; paste it into the plugin window. From then on only paired plugins get requests, so no web page can pose as the plugin. See docs/proxy-wedge-2026-09.md §8.

For anything that needs the canvas, use examples/primitives-smoke.json — 13 labelled visual checks, one per behaviour, each stating what PASS looks like.

Figma Plugin

cd figma-plugin
npm install
npm run build        # Build once
npm run watch        # Watch mode (hot reloads in Figma)

Project Structure

monorail-mcp/
├── src/index.ts              # MCP server (WebSocket + 14 tools)
├── shared/types.ts           # Shared TypeScript types
├── figma-plugin/
│   ├── code.ts               # Plugin logic (Figma API calls)
│   ├── ui.html               # Plugin UI (WebSocket client)
│   ├── manifest.json         # Figma plugin manifest
│   └── src/                  # Extracted modules
├── shared/
│   ├── types.ts              # Shared TypeScript types
│   └── geometry.ts           # Pure primitives geometry (unit-tested)
├── test/                     # node:test unit tests
├── docs/
│   ├── ARCHITECTURE.md       # System design
│   ├── SKILL.md              # Narrative thinking toolkit
│   ├── PLUGIN-SPEC.md        # IR format specification
│   ├── HANDOFF.md            # Team onboarding guide
│   ├── failures.md           # Learnings log (API quirks, gotchas)
│   ├── decisions/            # Architecture Decision Records
│   ├── references/           # Tool docs, archetypes, design system
│   └── discovery/            # Research and exploration notes
├── examples/                 # Demo decks and test briefs
└── PLAN.md                   # Project roadmap and session logs

Documentation

Doc

Purpose

ARCHITECTURE.md

System design and component overview

SKILL.md

Narrative thinking toolkit for Claude

PLUGIN-SPEC.md

IR format for slides

HANDOFF.md

Team onboarding guide

mcp-tools.md

Full tool reference with parameters and examples

archetypes.md

Slide template specifications

failures.md

Learnings and gotchas

Troubleshooting

"No plugin connected" but plugin shows green

Something other than the proxy may hold port 9876 (an old direct-mode MCP server, or a proxy from before 2026-09-28).

lsof -nP -iTCP:9876 -sTCP:LISTEN   # Who holds the plugin port

If it isn't dist/src/proxy.js, stop it; a running MCP server starts a new proxy within a few seconds.

"isn't paired" or "refused this session"

  • "A Figma plugin is connected but isn't paired": run monorail_status, copy the pairing code it prints, and paste it into the Pair field in the Monorail plugin window. The plugin remembers it.

  • "The monorail proxy refused this session": that MCP server started before the token existed (2026-09-28). Restart the Claude session, or run /mcp and reconnect monorail. A script talking to 9877 directly must send token (the contents of ~/.monorail/token) in its register message.

  • Deleting ~/.monorail/token rotates the token and the pairing code: restart the sessions and pair the plugin again. Deleting ~/.monorail/pairing-enforced lets unpaired plugins back in.

Plugin won't connect

  1. Make sure your MCP client is running (it hosts the MCP server)

  2. Check that the MCP config has the correct absolute path

  3. Restart the client after config changes

  4. Re-run the Monorail plugin in Figma

I changed the code and nothing changed

Two separate reload paths, and neither is automatic:

Changed

Rebuild

Reload

figma-plugin/code.ts

cd figma-plugin && npm run build

Re-run the plugin in Figma (Plugins > Development > Monorail) — the running plugin holds the old bundle in memory

src/index.ts (server, tool schemas)

npm run build

Restart your MCP client — it owns the server process

A new tool parameter needs both: the server has to accept it and the plugin has to act on it. If a new parameter appears to be silently ignored, this is almost always why.

Slides look wrong or text overlapping

The plugin uses Auto Layout containers. If you see overlap:

  • Check that you're using a supported archetype

  • Try monorail_push with mode: "replace" to recreate

Font substitution

Monorail tries fonts in order: Supply > Inter > SF Pro > Helvetica > Arial. Missing fonts fall back gracefully but may look different.

WebSocket port conflict

Monorail uses port 9876.

lsof -i :9876    # See what's using it

License

MIT. See LICENSE.


Named after The Simpsons' "Marge vs. the Monorail" — Lyle Lanley's pitch is a masterclass in narrative structure. The argument lands so hard it sells Springfield a monorail. The irony is intentional: we build a tool to make pitches land, named after a pitch that landed too well.

Available Tools

16 tools
monorail_captureA

Capture full node structure from a slide. Returns complete frame tree with positions, fills, strokes, Auto Layout, text styling. Also extracts design system tokens (colors, fonts, spacing) and identifies template slots. Use this to analyze existing designs before cloning. If important content appears in complex_regions, re-capture with higher max_depth.

Inputs: slide_id, max_depth.

monorail_cloneA

Clone a slide and update its text content. Creates a new slide that preserves all styling, positioning, and structure from the source — then updates specific text slots. Use capture first to identify slot IDs.

Inputs: source_slide_id (required), content_map.

monorail_componentA

Get component info for a Figma node. Returns main component, variant properties, component set, and sibling variants. Works on instances (returns source component), components, and component sets.

Inputs: node_id.

monorail_cssA

Extract CSS and raw paint data from a Figma node. Returns Figma's getCSSAsync() output (same as 'Copy as CSS') plus raw fills, strokes, effects with full gradient data and blend modes. Use for design-to-code translation.

Inputs: node_id, timeout_ms.

monorail_deleteA

Delete slides from the deck by their Figma node IDs. Use monorail_pull to get slide IDs first. This is destructive — slides are permanently removed.

Inputs: slide_ids (required).

monorail_exportA

Export any Figma node as SVG or PNG. Unlike monorail_screenshot (slide-level PNG), this targets individual nodes (vectors, components, icons) and supports SVG output. Returns SVG as a UTF-8 string or PNG as base64.

Inputs: scale, format, node_id, timeout_ms.

monorail_findA

Search for nodes by type and/or name. Returns IDs, positions, bounds, and parent info. Use to discover components, vectors, text nodes, or frames in the document. Searches current page by default, or within a specific parent node.

Inputs: name, type, limit, parent_id.

monorail_motionA

Reveals and builds with Figma's native animation. Actions: 'apply' reveals to existing nodes ([{target, step|offset, duration, style, props}]) — in the Design editor this applies Motion object animations on one slide; in Figma Slides (where the Plugin API exposes no object animations) it builds one slide per step with a Smart Animate transition, cloning the slide so persisting layers hold still and arriving ones fade in. 'list' the Motion animation styles (Design only); 'inspect' animations and slide transitions on slides/nodes; 'clear' Motion animations from nodes. Prefer the 'reveal' field on monorail_primitives ops when building from scratch; use this tool for slides that already exist.

Inputs: action (required), reveals, targets, build_mode, +2 more.

monorail_patchA

Edit, add, or delete elements. Three modes: (1) EDIT: target a TEXT node ID to update its content. (2) ADD: target a FRAME container ID (like 'bullets-container') with action:'add' to create a new element — inherits styling from siblings. (3) DELETE: target any element ID with action:'delete' to remove it. Get IDs from monorail_pull. Auto Layout reflows automatically after add/delete.

Inputs: patches (required).

monorail_primitivesA

Low-level design tool for creating slide content from scratch. Use this when you want to design a slide layout without using archetypes. Provide an array of operations (frames, text, shapes) that will be applied in sequence. Each operation can reference earlier operations by name for nesting.

Inputs: operations (required), slide_id, build_mode, transition, +2 more.

monorail_probeA

Explore the live Figma Plugin API from inside the plugin sandbox — including undocumented surface. 'globals' lists every own property of figma and its namespaces plus non-standard globals; 'node' lists every property up a node's prototype chain with its current value (optional regex filter, e.g. 'anim|transition|reveal'); 'eval' runs an async JS function body with figma, node (nodeId or selection), protoNames(obj) and safeJson(v, depth?) in scope and returns what it returns. Results are capped (max_items, max_keys, max_depth); every cut is marked in the value and flagged at the top of the output. Development plugin only.

Inputs: action (required), code, filter, node_id, +4 more.

monorail_pullA

Pull deck state from Figma. Three modes:

  1. Full deck (default): All slides with elements + containers. Use before bulk patching.

  2. Single slide (slide_id param): One slide's full data. Use when you know which slide to edit.

  3. Summary (mode:'summary'): Just slide IDs, names, archetypes. Use to see deck structure without element noise.

Returns Figma node IDs for patching. The 'containers' array shows where you can ADD new elements with action:'add'.

Inputs: mode, slide_id.

monorail_pushA

Push IR to create/replace slides in Figma. Use for bootstrapping a new deck or bulk updates. For surgical edits to existing content, prefer pull → patch. Validates IR before sending (returns warnings for constraint violations).

Inputs: ir (required), mode, autoApply, start_index.

monorail_reorderA

Reorder slides in the deck. Pass an array of Figma node IDs in the desired order. Slides will be rearranged to match this order.

Inputs: slide_ids (required).

monorail_screenshotA

Export a slide as a PNG image. Returns a base64-encoded image that can be displayed. Use this to see what Figma rendered — gives you 'eyes' to verify layouts, check alignment, spot issues. Can target a specific slide by ID or defaults to first slide.

Inputs: scale, slide_id.

monorail_statusA

Check the connection to the Figma plugin. Reports whether a plugin is connected (and which build, and whether it is paired), the shared proxy this session goes through, who holds the plugin right now (request type, session, age), what is queued behind it, and recent requests the plugin never answered, plus the current selection. When the plugin isn't paired it prints the pairing code: give that code to the user to paste into the Monorail plugin window themselves; never pair on the user's behalf.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 16 tools

    Disambiguation4/5

    Most tools target clearly distinct operations, and the descriptions preempt the obvious confusions (export vs screenshot, push vs patch, motion vs primitives' reveal field, clone vs patch-add). Remaining overlap is mild: pull vs capture both return node structure, and push/primitives/clone all create slides, but the guidance on when to use each is explicit.

    Naming Consistency4/5

    All 16 tools share the monorail_ prefix in snake_case with no camelCase mixing, giving a predictable surface. Minor deviation: several tools use nouns rather than verbs (primitives, motion, css, component), though their names remain readable and stable.

    Tool Count4/5

    16 tools is at the upper edge of the ideal range but each maps to a genuine deck-editing capability (read, write, patch, export, inspect, animate). The dev-only probe is a niche extra, but nothing feels like padding beyond that.

    Completeness5/5

    Full lifecycle coverage for deck manipulation: create (push/primitives/clone), read (pull/capture/find/status/screenshot), edit (patch), delete, reorder, plus export, CSS extraction, component introspection, and motion/transition handling. No dead ends for the stated Figma Slides domain.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers