Open-source Revit MCP server: let Claude and other AI assistants read and edit BIM models, with human approval on every change.
Revit Add-in Lifecycle
The Revit-side runtime starts in packages/revit-bridge-addin/src/Bridge/App.cs.
Startup Path
App implements IExternalApplication, so Revit calls:
OnStartup()OnShutdown()
During OnStartup() the add-in:
- initializes Serilog file logging
- captures the running Revit version
- creates a shared
CommandQueue - creates
RevitCommandExecutorand wraps it inExternalEvent - constructs and starts
BridgeServer - builds the ribbon UI
- hooks
DocumentChangedto keepActiveDocumentNameupdated
This is the full bootstrap chain that makes the localhost bridge usable.
Queue And UI Thread Handoff
The important separation is:
BridgeServerreceives HTTP requests off the Revit UI threadCommandQueuestores pending requests and completion handlesExternalEvent.Raise()transfers execution toRevitCommandExecutorRevitCommandExecutor.Execute()drains the queue on the Revit API thread
That pattern is what makes live Revit automation safe inside Autodesk's threading model.
Ribbon Surface
CreateModernRibbonInterface() creates:
- an
AEC Bridgetab - a
Connectionpanel with Connect, Disconnect and Status - a
Workflowspanel with one large Open Panel button and stacked Health Check, Pending Actions and Reports buttons - a
Toolspanel with stacked Config, Help and About buttons
Every button has a tooltip with the brand image, and F1 opens the documentation. The icons use the 32 px flat grammar from docs/design/tokens.md, with a state badge where a button reports status. They redraw when Revit's theme changes.
The ribbon is more than cosmetic: it exposes operational status and provides a manual control surface for the bridge lifecycle.
Runtime State
App keeps a few static values available to the rest of the add-in:
RevitVersionActiveDocumentNameServer
Those values are used indirectly by the health endpoint and operator diagnostics.
Shutdown Path
OnShutdown():
- stops the bridge server
- disposes the
ExternalEvent - flushes logs
If shutdown errors occur, they are logged and returned as Result.Failed.
Operational Rule
If the bridge looks healthy from the Python side but tools still do nothing, inspect the add-in lifecycle first. Most hard failures in this repo start before tool routing, during startup, ribbon initialization, or ExternalEvent creation.