Skip to content

WolfzTech/RevitCommandRunner

Repository files navigation

RevitCommandRunner

AI-driven command execution framework for Autodesk Revit.

RevitCommandRunner installs as a Revit application plugin and exposes an MCP server so AI agents can execute Revit commands, read results, fix code, rebuild, and run again without restarting Revit.

Components

  • src/RevitCommandRunner - Revit add-in source.
  • mcp-server - Node.js MCP server used by AI clients.
  • installer/RevitCommandRunnerInstaller - WPF installer EXE source.
  • installer/Create-Embedded-Installer.ps1 - embeds the built bundle and MCP server into one distributable installer.
  • Rebuild-Installer.bat - one-click release build wrapper.

Build Installer

Run from the repository root:

Rebuild-Installer.bat 1.0.2

The output is:

releases\RevitCommandRunner-v1.0.2-Installer.exe

Distribute only that EXE. It contains the Revit bundle, MCP server, and dependencies.

Installer Behavior

The installer places the bundle here:

%APPDATA%\Autodesk\ApplicationPlugins\RevitCommandRunner.bundle

After installing the bundle, it shows a WPF checkbox dialog for MCP client configuration. All clients are checked by default:

  • Claude Code
  • Claude Desktop
  • OpenCode
  • Antigravity
  • Cursor

The installer creates or updates the relevant MCP config entry. Existing unrelated MCP servers are preserved. If revit-command-runner already exists, it is updated instead of duplicated.

MCP Server Path

All clients point to the bundled MCP server:

%APPDATA%/Autodesk/ApplicationPlugins/RevitCommandRunner.bundle/mcp-server/index.js

Requirements

End Users (Running Installer)

Developers (Building from Source)

  • Windows
  • Autodesk Revit 2021-2027
  • .NET SDK 8.0+
  • Node.js 18+ and npm
  • PowerShell 7+ (pwsh)

Development Build Steps

Rebuild-Installer.bat runs these steps:

pwsh -NoProfile -ExecutionPolicy Bypass -File src\RevitCommandRunner\Build-AllVersions.ps1 -Configuration Release
cd mcp-server
npm install
npm run build
cd ..
pwsh -NoProfile -ExecutionPolicy Bypass -File installer\Create-Embedded-Installer.ps1 -Version 1.0.2

Runtime Files

The add-in and MCP server communicate through JSON files in:

%LOCALAPPDATA%\RevitCommandRunner

Main files:

  • command-queue.json
  • results\results-{id}.json

Command Interface

Commands can implement IExternalCommandWithUIApp for direct UIApplication access:

using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using RevitCommandRunner.Core;

public class MyCommand : IExternalCommandWithUIApp
{
    public Result Execute(UIApplication app, ref string message, ElementSet elements)
    {
        var doc = app.ActiveUIDocument.Document;
        message = $"Active document: {doc.Title}";
        return Result.Succeeded;
    }
}

Standard IExternalCommand is also supported, but IExternalCommandWithUIApp is preferred.

Troubleshooting

Assembly Loading Errors (0x80131515)

If you encounter errors like:

Could not load file or assembly 'YourDLL, Version=X.X.X.X, Culture=neutral, PublicKeyToken=null'. 
Operation is not supported. (0x80131515)

This is the LOAD_FROM_BLOCKED_ZONE error caused by Windows security restrictions. It occurs when:

  • Your DLL is in a cloud-synced folder (OneDrive, Dropbox, Google Drive, etc.)
  • The DLL is marked as "downloaded from the internet" by Windows
  • The path is treated as an untrusted zone

The Fix (Automatic in v1.0.3+)

RevitCommandRunner automatically handles this by:

  1. Programmatically unblocking files - Removes the Zone.Identifier alternate data stream
  2. Fallback to byte-stream loading - If unblocking fails, loads assemblies via memory stream
  3. Dependency resolution - Applies the same logic to all dependency DLLs

Manual Workaround (If Needed)

If issues persist, manually unblock your DLLs:

Unblock-File -Path "d:\YourProject\bin\2026\*.dll"

Or move your project outside cloud-synced folders to a local directory like C:\Projects\.

Technical Details

The error code 0x80131515 specifically means the assembly is from an untrusted zone. The fix is implemented in:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors