Skip to content

rvt-mcp v2.5.1

Latest

Choose a tag to compare

@lekhoa221 lekhoa221 released this 23 Nov 08:19
· 9 commits to master since this release
aedb764

This release was developed as 3.0.1 and ships as 2.5.1, the shared release number of the four bimwright gateways (rvt-mcp, dwg-mcp, nwd-mcp, ipt-mcp). The number does not mark breaking changes; the entries below list what changed since v1.2.2.

  • Catalog counts: --toolsets all 257, adaptive bake 260, and bare defaults 63.

Controlled failures and Issues

Install the 2.5.1 gateway and add-ins together. TaskDialog declarations require the matching gateway and add-in protocol, and expire even if you switch away from a document and back. If the document changes before a queued command starts, Revit rejects the command before it runs.

  • Advance TaskDialog answers: revit_set_dialog_answers validates exact permitted pairs, scopes declarations to the next write or gateway session (a target or active-document change drops them and reports _dialogAnswers once), requires dialog_answers_v2, and records authorization/native outcome in Issues. User choices retain priority; denied pairs and native failure guards remain enforced.
  • Open an issue for the user: revit_show_issue opens History → Issues in Revit on one recorded incident, with all states shown, its model and incident selected and an optional suggested action highlighted. It records nothing; the user still reviews, ticks the review box and clicks the action.
  • History → Issues opens on All states every time, so models whose only incidents are observed (user-answered dialogs) stay listed.
  • When a user rule or grant answers a dialog the agent had declared, _failure.groups[] now says so with agentDeclarationNotUsed, and the nextStep for a rule-answered dialog no longer talks about warnings.
  • Windows without a Revit dialog event (an add-in's MessageBox, a file dialog): a read-only background probe in the add-in now notices a window that blocks Revit and waits for the user. During an MCP call the pending receipt says REVIT_OPERATION_REQUIRES_USER after about 2 seconds with _operation.dialog.kind=window (title, text and button labels), instead of waiting for the timeout; revit_get_operation_status reports the same window while it is open, and the final _failure.groups[] lists it with answeredBy=user (a window whose model is not certain goes to _operation.windowDialogsWithoutModel instead; past 20 per operation, omittedWindowDialogs counts the rest). A window left open outside MCP refuses new calls at once with REVIT_BUSY and _operation.window (its title only), queued calls return REVIT_REQUEST_NOT_STARTED at once, and revit_health reports waiting_for_user. The probe never clicks or closes anything; BIMWRIGHT_RVT_WINDOW_PROBE=0 turns it off. See controlled failures.
  • Advance dialog answers and the window probe are part of #16 (Revit dialogs that hold up MCP calls), from #39.
  • Issues → Reset keeps the newest five ledger backups in failures\backups\: after a reset, older ledger-<date>-<time>.db backups and their .pending folders are deleted. Other files in that folder are never touched, and BIMWRIGHT_KEEP_ALL_LOGS=1 keeps every backup.

Capture output folders

  • revit_capture_view_image can write into folders you allow beside %TEMP% and the captures folder: list them in captureRoots in rvtmcp.config.json (an array, or one string separated by ;) or in BIMWRIGHT_CAPTURE_ROOTS in the Revit process environment. Only absolute local folders count; nothing is added by default.
  • The captures folder is now bounded: after a capture is saved there, captures with a generated name (capture-<date>-<time>-<id>…) older than 30 days are deleted, then the oldest until the rest fits 200 MB. A file you named yourself, a subfolder, %TEMP% and your captureRoots folders are never cleaned. BIMWRIGHT_KEEP_ALL_LOGS=1 keeps every capture.
  • revit_capture_view_image accepts an output_path in the user's own %TEMP% folder. Revit runs with TEMP set to a per-session subfolder, so such a path was refused although the message named %TEMP%.
  • A refused output_path returns the allowed folders as allowed_roots (the paths in the error text are masked) and the next step: omit output_path and copy the saved file, or ask the user to allow the folder.

Toast

Update the gateway and add-ins together to see the agent name; an older gateway leaves it out.

  • The card title names the agent of the latest call from its MCP client name: rvt-mcp 2027 · Claude (Claude, Codex, Cline, Cursor, Windsurf, Antigravity, Gemini, Copilot, VS Code; any other client shows its own name, cleaned and capped at 20 characters). The gateway sends the name with each call; it is display text only.
  • The Revit process ID (· PID 30476) fades in when you point at the card and fades out when you leave, with or without branding. It no longer shows all the time.
  • Pause for today: a button at the foot of the expanded card, and a switch in Settings → Toast, hide every card (errors included) in every Revit on this computer until local midnight. Pressed on the card, the card stays open and the button turns into Resume, so a mis-click is undone at once. The choice is saved as the local date in toastSnoozedDate. Turn the switch off, or press the ribbon Toast button, to show cards again now; turning toasts on from the ribbon or Settings also ends the pause. While paused, revit_report_task_result reports toast: "disabled".

Build/deployment dependencies

  • Move the standalone MCP server and its unit tests to .NET 10; require SDK 10.0.404 or a later patch in the same feature band. Revit 2022–2024 plugins retain .NET Framework 4.8.
  • Update ModelContextProtocol and AspNetCore 1.1.0 → 1.4.2, Microsoft.Data.Sqlite 8.0.11 → 8.0.34, native SQLite package 2.1.13 → 2.1.14 (SQLite 3.54.0), Roslyn 4.8.0 → 4.13.0, System.Drawing.Common 8.0.0 → 8.0.34, xUnit 2.9.0 → 2.9.3, and Test.Sdk 17.10.0 → 17.14.2. Hosting and Windows principal APIs now come from the .NET 10 framework instead of redundant package references.
  • Retain Newtonsoft.Json 13.0.3 and the existing Revit API references; Roslyn remains below 4.14 for the .NET 8 plugin dependency layout.
  • The server-only NuGet tool package RvtMcp.Server targets .NET 10, so dotnet tool install needs the .NET 10 runtime. The Setup ZIP still bundles a self-contained server.

Document lifecycle

  • Add revit_get_document_state to meta and the opt-in documents toolset with revit_save_document, revit_save_checkpoint and revit_manage_checkpoints. State reads exclude loaded links and report an unavailable or busy document index without losing other document results.
  • Save checks mode, external file changes and format-upgrade consent. Local models and families use a per-user record of a minimum 20-backup limit; workshared local save does not sync central. Checkpoints are verified copies; pruning requires an approved dry-run hash, and restore creates a separate file. A checkpoint failure can follow a successful save. Save, checkpoint and checkpoint management take timeout_seconds (1–900, default 600). See document lifecycle.
  • A .rte opened for editing is a template and is never saved in place. An unsaved document or a template is saved once with revit_save_document(save_as_path) to a new local .rvt the user names, which starts a project from a template; an existing file is never overwritten. Path rules and the template guard come from revit_save_model in #29; thanks @gbwzzy218.
  • revit_open_model:
    • Expands environment variables such as %USERPROFILE% in the Revit.ini ProjectPath.
    • Stops when ProjectPath is empty or is still not a full folder path, and names File > Options > File Locations > Default path for user files.
    • Refuses a workshared model saved in an older Revit before any local copy is created (WORKSHARED_UPGRADE_NEEDS_USER).
  • The native open/save guard identifies a central by its stored central path rather than the header flag. Opening a newly created local and saving it the first time no longer need a grant; opening or saving a central still does.
  • FILE_CHANGED_ON_DISK can follow Reload Latest in Revit's UI on a workshared local, which advances the save count in memory but not on disk. The document lifecycle guide says what to do: ask the user to review the local and save it in Revit (not Synchronize with Central), read revit_get_document_state again, then retry. Without a known UI Reload, check for an external file replacement first; the file is never overwritten to clear the error.

Wall top constraints

  • revit_set_wall_top in modify: attaches walls' top constraint to a level with an optional offset, checking every wall first so a top at or below a wall's base changes nothing. From #29; thanks @gbwzzy218.

View style, orientation and camera views

  • revit_set_view_style, revit_set_view_orientation and revit_create_camera_view in view: set display style and detail level, aim a 3D view from eye and target points, and create or re-aim perspective camera views, so an agent can frame and capture its own result with revit_capture_view_image. From #28; thanks @gbwzzy218.
  • Named 3D views and cameras save the new orientation, which Revit Undo restores. The default 3D view ({3D}, or {3D - user} when workshared) is a viewing view: only its temporary camera moves, nothing is saved, and the result reports orientation_saved: false. A failed call leaves the camera where it was. New cameras turn off Far Clip Active and report far_clip_active.
  • revit_set_view_orientation without fit turns off the crop box only on the default 3D view. A named view keeps its crop box, since it may be placed on a sheet, unless fit=true; fit=false changes neither crop nor zoom.
  • The revit_set_view_orientation description tells the agent to pass the returned view.view_id to revit_capture_view_image, which otherwise exports the active view.

Mesh import

  • revit_create_mesh_shapes in geometry: builds DirectShape elements with materials from a local JSON mesh file (vertices in mm, triangle or quad faces), for freeform massing without arbitrary code. One transaction per file; closed, consistently wound meshes are built as solids, and other meshes as open shells that fall back to mesh geometry when Revit cannot make a solid. Existing materials are reused unchanged unless update_materials=true; each call is capped at 64 MB and 500,000 faces, and network paths are refused. It is opt-in with the geometry toolset, which installed setups enable through all. From #30 for #26; thanks @gbwzzy218.

Move and rotate

  • Add typed revit_move_elements and revit_rotate_elements commands with explicit model-space units, atomic selection validation, placement checks and native Undo. Rotation has no default pivot: pass one explicit pivot for the whole selection, or pivot_mode="each_location" to turn each element in place about its insertion point or location-line midpoint. See usage and verification. From #27; thanks @kiselas.
  • Rooms and model groups move and rotate too. Their location point has no readable rotation, so only their position is checked and rotation_degrees is null. pivot_z_mm is optional and defaults to 0, since it does not change a turn about a vertical axis; without pivot_x_mm or pivot_y_mm the error names both choices (one pivot, or pivot_mode="each_location"). When Revit holds back a transform, the error names the element, and all changes are rolled back.

Send code and baked tools

  • revit_send_code_to_revit compile errors carry a hint computed from the Revit API the script was compiled against (in the error text and in diagnostics[].hint):
    • A missing member (CS1061, CS0117) names where it really is: a subtype to check and cast to, a property that leads to it (x.Application.FamilyTemplatePath), the types that have it, or that no API type has it. The closest members of the type follow.
    • A wrong call (CS1503, CS1501, CS7036, CS1620, CS1615, CS1729) shows the real signatures, the overload that accepts the named argument first. A type with no public constructor lists its static factories (Plane.Create…).
    • An unknown type or name (CS0246, CS0103) names the using to add: a Revit namespace, or the namespace of another referenced assembly (Regex → System.Text.RegularExpressions).
    • A hint is given once per compile. The first one builds a name index of the loaded Revit API (about 0.3 s, 4 MB, once per Revit session).
  • New read-only tool revit_describe_api (in meta; also with --read-only and --disable-send-code) lists one Revit API type as loaded in the running Revit: constructors and static factories, properties with get/set, methods with parameter types, operators, enum values, obsolete marks with their replacement text, base types and direct subtypes. Inherited members are grouped by the API type that declares them; member narrows the list, which is capped at 200 lines. It reads no document. The add-in advertises describe_api_v1; with an older add-in the gateway refuses the call with CAPABILITY_REQUIRED before sending it.
  • revit_send_code_to_revit accepts more of the script shapes agents write:
    • A body that declares its own app, uidoc or doc at the top level keeps its own; the generated one of that name is left out instead of failing with CS0128 / CS0136.
    • A full McpDynamicScript source without any using gets the default imports. A source with its own usings is compiled as written.
    • A body that closes Run itself and leaves its last helper type or method open is repaired before compiling: the stray } is dropped in place (line and column numbers stay yours) and the missing one is added at the end. The response says so in script_repair. Only that exact shape is repaired; any other stray } (CS1022) is refused with a hint on the expected shape.
  • A DLL loaded in Revit whose metadata the C# compiler cannot read (for example a protected assembly from another add-in) no longer makes every revit_send_code_to_revit and baked-tool compile fail with CS0009. The file is left out of the compile references and written to the diagnostic log. Send-code results then include skipped_references (name, reason), and compile errors list the skipped names. Fixes #38.

Server memory

  • The MCP server runs Workstation GC instead of the Server GC that Sdk.Web turns on, matching the other bimwright gateways. Each MCP client starts its own server, and Server GC kept one heap and GC thread per core. On a 20-core machine, an idle server drops from about 160 MB to about 70 MB private memory and from about 40 to 21 threads; after a burst of large revit_send_code_to_revit results it keeps about 135 MB instead of about 750 MB. Call latency and CPU time are unchanged. Set DOTNET_gcServer=1 to bring back Server GC. From #36; thanks @PhanCongVuDuc.

Logs

  • Local logs rotate once per day instead of on every write. Daily rotation compared the log's creation time, which Windows gives back to a file re-created right after a rename, so each call left a one-line archive and every later write scanned them all; tens of thousands of archives made a large revit_send_code_to_revit call take about 10 s. Rotation now uses the last write time, and log maintenance reads file sizes and times in one directory pass. Archives already created are removed by the existing 30-day retention.
  • BIMWRIGHT_KEEP_ALL_LOGS=1 (also true, yes or on) keeps every record. Set it in the gateway's and the Revit process's environment; each reads its own. Automatic deletion of call logs, daily journals, send-code journals, usage and bake audit records, diagnostics, agent reports, generated captures and Issues → Reset backups beyond the newest five is skipped. Files still rotate to timestamped archives, the diagnostic log rolls to a timestamped archive instead of overwriting its one backup, and nothing is trimmed. It turns no log on and changes neither what is recorded nor the send-code body TTL. Keeping the send-code journal past its 7-day purge after disabling is the one deliberate exception to that journal's time limit. Spill files, checkpoints, discovery files and explicit deletions are unchanged; unset, retention is unchanged.

Agent reports

  • revit_show_report in meta: opens the Reports window on one saved report by its report_id, as a click on the report toast does, so the agent can show a report the user asks for instead of describing where to click. It does not change the model and stays available with --read-only. A deleted or expired report returns REPORT_NOT_FOUND. See agent reports.

Tags, dimensions and sheets

  • revit_tag_all_walls skips walls that already have a tag, as its description said; a second call no longer tags every wall again. Wall tags and multi-category tags count, so a keynote or material tag does not hide a wall. Existing tags are read as the elements the view owns: on a large plan the view-scoped read missed about half of them, and a second call tagged 42 walls again. A tag hidden in the view still counts as a tag. It returns the new tag ids, alreadyTagged, walls without a location curve under skippedNoLocationCurve, and walls that could not be tagged by id with failedCount. When no wall can be tagged the call fails and changes nothing. Fixes #40.
  • The tag tools read existing tags the same way, with room tags collected by category. revit_find_untagged_elements no longer reports tagged rooms as untagged, and revit_tag_all_rooms and revit_tag_all_areas read existing tags the same way. A scan of existing or visible elements that cannot finish is now an error, instead of answering as if the view had no tags or the element were hidden; a tag's hosts are used only after a complete read. Fixes #41.
  • revit_tag_elements, revit_tag_all_by_category, revit_tag_all_walls, revit_find_untagged_elements and revit_tag_structural_framing refuse a sheet and name the views placed on it that can hold tags (not renderings, legends or drafting views) with their ids; revit_tag_all_walls, which works on the active view, says to activate one of them with revit_activate_view. Text notes on sheets are unchanged. Fixes #42.
  • revit_create_dimensions describes its references (mode, element_id, and stable_reference for explicit_reference_stable) with an example. When no dimension is created (fewer than two references resolve, no line can be inferred, or Revit refuses the line) it fails with created: false and failed_references in the data, instead of returning success. Parameter validation checks each reference's required fields and mode, and its hint lists the allowed values instead of pointing to an Example section. Fixes #43.
  • revit_create_dimensions with mode: wall_centerline works: the reference now comes from the wall's location line in its geometry (the line set by the wall's Location Line, which may be a face), and only a referenced line within 1 mm of the location line is used; otherwise that reference fails. Before, it failed for every wall. Without line, parallel references in a plan view are dimensioned across, perpendicular to them; the old inference from bounding-box centres was refused by Revit for walls of different heights, so in a plan view it now keeps the line at one elevation, while sections and elevations keep a vertical dimension. Curved walls are refused per reference.
  • revit_batch_execute rolls back when a tag or dimension step partly fails: revit_tag_elements, revit_tag_all_by_category, revit_tag_all_rooms, revit_tag_all_areas and revit_create_dimensions now report failedCount. A failed step keeps its data in the batch result, for example failed_references. Fixes #45.
  • revit_create_line_based_element refuses a typeId that is not a wall type, instead of creating the wall with the default type; wall is its only elementType. revit_get_available_family_types no longer suggests system categories such as Walls or Pipes, and tool descriptions that pointed to other tools now use their revit_ names. revit_list_family_types_in_family takes the system:<typeId> id revit_list_loaded_families returns and lists the id of every type in that system family, including wall types with no instance. Fixes #44.
  • revit_ai_element_filter without a parameter filter reads only limit elements and counts the category natively. With a filter it still tests every element so totalFound stays exact; the description says so. Fixes #46.
  • revit_place_view_on_sheet takes optional xMm/yMm (both or neither) in sheet paper millimetres, like revit_place_schedule_on_sheet. Without them the viewport stays at the fixed default point (304.8, 228.6) mm as before; revit_align_viewports with center_on_sheet centres it on the title block afterwards. The response returns the placed center {u, v} in mm and placement (requested or default_point). Fixes #47.
  • Parameter validation in every tool also checks objects inside an array parameter, one level deep: required fields, property types and allowed values. The hint describes what the schema allows for the failing field instead of pointing to the description's Example section, and the gateway now passes the add-in's Suggestion: and Hint: lines on in the error text; before, only the error line reached the agent.
  • The tool summaries in Settings now match the changed descriptions of the nine tools these fixes touched (for example revit_create_dimensions, which Settings still showed as an array of element-reference objects), in every UI language.

Rooms and areas

  • revit_list_areas reports each area's area_scheme and filters by area_scheme_name again. Areas are model elements with no owner view, so the scheme read from the owner view was null for every area and the scheme filter matched nothing; the scheme now comes from the area itself, with the owner view as a fallback. Fixes #55; from #56, thanks @tal-sm.

Distribution

Setup includes the self-contained Windows x64 gateway and Revit 2022–2027 plugins. NuGet (RvtMcp.Server) contains the gateway only and requires .NET 10. The Claude Desktop MCPB requires the exact Setup gateway SHA-256 (90494b912d5795f1a4bc32d4f5b71b7ecd8b377e699209819a3e0079ad7d6123), including executable overrides. All three packages have SHA-256 sidecars.

Validation

  • CI run 45137108582 on master (aedb764): public-tree, tests-xunit, installer-powershell, installer-pwsh, plugin-r22–plugin-r27, server-nuget, client-setup-zip all passed.
  • MCPB catalog capture and validation on 2.5.1+aedb764b287c5a12ace05d410bcf35689914c5d1: 260 tools (--toolsets all + adaptive bake), schema SDK 1.27.1 PASS, mcpb validate PASS.

Source commit: aedb764b287c5a12ace05d410bcf35689914c5d1.