Skip to main content
Glama
pyrevit-mcp

pyrevit-mcp

by mk92at

pyrevit-mcp

An MCP server that exposes an open Autodesk Revit model to any MCP client, so the model can be inspected and edited in plain language instead of through the Revit UI.

Ask "find all doors narrower than 1.2m and highlight them in red", "how many square metres of wall are in this building" or "place a container next to the site entrance", and the server translates that into Revit API calls through pyRevit Routes. A small web chat UI is included for demos: split-screen with Revit, CSV import and export, undo, and screenshots of the model right in the chat.

Built for live demos, prototyping and everyday experimenting.

This is not an official Autodesk product and comes with no support commitment. I work at Autodesk as a Technical Specialist for Emerging Tech in Construction, and this project is not part of that role. See Disclaimer and support.

How it works

MCP client (Claude Code, Claude Desktop, ...)
        │ stdio
        ▼
server.py (Python 3 / FastMCP)  ──HTTP :48884──>  pyRevit Routes (IronPython, inside Revit)
        ▲                                                  │
        │ shared revit_get/revit_post                      ▼
app.py (FastAPI :8100) ◄── web chat UI            Revit API, Transactions
        │
        ▼ Claude API

Two entry points share one bridge:

  • server.py is the MCP server. Any MCP client can connect over stdio and gets 29 tools.

  • app.py is a FastAPI backend with a chat UI (web/index.html) driven by the Claude API. It exposes the same tools plus CSV export, and renders images, downloads, and undo in the chat.

Inside Revit, a pyRevit extension (pyrevit-mcp.extension/) registers REST routes. pyRevit injects the active document into the handlers, which run in the Revit API context, one transaction per write.

Related MCP server: Revit MCP Server

What it covers

29 MCP tools:

Area

Tools

Orientation

get_status, get_model_info, get_levels, get_views, get_categories, list_parameters

Query

get_elements, find_elements (level + parameter filters, returns requested parameters in one call), get_element_properties

Write

set_parameter, set_parameters (bulk, one transaction, one undo entry)

Visual

override_graphics, isolate_elements, color_by_parameter (legend included), reset_view, export_image

Selection

get_selection, set_selection

Views

set_active_view

Model health

get_warnings (grouped, with failing element ids)

Geometry

get_element_geometry (position, size, area, volume), get_quantities (take-off by category and type)

Families

list_families, load_family, place_family

Editing

transform_elements (move, copy, rotate), delete_elements (two-step, confirmed)

Creation

create_element (wall, floor, level, grid, including a grid derived from existing walls)

Persistence

save_document (save or synchronize with central)

Parameter access covers instance and type parameters: reads fall back to the element type automatically, and a type write reports how many instances it affects before you trust it. Values are returned as display values in project units. Doors report their room assignment (FromRoom/ToRoom).

Anything geometric works in metres and takes anchors rather than coordinates. An anchor is {"room": "Lager"}, {"element_id": 123456}, {"grid": "B/3"} or, as a last resort, {"point_m": {...}}, and it can carry a level and an offset_m. This is not decoration: a language model asked for absolute coordinates will produce plausible numbers that put the wall outside the building, whereas an anchor is resolved against the model.

Deleting is deliberately two-step. The first call changes nothing and returns a preview plus a token derived from the affected ids; only a second call carrying that token deletes. The token cannot be replayed against a different set of elements.

Documentation

The full guide with a validated per-tool reference is hosted at mk92at.github.io/pyrevit-mcp/pyrevit-mcp.html. It supports English and German (?lang=en|de), light and dark themes, and per-tool anchors (#find_elements). The web chat UI links into it from the tool reference sidebar.

Requirements

  • Autodesk Revit 2024 or newer (developed against Revit 2027) with pyRevit installed

  • Python 3.11 or newer and uv

  • For the web chat UI: an Anthropic API key

Setup

1. Install the Revit extension. Copy or clone this repository, then add pyrevit-mcp.extension to pyRevit's extension search paths (pyRevit Settings → Custom Extension Directories, pointing at this repository's root). Enable the Routes server in pyRevit's settings. Restart Revit.

2. Verify the bridge. With a model open:

curl http://localhost:48884/pyrevit_mcp/status/

The trailing slash is mandatory on every route.

3. Install the Python side:

uv sync

4a. Register with an MCP client, e.g. Claude Code:

claude mcp add revit -s user -- uv --directory "<path-to>/pyrevit-mcp" run python server.py

4b. Or run the web chat UI. Create a .env with your ANTHROPIC_API_KEY (see .env.example), then:

uv run uvicorn app:app --port 8100

Open http://localhost:8100. The sidebar has a tool reference generated from the server at runtime, with a clickable example per tool.

After any change to the extension code, restart Revit cold. The Routes server (Beta) crashes Revit on a pyRevit reload. scripts/restart_revit.ps1 automates the cold restart and test_routes.py smoke-tests every route afterwards.

Layout

server.py                       MCP server, 29 tools, shared HTTP bridge
app.py                          FastAPI chat backend (CSV, undo, images, downloads)
web/index.html                  chat UI, single file
test_routes.py                  end-to-end smoke test for every route
test_mcp.py                     smoke test for the MCP stdio transport itself
explore_model.py                quick model inventory via the running server
scripts/restart_revit.ps1       automated cold restart
pyrevit-mcp.extension/
  startup.py                    route registration
  lib/pyrevit_mcp/
    status.py, elements.py, parameters.py, views.py, selection.py, model.py
    geometry.py                 measurements, quantities, anchor resolution
    editing.py                  families, transforms, confirmed deletion
    creation.py                 walls, floors, levels, grids
    utils.py                    ElementId helpers, safe JSON encoding, parameter access

Known limits

  • No clash detection. Revit and ACC Model Coordination already do interference checking properly, across linked models and with a result workflow attached. This does not try to replace them.

  • Geometry creation covers walls, floors, levels and grids. Not roofs, stairs, curtain systems, MEP runs, or anything that needs a sketch more complex than a closed outline.

  • The derived grid is a heuristic read off wall positions. It recovers the orthogonal order of a building, not a designer's grid, and it wants a human to check it.

  • No editing of geometry after creation beyond move, copy, rotate and delete. Walls cannot be re-hosted, joined, or trimmed through this server.

  • Type parameters are written with a warning, but there is no dry-run mode.

  • Rooms queries slow down on very large models.

  • The Routes server is a pyRevit beta feature; treat the whole bridge as a prototype.

Disclaimer and support

I work at Autodesk as a Technical Specialist for Emerging Tech in Construction. This project grew out of my own exploration of MCP and the Revit API and runs alongside that work, not as part of it. It is not an official Autodesk product or project. Nothing here is built, reviewed, endorsed or maintained by Autodesk, and nothing in this repository is a statement on behalf of Autodesk. Reaching me through my job is not a way to get help with it.

On support I want to be straight with you, because the honest answer has two halves.

I would like to offer as much help as I can, and I am genuinely interested in developing this further together with anyone who finds it useful. Questions and ideas are best raised in Discussions; bugs go to Issues, and pull requests are welcome. I will read all of it. Tell me what you built with it — Show and tell exists for exactly that.

What I cannot do is promise any of that. There is no guaranteed response, no timeline, no fix for your blocker, and no commitment that this keeps working against future Revit or pyRevit changes. If you are building something that has to work, fork it and own your copy.

This project stands on pyRevit by Ehsan Iran-Nejad and the pyRevit Labs community, licensed GPL-3.0. pyRevit is a prerequisite you install yourself, not something this repository ships: its Routes module is the bridge that makes any of this possible, and no pyRevit code is included here.

The ElementId helpers in the extension were adapted from revit-mcp-server, licensed MIT, Copyright (c) 2025 Juan Rodriguez, whose handling of the Revit 2024+ ElementId change and of Revit's modal failure dialogs during headless transactions I reused. Everything else was written for this project and is licensed MIT as well, see LICENSE.

Available Tools

21 tools
color_by_parameterA

Colour every element of a category by its value of one parameter, one colour per distinct value, and get the legend back. Elements without a value are gray. Great for visual QA, e.g. doors by Fire Rating.

Args: category: Revit category name, e.g. 'Doors'. parameter: Parameter to colour by, instance or type, e.g. 'Fire Rating'. level: Only colour elements on this level. Omit for all levels.

Inputs: category (required), parameter (required), level.

export_imageA

Export the active Revit view as a PNG image and return the file path.

Args: width: Image width in pixels (200 to 4000, default 1600).

Inputs: width.

find_elementsA

Find elements of a category, optionally filtered by level and by a parameter value, and return the parameters you ask for in the same call.

Prefer this over calling get_elements and then get_element_properties per element.

Args: category: Revit category name, e.g. 'Doors'. Localized names work too. level: Only elements on this level, e.g. 'Level 2'. Omit for all levels. parameter: Parameter to filter on, e.g. 'Fire Rating'. Omit for no filter. operator: equals, not_equals, contains, not_contains, empty, not_empty, greater, less. 'empty' finds elements where the parameter is unset. value: Value to compare against. Not needed for empty/not_empty. Comparisons are against the DISPLAY value in project units: if the project shows millimetres, 1.2 m must be given as '1200'. include_params: Parameter names to return for each element, e.g. ['Fire Rating', 'Width']. Values come back in project units. limit: Maximum elements to return (default 50). 'matched' in the response is the true number of matches even when the list is capped.

Inputs: category (required), level, limit, value, +3 more.

get_categoriesA

List every element category available in the current model. Use this when a category name was rejected.

Inputs: no named parameters.

get_element_propertiesB

Get all properties/parameters of a specific Revit element by its ID.

Args: element_id: The integer ID of the Revit element.

Inputs: element_id (required).

get_elementsA

Get elements from the active Revit model by category name.

Args: category: Revit category name, e.g. 'Walls', 'Doors', 'Rooms', 'Floors'. limit: Maximum number of elements to return (default 100).

Inputs: category (required), limit.

get_levelsA

List all levels in the model with their elevations, sorted bottom to top.

Inputs: no named parameters.

get_model_infoA

Overview of the open model: title, path, project information, active view, and element counts for common categories.

Inputs: no named parameters.

get_selectionA

Get the elements the user has currently selected in the Revit window.

Inputs: no named parameters.

get_statusA

Check if Revit is running and which document is open.

Inputs: no named parameters.

get_viewsA

List the views in the model (plans, sections, 3D, schedules) with their ids. The active view is marked.

Inputs: no named parameters.

get_warningsA

Model health check: every warning Revit currently reports, grouped by type with counts and sample element ids. Use override_graphics on the element_ids to show a warning group in the model.

Inputs: no named parameters.

isolate_elementsA

Temporarily hide everything except these elements in the active Revit view.

Args: element_ids: Integer IDs of the elements to keep visible.

Inputs: element_ids (required).

list_parametersA

List which parameters a category's elements have: name, instance or type scope, data type, and whether they are writable. Read from a sample element. Use this before filtering or writing when unsure of exact names.

Args: category: Revit category name, e.g. 'Doors'.

Inputs: category (required).

override_graphicsB

Colour elements in the active Revit view so they stand out visually.

Args: element_ids: Integer IDs of the elements to colour. color: A name (red, green, blue, yellow, orange, purple, cyan, magenta, pink, brown, gray, black, white) or a hex string like '#ff8800'.

Inputs: element_ids (required), color.

reset_viewA

Undo colour overrides and temporary isolation in the active Revit view, bringing it back to its normal appearance.

Inputs: no named parameters.

save_documentA

Save the model (or synchronize with central for workshared models). Unsaved changes are lost when Revit restarts, so save after important edits.

Inputs: no named parameters.

set_active_viewA

Switch the Revit window to another view.

Args: view_id: Id of the view to open, as returned by get_views.

Inputs: view_id (required).

set_parameterA

Set a parameter value on a Revit element. Opens a Transaction, sets the value, commits.

If the instance has no parameter of that name, the element TYPE is tried. A type write changes every placed instance of that type; the response then contains scope='type', instances_affected and a warning. Warn the user before writing type parameters.

Args: element_id: The integer ID of the Revit element. parameter_name: The exact parameter name as shown in get_element_properties. value: The new value. Numeric values are in Revit internal units (feet); prefer writing text parameters or copy the format from old_value.

Inputs: value (required), element_id (required), parameter_name (required).

set_parametersA

Set many parameter values in ONE Revit transaction: one round trip and a single entry in Revit's undo history. Always prefer this over calling set_parameter in a loop.

Args: assignments: List of {"element_id": int, "parameter_name": str, "value": str}. Items are applied in order; failed items are reported per item, the rest are still written.

Inputs: assignments (required).

set_selectionA

Select elements in the Revit window. An empty list clears the selection.

Args: element_ids: Integer IDs of the elements to select.

Inputs: element_ids (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 21 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes (selection, views, levels, parameters, graphics), but get_elements and find_elements overlap since both retrieve elements by category; find_elements adds filtering but the simpler get_elements could be confusingly similar. override_graphics and color_by_parameter both apply colors, though one is manual and the other parameter-driven.

    Naming Consistency3/5

    The naming convention is mixed: many query tools use get_ (get_elements, get_views, get_model_info), setters use set_ (set_selection, set_parameter), but there are also list_parameters, find_elements, override_graphics, isolate_elements, reset_view, and export_image which deviate from a strict verb_object pattern. It's readable but not fully consistent.

    Tool Count4/5

    With 21 tools, the server is slightly above the typically ideal 3-15 range, but the breadth is justified by Revit's complexity, covering model info, element queries, parameter editing, view management, graphics overrides, and save/export. No tool feels redundant enough to be cut.

    Completeness3/5

    The tool surface covers a wide range of operations (query, selection, view control, parameter editing, graphics, warnings, save), but it notably lacks element creation or deletion, which are core lifecycle operations in Revit. Some gaps like geometry access are absent, but agents can work around them using the existing parameters and element queries.

    Maintenance

    ActivityNo data
    ResponsivenessSyncing

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      MCP server for Autodesk Revit (BIM) with 705+ API endpoints. Enables AI agents to create walls, place doors/windows, generate sheets, manage views, and produce construction documents via the Model Context Protocol. Uses named pipes for zero-crash Revit integration.
      22
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      MCP server for Autodesk Revit via pyRevit, providing 45 tools for building design, editing, analysis, MEP, interop, and documentation. Works with any MCP client.
      45
      44
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      A pyRevit extension and Python server that enables AI clients to interact with a live Autodesk Revit session through tools for project info, view management, element operations, and schedule management.
      70
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for Autodesk Revit 2024/2025/2026/2027 via pyRevit — 48 tools for building design, editing, analysis, clash detection, MEP, interop, documentation, and model persistence.
      MIT