Skip to main content
Glama

Revit MCP Bridge for Google Antigravity

Google Antigravity Autodesk Revit pyRevit MCP Python License: MIT

A dedicated, high-performance Model Context Protocol (MCP) bridge engineered natively for Google Antigravity (and compatible with Claude Desktop, Cursor, Cline, and Windsurf) to connect autonomous AI agents with Autodesk Revit.

Communication-First Architecture: This standalone variant delivers a pure, rock-solid communication layer for Revit automation β€” free of external voice/speech-to-text models, audio recording, or bloated dependencies. All multimodal interaction (visual markup, view inspection, interactive element selection) happens directly through the MCP protocol and Antigravity's multimodal reasoning engine.


πŸš€ Built for Google Antigravity

Antigravity operates as an autonomous BIM engineering assistant with continuous feedback loops directly inside Autodesk Revit:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Google Antigravity AI Agent               β”‚
β”‚       (Autonomous BIM Coding & Multimodal Vision)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚ stdio (MCP JSON-RPC)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Revit MCP Server Bridge (Python)          β”‚
β”‚                    revit_mcp/server.py                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚ HTTP / JSON (127.0.0.1:40001+)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Autodesk Revit (pyRevit)                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Revit MCP Floating HUD (Visual State & Control) β”‚  β”‚
β”‚  β”‚  - 🎯 Interactive Pick Elements (User Input)     β”‚  β”‚
β”‚  β”‚  - βœ‚οΈ Screen Snip & Visual Markup (Multimodal)   β”‚  β”‚
β”‚  β”‚  - πŸ›‘οΈ Modal Dialog Lock Detection                β”‚  β”‚
β”‚  β”‚  - 🚦 Live Busy/Idle State Indicator             β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                           β”‚ ExternalEvent              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Revit Main UI Thread Execution Engine           β”‚  β”‚
β”‚  β”‚  (doc, uidoc, uiapp, app, Transactions)          β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Antigravity Agent Capabilities

  1. Two-Way Interactive User Requests:

    • 🎯 Interactive Element Picking (revit_request_user_selection): When Antigravity needs the user to designate a specific element (e.g., room boundary, clashing pipe, equipment), the Revit HUD button flashes gold/purple. The user clicks the element in Revit, and its ID, category, and metadata are immediately returned to Antigravity without manual typing.

    • βœ‚οΈ Visual Snip & Markup (revit_request_user_snip): Antigravity can ask the user to visually circle or annotate areas of interest. The user draws arrows/boxes using the built-in screen snipper, and the annotated image is piped straight into Antigravity's vision context.

  2. Visual Busy State Lifecycle (revit_set_busy):

    • The Revit HUD panel turns Gray while Antigravity is processing or executing transactions, and switches back to Green when Antigravity is done and awaiting user input.

  3. Modal Dialog Safety:

    • If a modal window opens in Revit (e.g. warning dialog or file dialog), Revit MCP immediately detects it via Win32 API and returns HTTP 423 Locked, alerting Antigravity instead of hanging the agent indefinitely.

  4. Deterministic Multi-Instance Binding:

    • Running multiple Revit versions or multiple documents concurrently? Each instance binds to an incremental port (40001, 40002, ...), and Antigravity locks its session strictly to the target model without accidental cross-project execution.


Related MCP server: Revit MCP Server

🌟 Features

  • ⚑ Direct Revit API Execution: Run arbitrary Python scripts on the Revit main UI thread safely using ExternalEvent. Access doc, uidoc, uiapp, and app.

  • πŸ”„ Multi-Instance Support: Multiple open Revit models automatically receive incremental ports (40001, 40002, ...).

  • 🎯 Interactive Element Selection: AI agents can ask the user to pick elements in Revit (revit_request_user_selection).

  • βœ‚οΈ Visual Screen Snip & Markup: Prompt the user to snip screen regions and annotate them with arrows, boxes, and freehand sketches (revit_request_user_snip).

  • πŸ›‘οΈ Modal Dialog Protection: Win32 detection checks whether Revit is blocked by a modal dialog, reporting HTTP 423 Locked instead of freezing requests indefinitely.

  • πŸ“Έ Automated High-Res Screenshots: Capture the active Revit view as a PNG image directly into the agent's context.

  • πŸͺŸ Minimal Floating HUD: Clean WPF window displaying server status, active port, request counter, latency, pin (always-on-top), and compact minimize mode.


πŸš€ Quick Start

Step 1: Install the pyRevit Extension

You can install the RevitMCP extension into pyRevit centrally using any of the methods below:

Run in PowerShell / Command Prompt:

pyrevit extend ui RevitMCP https://github.com/AndreyStartsev/revit-mcp.git

To update in the future:

pyrevit extensions update RevitMCP

Option B: Central pyRevit Extension Manager (GUI)

Register the repository source centrally in pyRevit:

pyrevit extensions sources add https://raw.githubusercontent.com/AndreyStartsev/revit-mcp/main/pyrevit_source.json

Now open Autodesk Revit, navigate to pyRevit > Settings > Extensions, select RevitMCP, and click Install.

πŸ’‘ Official pyRevit catalog submission: Pull Request #3719 is currently open in pyrevitlabs/pyRevit (see details in PYREVIT_PROPOSAL.md).

Option C: Manual Installation

Clone or copy this repository directly into your pyRevit extensions folder:

# Default pyRevit extension directory:
git clone https://github.com/AndreyStartsev/revit-mcp.git "%APPDATA%\pyRevit\Extensions\RevitMCP.extension"

Once installed, click the Revit MCP button on the ribbon tab to start the server. The floating HUD will appear and display Ready for commands on 127.0.0.1:40001.


Step 2: Install the Python MCP Server

Clone this repository and install dependencies:

git clone https://github.com/AndreyStartsev/revit-mcp.git
cd revit-mcp

# Install dependencies or install in editable mode
pip install -e .

Verify connection to Revit:

python tests/test_connection.py

Step 3: Connect & Activate Your AI Agent

πŸ€– Google Antigravity (Primary & Fully Supported)

Google Antigravity is the primary, first-class autonomous agent environment designed to work seamlessly with Revit MCP out-of-the-box.

1. Register the MCP Server in Antigravity

Open or create your global Antigravity MCP configuration:

  • Windows: %USERPROFILE%\.gemini\config\mcp_config.json (or your workspace MCP configuration)

Add the revit server entry:

{
  "mcpServers": {
    "revit": {
      "command": "python",
      "args": ["-m", "revit_mcp"]
    }
  }
}

(If you are running in a dedicated virtual environment or pyRevit CPython, specify the full path to python.exe).

2. Automatic Agent Guidelines (GEMINI.md)

Antigravity automatically discovers and ingests GEMINI.md from the root of this workspace. This equips the agent with:

  • Visual HUD State Tracking: The agent automatically invokes revit_set_busy(busy=True) at the very start of its reasoning to turn the floating HUD gray, and calls revit_set_busy(busy=False) upon completing its response.

  • Strict Transaction Handling: Safe wrapping in Transaction(doc, ...), rollback on errors, and suppression of modal blocking dialogs via IFailuresPreprocessor.

  • Multimodal Interaction: Native capability to trigger interactive element selection (revit_request_user_selection) and visual markup requests (revit_request_user_snip).

  • Coordinate & Level Normalization: Relative elevation anchoring ($Z_{\text{rel}} = Z_{\text{world}} - Z_{\text{host_level}}$) and linked model transform handling.

  • Spatial Integrity: Strict protection against unauthorized element movement or rotation.

3. Activate & Verify in Antigravity Chat
  1. Launch Autodesk Revit and open your project.

  2. Click the Revit MCP button on the ribbon tab to launch the server and floating HUD (displays Ready on 127.0.0.1:40001).

  3. In Antigravity chat, send a verification prompt:

    "Check the active Revit model, report connection status, and list available views."

  4. You will see the floating HUD turn Gray while Antigravity reasons and executes tools, and return to Dark/Ready when the response is delivered.


πŸ’‘ Advice for Other Agentic Systems (Claude Desktop, Cursor, Cline, Windsurf)

While this bridge is optimized natively for Google Antigravity, it complies with the open Model Context Protocol standard and can be connected to other MCP clients:

  1. Client Configuration:

    • Claude Desktop (%APPDATA%\Claude\claude_desktop_config.json on Windows):

      {
        "mcpServers": {
          "revit": {
            "command": "python",
            "args": ["-m", "revit_mcp"]
          }
        }
      }
    • Cursor (.cursor/mcp.json) / Cline / Windsurf: Add the same mcpServers definition into your client's MCP configuration settings.

  2. System Prompt / Rules Porting:

    • Other clients do not automatically read GEMINI.md. To achieve the same reliability:

      • Cursor: Copy the rules from GEMINI.md into your .cursorrules or .cursor/rules/revit.mdc.

      • Claude Desktop: Append the rules into Project Custom Instructions or your initial prompt.

      • Cline / Windsurf: Add the rules into your .clinerules or workspace instructions.

    • Critical Rule to Include: Instruct the agent to always wrap Revit API modifications in Transaction(doc, ...) and attach an IFailuresPreprocessor so modal dialogs don't freeze the client.

  3. Multimodal Capabilities:

    • For visual tools (revit_capture_screenshot and revit_request_user_snip), ensure your agent is configured with a vision-capable multimodal model (e.g., Claude 3.5 Sonnet, GPT-4o, or Gemini 1.5 Pro).


πŸ› οΈ Available MCP Tools

Tool

Description

revit_ping

Checks connection health and reports the active Revit instance and document.

revit_list_instances

Lists all active Revit instances across ports 40001..40010.

revit_set_active_instance

Binds the session to a specific instance by port or model name.

revit_get_active_model

Retrieves metadata about the active model (title, path, view, levels).

revit_execute_python

Executes arbitrary Python in Revit via Revit API (doc, uidoc, uiapp, app).

revit_get_selection

Returns currently selected elements, categories, and parameters.

revit_get_element_geometry

Retrieves exact bounding boxes (mm), locations, rotations, and levels.

revit_get_warnings

Retrieves all active model warnings and failing element IDs.

revit_capture_screenshot

Captures an automated high-resolution PNG of the active Revit view.

revit_get_latest_screenshot

Retrieves metadata and file path of the most recent screenshot or snip.

revit_request_user_selection

Prompts user in Revit to click element(s) with optional category filtering.

revit_request_user_snip

Prompts user to snip screen area and annotate with built-in markup tools.

revit_set_busy

Controls the visual busy indicator and theme color in the Revit HUD.


πŸ’‘ Python Execution Pattern

When using revit_execute_python, you write standard Revit API Python code. Always use transactions when modifying the model:

from Autodesk.Revit.DB import Transaction, FilteredElementCollector, BuiltInCategory

# 1. Access objects in scope: doc, uidoc, uiapp, app
collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType()

# 2. Modify with Transaction
t = Transaction(doc, "Set Comments")
t.Start()
for wall in collector:
    param = wall.LookupParameter("Comments")
    if param and not param.IsReadOnly:
        param.Set("Verified by Antigravity")
t.Commit()

# 3. Return results via response_data
response_data["wall_count"] = collector.GetElementCount()
response_data["status"] = "Success"

πŸ–₯️ Direct Python Client

If you want to communicate with Revit without an MCP client (for testing or automation scripts), use the included RevitClient:

from revit_mcp import RevitClient

client = RevitClient(port=40001)

# Health check
print(client.ping())

# Execute code
res = client.execute_python("""
response_data['doc_title'] = doc.Title if doc else 'No Document'
""")
print(res['data'])

πŸ”’ Security & Concurrency Architecture

  • Shared Secret Authentication: On startup, Revit MCP generates a cryptographically random session token (auth_token). All incoming HTTP API requests require Authorization: Bearer <token> or X-Auth-Token.

  • Zero CORS Vulnerability: By design, all Access-Control-Allow-* CORS headers are removed, ensuring web browsers cannot perform cross-origin script executions from malicious websites.

  • Thread-Safe FIFO Execution Queue: Remote commands are enqueued in a thread-safe FIFO queue (collections.deque protected by locks). Each request awaits its own ManualResetEvent, eliminating race conditions when multiple agents or subagents query Revit concurrently.

  • Cross-Version pyRevit & .NET 8 Compatibility: Modeless window management and external event handling are verified across pyRevit 4.x, 5.x, and 7.x on .NET Framework 4.8 and modern .NET 8 (Revit 2023–2027).


πŸ“„ License

This project is licensed under the MIT License.

Available Tools

13 tools
revit_capture_screenshotC

Triggers and captures a high-resolution screenshot of the currently active view in Revit.

Inputs: port, doc_name. Returns: result

revit_execute_pythonA

Executes arbitrary Python code inside Autodesk Revit on the main UI thread.

Provides:

  • doc: Active Revit Document

  • uidoc: Active UIDocument

  • uiapp: UIApplication

  • app: Application

  • response_data: Dict to store return values (e.g. response_data['my_key'] = ...)

Always wrap model modifications in a Transaction: t = Transaction(doc, 'Action Name') t.Start() ... t.Commit()

Inputs: code (required), port, doc_name. Returns: result

revit_get_active_modelB

Retrieves metadata about the currently open model in the bound Revit instance (title, file path, active view, level).

Inputs: port, doc_name. Returns: result

revit_get_element_geometryC

Retrieves high-precision geometric summary (exact mm bounding box, location, rotation, level elevation) for elements.

Inputs: port, doc_name, element_ids. Returns: result

revit_get_latest_screenshotA

Retrieves metadata and file path of the most recently captured screenshot or user snip.

Inputs: no named parameters. Returns: result

revit_get_selectionC

Retrieves information about currently selected elements in the bound Revit document.

Inputs: port, doc_name. Returns: result

revit_get_warningsC

Retrieves all active model warnings from the bound Revit instance.

Inputs: port, doc_name. Returns: result

revit_list_instancesA

Lists all currently active Autodesk Revit instances across all ports and indicates which instance is bound.

Inputs: no named parameters. Returns: result

revit_pingB

Checks connection health of the Revit MCP Server and reports the active instance.

Inputs: port, doc_name. Returns: result

revit_request_user_selectionA

Proactively requests the user in Autodesk Revit to select elements. The HUD button 'Pick Elements' will flash and wait for user clicks.

Args: prompt: Instruction shown to user in Revit HUD (e.g. 'Select the room boundary'). categories: Optional list of category names to restrict selection (e.g. ['Rooms', 'Walls']). multiple: If False, single click picks element instantly. If True, user picks multiple elements and clicks 'Finish'. timeout: Maximum seconds to wait (default 90).

Inputs: prompt (required), port, timeout, doc_name, +2 more. Returns: result

revit_request_user_snipC

Proactively requests the user in Autodesk Revit to snip a region on screen and add drawings/annotations.

Inputs: prompt (required), port, timeout, doc_name. Returns: result

revit_set_active_instanceA

Binds this session to a specific Revit instance/model (by port or document title). All subsequent operations will execute on this instance.

Inputs: port, doc_name. Returns: result

revit_set_busyC

Sets the visual busy indicator and background color of the Revit MCP HUD.

Inputs: busy, port, message, activity, +1 more. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 13 tools

    Disambiguation5/5

    Each tool targets a distinct action or resource: screenshot capture, user selection request, user snip request, HUD state, instance management, model metadata, code execution, selection retrieval, geometry retrieval, and warnings. The potential overlap between capturing screenshots and retrieving the latest screenshot is resolved by clear action boundaries, and requesting selection versus getting current selection is explicitly differentiated.

    Naming Consistency4/5

    All tools use snake_case with a consistent revit_ prefix, and most follow a verb_noun pattern. Minor deviations exist: revit_ping is verb-only and revit_set_busy uses an adjective rather than a noun, but overall the set is highly predictable.

    Tool Count5/5

    The 13 tools are well-scoped for a Revit bridge that handles instance management, user interaction, screenshots, model inspection, and Python execution. No tool appears redundant, and the count fits comfortably within a focused operational set.

    Completeness4/5

    The surface covers core bridge workflows including connection management, user-driven selection/snipping, screenshot capture, model metadata, selection/geometry retrieval, warnings, and arbitrary Python execution for modifications. Direct CRUD tools for elements and transaction helpers are absent, but revit_execute_python provides a broad escape hatch.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      F
      maintenance
      Enables AI to interact with Revit via MCP, allowing data retrieval and element creation, modification, and deletion.
      13
      59 npm
      MIT
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      Connects MCP clients like Claude, Codex, and Cursor to a running Autodesk Revit session for typed BIM queries, verified model edits, family authoring, exports, and Power BI workflows. It is open-source, Apache-2.0, and designed for reliable, verified outcomes.
      -