Skip to content

Open-source Revit MCP server: let Claude and other AI assistants read and edit BIM models, with human approval on every change.

feat: double-click Windows installer (bundled Python, MCP client config, WebView2 check)

A. Sam Mohammadbc31aeffece0
diff --git a/packages/revit-bridge-addin/src/Bridge/PanelHubLauncher.cs b/packages/revit-bridge-addin/src/Bridge/PanelHubLauncher.cs
index b0abef3..5c86300 100644
--- a/packages/revit-bridge-addin/src/Bridge/PanelHubLauncher.cs
+++ b/packages/revit-bridge-addin/src/Bridge/PanelHubLauncher.cs
@@ -136,11 +136,17 @@ public sealed class PanelHubLauncher
private static string? ResolvePythonInterpreter()
{
var overridePath = Environment.GetEnvironmentVariable("AEC_MODEL_BRIDGE_PYTHON");
- if (!string.IsNullOrWhiteSpace(overridePath))
+ if (!string.IsNullOrWhiteSpace(overridePath) && System.IO.File.Exists(overridePath))
{
return overridePath;
}
+ const string bundledPath = @"C:\ProgramData\AECModelBridge\python\python.exe";
+ if (System.IO.File.Exists(bundledPath))
+ {
+ return bundledPath;
+ }
+
foreach (var candidate in new[] { "python", "py" })
{
if (CanRun(candidate))
diff --git a/scripts/build-installer.ps1 b/scripts/build-installer.ps1
new file mode 100644
index 0000000..f69655d
--- /dev/null
+++ b/scripts/build-installer.ps1
@@ -0,0 +1,74 @@
+param(
+ [string]$RevitVersion = "All"
+)
+
+$ErrorActionPreference = "Stop"
+
+Write-Host "Building AEC Model Bridge Double-Click Installer..." -ForegroundColor Cyan
+
+# 1. Ensure package is built
+$distDir = Join-Path $PSScriptRoot "..\dist\AECModelBridge"
+Write-Host "`nRunning package script for Revit $RevitVersion..." -ForegroundColor Yellow
+& "$PSScriptRoot\package.ps1" -RevitVersion $RevitVersion
+
+if (-not (Test-Path $distDir)) {
+ Write-Error "Packaging failed - dist folder $distDir does not exist."
+ exit 1
+}
+
+# 2. Locate or install Inno Setup (ISCC.exe)
+function Get-ISCCCompiler {
+ $cmd = Get-Command iscc -ErrorAction SilentlyContinue
+ if ($cmd) { return $cmd.Source }
+
+ $candidatePaths = @(
+ "${env:LOCALAPPDATA}\Programs\Inno Setup 6\ISCC.exe",
+ "${env:LOCALAPPDATA}\Programs\Inno Setup 7\ISCC.exe",
+ "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
+ "${env:ProgramFiles}\Inno Setup 6\ISCC.exe"
+ )
+ foreach ($path in $candidatePaths) {
+ if ($path -and (Test-Path -LiteralPath $path)) {
+ return $path
+ }
+ }
+ return $null
+}
+
+$isccPath = Get-ISCCCompiler
+
+if (-not $isccPath) {
+ Write-Host "`nInno Setup (ISCC.exe) not found. Attempting auto-installation via winget..." -ForegroundColor Yellow
+ $winget = Get-Command winget -ErrorAction SilentlyContinue
+ if ($winget) {
+ & winget install --id JRSoftware.InnoSetup -e --accept-source-agreements --accept-package-agreements --silent
+ $isccPath = Get-ISCCCompiler
+ }
+}
+
+if (-not $isccPath) {
+ Write-Error "Inno Setup compiler (ISCC.exe) could not be located or installed. Please install Inno Setup 6."
+ exit 1
+}
+
+# 3. Compile Inno Setup Script
+$issPath = Join-Path $PSScriptRoot "installer\AECModelBridge.iss"
+Write-Host "`nCompiling Inno Setup script: $issPath..." -ForegroundColor Yellow
+Write-Host " Using ISCC compiler: $isccPath" -ForegroundColor Gray
+
+& "$isccPath" "$issPath"
+
+if ($LASTEXITCODE -ne 0) {
+ Write-Error "Inno Setup compilation failed with exit code $LASTEXITCODE"
+ exit $LASTEXITCODE
+}
+
+$outputInstaller = Join-Path $PSScriptRoot "..\dist\AECModelBridgeSetup.exe"
+if (Test-Path $outputInstaller) {
+ Write-Host "`nDouble-click installer successfully built!" -ForegroundColor Green
+ Write-Host "Location: $outputInstaller" -ForegroundColor Cyan
+ Write-Host "Size: $([math]::Round((Get-Item $outputInstaller).Length / 1MB, 2)) MB" -ForegroundColor Gray
+} else {
+ Write-Error "Installer build finished, but output installer was not found at $outputInstaller"
+ exit 1
+}
diff --git a/scripts/bundle-python.ps1 b/scripts/bundle-python.ps1
new file mode 100644
index 0000000..3fc3f6a
--- /dev/null
+++ b/scripts/bundle-python.ps1
@@ -0,0 +1,85 @@
+param(
+ [string]$DistPath
+)
+
+$ErrorActionPreference = "Stop"
+
+if (-not $DistPath) {
+ $DistPath = Join-Path $PSScriptRoot "..\dist\AECModelBridge"
+}
+$DistPath = [System.IO.Path]::GetFullPath($DistPath)
+$pythonDir = Join-Path $DistPath "python"
+
+Write-Host "Bundling portable Python runtime..." -ForegroundColor Cyan
+Write-Host " Target directory: $pythonDir" -ForegroundColor Gray
+
+# Create Python directory
+New-Item -ItemType Directory -Path $pythonDir -Force | Out-Null
+
+$pythonExe = Join-Path $pythonDir "python.exe"
+$testImport = if (Test-Path $pythonExe) {
+ & "$pythonExe" -c "import revit_mcp_server" 2>&1
+ $LASTEXITCODE -eq 0
+} else { $false }
+
+if (-not $testImport) {
+ # 1. Download embeddable Python zip if not already present
+ $zipPath = Join-Path $pythonDir "python-3.11.9-embed-amd64.zip"
+ $downloadUrl = "https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip"
+
+ if (-not (Test-Path $pythonExe)) {
+ Write-Host " Downloading embeddable Python 3.11.9..." -ForegroundColor Yellow
+ Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath -UseBasicParsing
+
+ Write-Host " Extracting Python zip..." -ForegroundColor Yellow
+ Expand-Archive -Path $zipPath -DestinationPath $pythonDir -Force
+ Remove-Item -LiteralPath $zipPath -Force
+ }
+
+ # 2. Modify .pth file to enable site-packages and 'import site'
+ $pthFile = Get-ChildItem -Path $pythonDir -Filter "python311._pth" | Select-Object -First 1
+ if ($pthFile) {
+ Write-Host " Configuring $($pthFile.Name)..." -ForegroundColor Yellow
+ $content = Get-Content -LiteralPath $pthFile.FullName -Raw
+ $content = $content -replace '#import site', 'import site'
+ if ($content -notmatch 'Lib[/\\]site-packages') {
+ $content += "`r`nLib/site-packages`r`n"
+ }
+ Set-Content -LiteralPath $pthFile.FullName -Value $content -Force
+ }
+
+ # Create Lib/site-packages folder
+ $sitePackagesDir = Join-Path $pythonDir "Lib\site-packages"
+ New-Item -ItemType Directory -Path $sitePackagesDir -Force | Out-Null
+
+ # 3. Bootstrap pip using get-pip.py
+ $getPipPath = Join-Path $pythonDir "get-pip.py"
+ Write-Host " Downloading get-pip.py..." -ForegroundColor Yellow
+ Invoke-WebRequest -Uri "https://bootstrap.pypa.io/get-pip.py" -OutFile $getPipPath -UseBasicParsing
+
+ Write-Host " Bootstrapping pip into embedded Python..." -ForegroundColor Yellow
+ & "$pythonExe" "$getPipPath" --no-warn-script-location
+ if ($LASTEXITCODE -ne 0) {
+ Write-Error "Failed to install pip into embedded Python."
+ exit $LASTEXITCODE
+ }
+ Remove-Item -LiteralPath $getPipPath -Force
+
+ # 4. Install revit_mcp_server package and dependencies
+ $mcpServerPackage = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "..\packages\mcp-server-revit"))
+ Write-Host " Installing revit_mcp_server from $mcpServerPackage..." -ForegroundColor Yellow
+ & "$pythonExe" -m pip install --no-warn-script-location "$mcpServerPackage"
+ if ($LASTEXITCODE -ne 0) {
+ Write-Error "Failed to install mcp-server-revit into embedded Python."
+ exit $LASTEXITCODE
+ }
+}
+
+Write-Host " Verifying bundled Python runtime..." -ForegroundColor Yellow
+& "$pythonExe" -c "import revit_mcp_server; print('revit_mcp_server imported successfully')"
+if ($LASTEXITCODE -eq 0) {
+ Write-Host "Portable Python runtime bundled successfully at: $pythonDir" -ForegroundColor Green
+} else {
+ Write-Error "Failed to verify revit_mcp_server in bundled Python."
+ exit 1
+}
diff --git a/scripts/configure-mcp-clients.ps1 b/scripts/configure-mcp-clients.ps1
new file mode 100644
index 0000000..0b45dfd
--- /dev/null
+++ b/scripts/configure-mcp-clients.ps1
@@ -0,0 +1,159 @@
+param(
+ [string]$PythonPath = "C:\ProgramData\AECModelBridge\python\python.exe"
+)
+
+$ErrorActionPreference = "Stop"
+
+Write-Host "Configuring MCP clients for AEC Model Bridge..." -ForegroundColor Cyan
+Write-Host " Python binary: $PythonPath" -ForegroundColor Gray
+
+# Define MCP server configurations
+$serverConfigStdio = [ordered]@{
+ command = $PythonPath
+ args = @("-m", "revit_mcp_server.mcp_server")
+ env = [ordered]@{
+ MCP_REVIT_MODE = "bridge"
+ MCP_REVIT_BRIDGE_URL = "http://127.0.0.1:3000"
+ }
+}
+
+$serverConfigVSCode = [ordered]@{
+ type = "stdio"
+ command = $PythonPath
+ args = @("-m", "revit_mcp_server.mcp_server")
+ env = [ordered]@{
+ MCP_REVIT_MODE = "bridge"
+ MCP_REVIT_BRIDGE_URL = "http://127.0.0.1:3000"
+ }
+}
+
+# 1. Configure Claude Desktop (%APPDATA%\Claude\claude_desktop_config.json)
+$claudeDir = Join-Path $env:APPDATA "Claude"
+$claudeConfigFile = Join-Path $claudeDir "claude_desktop_config.json"
+
+try {
+ if (-not (Test-Path $claudeDir)) {
+ New-Item -ItemType Directory -Path $claudeDir -Force | Out-Null
+ }
+
+ $claudeConfig = [ordered]@{ mcpServers = [ordered]@{} }
+ if (Test-Path $claudeConfigFile) {
+ $raw = Get-Content -LiteralPath $claudeConfigFile -Raw -ErrorAction SilentlyContinue
+ if ($raw) {
+ $parsed = $raw | ConvertFrom-Json
+ if ($parsed) {
+ if ($parsed.mcpServers) {
+ $mcpServersObj = [ordered]@{}
+ foreach ($prop in $parsed.mcpServers.PSObject.Properties) {
+ $mcpServersObj[$prop.Name] = $prop.Value
+ }
+ $claudeConfig["mcpServers"] = $mcpServersObj
+ }
+ foreach ($prop in $parsed.PSObject.Properties) {
+ if ($prop.Name -ne "mcpServers") {
+ $claudeConfig[$prop.Name] = $prop.Value
+ }
+ }
+ }
+ }
+ }
+
+ $claudeConfig["mcpServers"]["aec-model-bridge"] = $serverConfigStdio
+ $claudeConfig | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath $claudeConfigFile -Force
+ Write-Host " Configured Claude Desktop: $claudeConfigFile" -ForegroundColor Green
+}
+catch {
+ Write-Warning "Failed to configure Claude Desktop: $_"
+}
+
+# 2. Configure VS Code User Level
+$codeUserDir = Join-Path $env:APPDATA "Code\User"
+if (Test-Path $codeUserDir) {
+ # Path A: globalStorage\ms-vscode.vscode-mcp\mcp.json
+ $vscMcpDir = Join-Path $codeUserDir "globalStorage\ms-vscode.vscode-mcp"
+ New-Item -ItemType Directory -Path $vscMcpDir -Force | Out-Null
+ $vscMcpFile = Join-Path $vscMcpDir "mcp.json"
+
+ try {
+ $vscConfig = [ordered]@{ servers = [ordered]@{} }
+ if (Test-Path $vscMcpFile) {
+ $raw = Get-Content -LiteralPath $vscMcpFile -Raw -ErrorAction SilentlyContinue
+ if ($raw) {
+ $parsed = $raw | ConvertFrom-Json
+ if ($parsed -and $parsed.servers) {
+ $serversObj = [ordered]@{}
+ foreach ($prop in $parsed.servers.PSObject.Properties) {
+ $serversObj[$prop.Name] = $prop.Value
+ }
+ $vscConfig["servers"] = $serversObj
+ }
+ }
+ }
+ $vscConfig["servers"]["aec-model-bridge"] = $serverConfigVSCode
+ $vscConfig | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath $vscMcpFile -Force
+ Write-Host " Configured VS Code MCP file: $vscMcpFile" -ForegroundColor Green
+ }
+ catch {
+ Write-Warning "Failed to update VS Code mcp.json: $_"
+ }
+
+ # Path B: %APPDATA%\Code\User\mcp.json
+ $userMcpFile = Join-Path $codeUserDir "mcp.json"
+ try {
+ $userConfig = [ordered]@{ servers = [ordered]@{} }
+ if (Test-Path $userMcpFile) {
+ $raw = Get-Content -LiteralPath $userMcpFile -Raw -ErrorAction SilentlyContinue
+ if ($raw) {
+ $parsed = $raw | ConvertFrom-Json
+ if ($parsed -and $parsed.servers) {
+ $serversObj = [ordered]@{}
+ foreach ($prop in $parsed.servers.PSObject.Properties) {
+ $serversObj[$prop.Name] = $prop.Value
+ }
+ $userConfig["servers"] = $serversObj
+ }
+ }
+ }
+ $userConfig["servers"]["aec-model-bridge"] = $serverConfigVSCode
+ $userConfig | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath $userMcpFile -Force
+ Write-Host " Configured VS Code User mcp.json: $userMcpFile" -ForegroundColor Green
+ }
+ catch {
+ Write-Warning "Failed to update user mcp.json: $_"
+ }
+
+ # Path C: %APPDATA%\Code\User\settings.json ("mcp.servers")
+ $settingsFile = Join-Path $codeUserDir "settings.json"
+ try {
+ $settingsConfig = [ordered]@{}
+ if (Test-Path $settingsFile) {
+ $raw = Get-Content -LiteralPath $settingsFile -Raw -ErrorAction SilentlyContinue
+ if ($raw) {
+ $cleanRaw = ($raw -split "`r?`n" | Where-Object { $_ -notmatch '^\s*//' }) -join "`n"
+ $parsed = $cleanRaw | ConvertFrom-Json
+ if ($parsed) {
+ foreach ($prop in $parsed.PSObject.Properties) {
+ $settingsConfig[$prop.Name] = $prop.Value
+ }
+ }
+ }
+ }
+ $mcpServersObj = [ordered]@{}
+ if ($settingsConfig.Contains("mcp.servers") -and $settingsConfig["mcp.servers"]) {
+ foreach ($prop in $settingsConfig["mcp.servers"].PSObject.Properties) {
+ $mcpServersObj[$prop.Name] = $prop.Value
+ }
+ }
+ $mcpServersObj["aec-model-bridge"] = $serverConfigStdio
+ $settingsConfig["mcp.servers"] = $mcpServersObj
+ $settingsConfig | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath $settingsFile -Force
+ Write-Host " Configured VS Code settings.json: $settingsFile" -ForegroundColor Green
+ }
+ catch {
+ Write-Warning "Failed to update VS Code settings.json: $_"
+ }
+} else {
+ Write-Host " VS Code user directory not found ($codeUserDir) - skipping VS Code config" -ForegroundColor Gray
+}
+
+Write-Host "MCP client configuration complete!" -ForegroundColor Green
diff --git a/scripts/ensure-webview2.ps1 b/scripts/ensure-webview2.ps1
new file mode 100644
index 0000000..bf33657
--- /dev/null
+++ b/scripts/ensure-webview2.ps1
@@ -0,0 +1,69 @@
+$ErrorActionPreference = "Stop"
+
+Write-Host "Checking WebView2 Runtime status..." -ForegroundColor Cyan
+
+function Test-WebView2Installed {
+ # 1. Fast path wildcard checks
+ $candidatePatterns = @(
+ "${env:ProgramFiles(x86)}\Microsoft\Edge\Application\*\msedgewebview2.exe",
+ "${env:ProgramFiles(x86)}\Microsoft\EdgeWebView\Application\*\msedgewebview2.exe",
+ "${env:ProgramFiles(x86)}\Microsoft\EdgeCore\*\msedgewebview2.exe",
+ "${env:ProgramFiles}\Microsoft\Edge\Application\*\msedgewebview2.exe",
+ "${env:ProgramFiles}\Microsoft\EdgeWebView\Application\*\msedgewebview2.exe"
+ )
+ foreach ($pattern in $candidatePatterns) {
+ $matches = Get-Item -Path $pattern -ErrorAction SilentlyContinue
+ if ($matches) {
+ return $true
+ }
+ }
+
+ # 2. Registry checks
+ $guid = "{F3C4CD00-EF15-42AA-9D7A-456402B44F24}"
+ $regPaths = @(
+ "HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\$guid",
+ "HKLM:\SOFTWARE\Microsoft\EdgeUpdate\Clients\$guid",
+ "HKCU:\SOFTWARE\Microsoft\EdgeUpdate\Clients\$guid"
+ )
+ foreach ($reg in $regPaths) {
+ if (Test-Path -Path $reg) {
+ $pv = (Get-ItemProperty -Path $reg -Name "pv" -ErrorAction SilentlyContinue).pv
+ if ($pv -and $pv -ne "0.0.0.0") {
+ return $true
+ }
+ }
+ }
+
+ return $false
+}
+
+if (Test-WebView2Installed) {
+ Write-Host " WebView2 Runtime is present." -ForegroundColor Green
+ exit 0
+}
+
+Write-Host " WebView2 Runtime not found. Triggering Microsoft Evergreen Bootstrapper..." -ForegroundColor Yellow
+
+$setupUrl = "https://go.microsoft.com/fwlink/p/?LinkId=2124703"
+$setupPath = Join-Path $env:TEMP "MicrosoftEdgeWebview2Setup.exe"
+
+try {
+ Write-Host " Downloading MicrosoftEdgeWebview2Setup.exe..." -ForegroundColor Yellow
+ Invoke-WebRequest -Uri $setupUrl -OutFile $setupPath -UseBasicParsing
+
+ Write-Host " Running silent WebView2 installation..." -ForegroundColor Yellow
+ $process = Start-Process -FilePath $setupPath -ArgumentList "/silent /install" -Wait -PassThru
+ if ($process.ExitCode -eq 0 -or $process.ExitCode -eq -2147219416) {
+ Write-Host " WebView2 Runtime installed/up to date." -ForegroundColor Green
+ } else {
+ Write-Warning "WebView2 installer exited with code $($process.ExitCode)"
+ }
+}
+catch {
+ Write-Warning "Failed to download or run WebView2 installer: $_"
+}
+finally {
+ if (Test-Path $setupPath) {
+ Remove-Item -LiteralPath $setupPath -Force -ErrorAction SilentlyContinue
+ }
+}
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index 3d96d35..70b9791 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -40,61 +40,88 @@ if (-not (Test-Path $DistPath)) {
}
}
-# Install binaries to a version-specific ProgramData directory so supported
-# Revit releases can coexist without overwriting one another.
-Write-Host "Installing binaries..." -ForegroundColor Yellow
-$targetBin = "C:\ProgramData\AECModelBridge\bin\$RevitVersion"
-New-Item -ItemType Directory -Path $targetBin -Force | Out-Null
-
-$sourceBin = "$DistPath\bin\$RevitVersion"
-if (-not (Test-Path $sourceBin)) {
- Write-Error "Binaries for Revit $RevitVersion not found in distribution package.`nAvailable versions: $((Get-ChildItem "$DistPath\bin" -Directory).Name -join ', ')"
- exit 1
+$availableBinDirs = Get-ChildItem "$DistPath\bin" -Directory -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name
+$versionsToInstall = if ($RevitVersion -eq "All") {
+ $availableBinDirs
+} else {
+ @($RevitVersion)
}
-Copy-Item "$sourceBin\*" $targetBin -Recurse -Force
-Write-Host " Installed to: $targetBin" -ForegroundColor Green
-
-# Install add-in manifest
-Write-Host "`nInstalling add-in manifest..." -ForegroundColor Yellow
-$addinDir = if ($AllUsers) {
- "C:\ProgramData\Autodesk\Revit\Addins\$RevitVersion"
-}
-else {
- "$env:APPDATA\Autodesk\Revit\Addins\$RevitVersion"
+if (-not $versionsToInstall -or $versionsToInstall.Count -eq 0) {
+ Write-Error "No valid Revit version binaries found in $DistPath\bin"
+ exit 1
}
-New-Item -ItemType Directory -Path $addinDir -Force | Out-Null
-$sourceManifest = Join-Path $DistPath "addin\AECModelBridge.addin"
-$targetManifest = Join-Path $addinDir "AECModelBridge.addin"
-[xml]$manifest = Get-Content -LiteralPath $sourceManifest -Raw
-$manifest.RevitAddIns.AddIn.Assembly = [string](Join-Path $targetBin "AECModelBridge.dll")
-$manifest.Save($targetManifest)
-$legacyManifest = Join-Path $addinDir "RevitBridge.addin"
-if (Test-Path $legacyManifest) {
- Remove-Item -LiteralPath $legacyManifest -Force
- Write-Host " Removed legacy manifest: $legacyManifest" -ForegroundColor Gray
-}
+foreach ($year in $versionsToInstall) {
+ # Install binaries to a version-specific ProgramData directory
+ Write-Host "`nInstalling binaries for Revit $year..." -ForegroundColor Yellow
+ $targetBin = "C:\ProgramData\AECModelBridge\bin\$year"
+ New-Item -ItemType Directory -Path $targetBin -Force | Out-Null
-$otherAddinDir = if ($AllUsers) {
- "$env:APPDATA\Autodesk\Revit\Addins\$RevitVersion"
-}
-else {
- "C:\ProgramData\Autodesk\Revit\Addins\$RevitVersion"
-}
-foreach ($duplicateName in @("AECModelBridge.addin", "RevitBridge.addin")) {
- $duplicateManifest = Join-Path $otherAddinDir $duplicateName
- if (Test-Path -LiteralPath $duplicateManifest) {
- try {
- Remove-Item -LiteralPath $duplicateManifest -Force
- Write-Host " Removed duplicate manifest: $duplicateManifest" -ForegroundColor Gray
+ $sourceBin = "$DistPath\bin\$year"
+ if (-not (Test-Path $sourceBin)) {
+ Write-Error "Binaries for Revit $year not found in distribution package.`nAvailable versions: $($availableBinDirs -join ', ')"
+ exit 1
+ }
+
+ Get-ChildItem -Path $sourceBin -Recurse | ForEach-Object {
+ $relPath = $_.FullName.Substring($sourceBin.Length)
+ $destPath = Join-Path $targetBin $relPath
+ if ($_.PSIsContainer) {
+ New-Item -ItemType Directory -Path $destPath -Force | Out-Null
+ }
+ else {
+ try {
+ Copy-Item -LiteralPath $_.FullName -Destination $destPath -Force
+ }
+ catch {
+ Write-Warning "Could not copy $relPath (file locked, Revit may be running)"
+ }
}
- catch {
- Write-Warning "Could not remove duplicate manifest: $duplicateManifest"
+ }
+ Write-Host " Installed to: $targetBin" -ForegroundColor Green
+
+ # Install add-in manifest
+ Write-Host "Installing add-in manifest for Revit $year..." -ForegroundColor Yellow
+ $addinDir = if ($AllUsers) {
+ "C:\ProgramData\Autodesk\Revit\Addins\$year"
+ }
+ else {
+ "$env:APPDATA\Autodesk\Revit\Addins\$year"
+ }
+
+ New-Item -ItemType Directory -Path $addinDir -Force | Out-Null
+ $sourceManifest = Join-Path $DistPath "addin\AECModelBridge.addin"
+ $targetManifest = Join-Path $addinDir "AECModelBridge.addin"
+ [xml]$manifest = Get-Content -LiteralPath $sourceManifest -Raw
+ $manifest.RevitAddIns.AddIn.Assembly = [string](Join-Path $targetBin "AECModelBridge.dll")
+ $manifest.Save($targetManifest)
+ $legacyManifest = Join-Path $addinDir "RevitBridge.addin"
+ if (Test-Path $legacyManifest) {
+ Remove-Item -LiteralPath $legacyManifest -Force
+ Write-Host " Removed legacy manifest: $legacyManifest" -ForegroundColor Gray
+ }
+
+ $otherAddinDir = if ($AllUsers) {
+ "$env:APPDATA\Autodesk\Revit\Addins\$year"
+ }
+ else {
+ "C:\ProgramData\Autodesk\Revit\Addins\$year"
+ }
+ foreach ($duplicateName in @("AECModelBridge.addin", "RevitBridge.addin")) {
+ $duplicateManifest = Join-Path $otherAddinDir $duplicateName
+ if (Test-Path -LiteralPath $duplicateManifest) {
+ try {
+ Remove-Item -LiteralPath $duplicateManifest -Force
+ Write-Host " Removed duplicate manifest: $duplicateManifest" -ForegroundColor Gray
+ }
+ catch {
+ Write-Warning "Could not remove duplicate manifest: $duplicateManifest"
+ }
}
}
+ Write-Host " Installed manifest to: $targetManifest" -ForegroundColor Green
}
-Write-Host " Installed to: $addinDir" -ForegroundColor Green
$legacyBinRoot = "C:\ProgramData\AECModelBridge\bin"
$legacyAssembly = Join-Path $legacyBinRoot "AECModelBridge.dll"
@@ -130,6 +157,16 @@ New-Item -ItemType Directory -Path $configTarget -Force | Out-Null
Copy-Item "$DistPath\config\default.json" $configTarget -Force
Write-Host " Installed to: $configTarget\default.json" -ForegroundColor Green
+# Copy bundled Python runtime (if present)
+$sourcePython = Join-Path $DistPath "python"
+$targetPython = "C:\ProgramData\AECModelBridge\python"
+if (Test-Path $sourcePython) {
+ Write-Host "`nInstalling bundled Python runtime..." -ForegroundColor Yellow
+ New-Item -ItemType Directory -Path $targetPython -Force | Out-Null
+ Copy-Item "$sourcePython\*" $targetPython -Recurse -Force
+ Write-Host " Installed to: $targetPython" -ForegroundColor Green
+}
+
# Installation summary
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host "Installation Complete!" -ForegroundColor Green
diff --git a/scripts/installer/AECModelBridge.iss b/scripts/installer/AECModelBridge.iss
new file mode 100644
index 0000000..578c564
--- /dev/null
+++ b/scripts/installer/AECModelBridge.iss
@@ -0,0 +1,27 @@
+; AEC Model Bridge — Inno Setup Installer Script
+; Compiles to AECModelBridgeSetup.exe
+
+[Setup]
+AppId={{D41A24F3-87B1-4A51-9F31-30919E371C25}
+AppName=AEC Model Bridge
+AppVersion=1.1.0
+AppPublisher=Sam-AEC
+AppPublisherURL=https://github.com/Sam-AEC/aec-model-bridge
+DefaultDirName=C:\ProgramData\AECModelBridge
+DefaultGroupName=AEC Model Bridge
+DisableProgramGroupPage=yes
+OutputBaseFilename=AECModelBridgeSetup
+OutputDir=..\..\dist
+Compression=lzma2/max
+SolidCompression=yes
+ArchitecturesAllowed=x64compatible
+ArchitecturesInstallIn64BitMode=x64compatible
+PrivilegesRequired=admin
+
+[Files]
+Source: "..\..\dist\AECModelBridge\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+
+[Run]
+Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -File ""{app}\scripts\ensure-webview2.ps1"""; StatusMsg: "Checking WebView2 Runtime..."; Flags: runhidden waituntilterminated
+Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -File ""{app}\install.ps1"" -RevitVersion All -DistPath ""{app}"""; StatusMsg: "Installing AEC Model Bridge components..."; Flags: runhidden waituntilterminated
+Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -File ""{app}\scripts\configure-mcp-clients.ps1"" -PythonPath ""{app}\python\python.exe"""; StatusMsg: "Configuring MCP clients (Claude Desktop / VS Code)..."; Flags: runhidden waituntilterminated
diff --git a/scripts/package.ps1 b/scripts/package.ps1
index a3e368a..d5f3a37 100644
--- a/scripts/package.ps1
+++ b/scripts/package.ps1
@@ -99,6 +99,11 @@ finally {
Pop-Location
}
+# Bundle portable Python runtime
+if (Test-Path "$PSScriptRoot\bundle-python.ps1") {
+ & "$PSScriptRoot\bundle-python.ps1" -DistPath $distDir
+}
+
# Copy add-in manifests
Write-Host "`nCopying add-in manifests..." -ForegroundColor Yellow
$addinDir = "$distDir\addin"
@@ -106,9 +111,12 @@ New-Item -ItemType Directory -Path $addinDir -Force | Out-Null
Copy-Item "$PSScriptRoot\..\packages\revit-bridge-addin\AECModelBridge.addin" $addinDir -Force
Write-Host " Copied AECModelBridge.addin" -ForegroundColor Green
-# Copy installer entrypoint into the distribution package
+# Copy installer entrypoints and helper scripts into the distribution package
Copy-Item "$PSScriptRoot\install.ps1" "$distDir\install.ps1" -Force
-Write-Host " Copied install.ps1" -ForegroundColor Green
+$distScripts = Join-Path $distDir "scripts"
+New-Item -ItemType Directory -Path $distScripts -Force | Out-Null
+Copy-Item "$PSScriptRoot\*" $distScripts -Recurse -Force
+Write-Host " Copied install.ps1 and helper scripts" -ForegroundColor Green
# Include license terms and required notices in every distribution.
Copy-Item "$PSScriptRoot\..\LICENSE" "$distDir\LICENSE" -Force