Open-source Revit MCP server: let Claude and other AI assistants read and edit BIM models, with human approval on every change.
Python aecai-agentsautodeskautomationbimclaudeifcmcpmcp-servermodel-context-protocolnavisworksrevitrevit-addinrevit-apirhino
feat: implement Batch 7 Family Management & streamline repo
A. Sam Mohammadfd838f4a0161
diff --git a/examples/create_house.py b/examples/create_house.pydeleted file mode 100644index 3583f24..0000000--- a/examples/create_house.py+++ /dev/null@@ -1,264 +0,0 @@-"""-Script to create a simple house in Revit using the MCP Bridge.-This demonstrates the RevitMCP server capabilities.-"""-import requests-import json-import time-from typing import Dict, Any--BRIDGE_URL = "http://127.0.0.1:3000"--def call_tool(tool_name: str, payload: Dict[str, Any]) -> Dict[str, Any]:- """Call a Revit tool through the bridge."""- request_id = f"{tool_name}-{int(time.time())}"-- data = {- "tool": tool_name,- "payload": payload,- "request_id": request_id- }-- print(f"\n{'='*60}")- print(f"Calling: {tool_name}")- print(f"Payload: {json.dumps(payload, indent=2)}")-- try:- response = requests.post(- f"{BRIDGE_URL}/execute",- json=data,- timeout=30- )- response.raise_for_status()- result = response.json()-- # Handle both "status" and "Status" (Revit bridge uses capital S)- status = result.get('Status', result.get('status', 'unknown'))- print(f"Status: {status}")-- if status.lower() == 'error' or result.get('status') == 'error':- message = result.get('Message', result.get('message', 'Unknown error'))- print(f"Error: {message}")- if 'StackTrace' in result or 'stack_trace' in result:- stack = result.get('StackTrace', result.get('stack_trace', ''))- print(f"Stack trace:\n{stack}")- else:- res_data = result.get('Result', result.get('result', {}))- print(f"Result: {json.dumps(res_data, indent=2)}")-- return result- except Exception as e:- print(f"ERROR: {e}")- return {"status": "error", "message": str(e)}--def check_health():- """Check if bridge is healthy."""- print("Checking bridge health...")- response = requests.get(f"{BRIDGE_URL}/health")- health = response.json()- print(f"Bridge Status: {health.get('status')}")- print(f"Revit Version: {health.get('revit_version')}")- print(f"Active Document: {health.get('active_document')}")- return health--def create_simple_house():- """Create a simple house in Revit."""-- print("\n" + "="*60)- print("CREATING A SIMPLE HOUSE IN REVIT")- print("="*60)-- # Check health- health = check_health()-- # Check if we need to create a new document- if health.get('active_document') == 'none':- print("\nNo active document. Creating new Revit project...")- result = call_tool("revit.create_new_document", {- "template": "default"- })- if result.get('status') == 'error':- print("Failed to create document. Please open a Revit project manually.")- return- time.sleep(2)-- # Get document info- print("\n--- Getting Document Info ---")- doc_info = call_tool("revit.get_document_info", {})-- # List existing levels- print("\n--- Listing Existing Levels ---")- levels_result = call_tool("revit.list_levels", {})-- # Assume we have a "Level 1" from the template- # House dimensions: 10m x 8m (approximately 33ft x 26ft)-- # Step 1: Create exterior walls (rectangular floor plan)- print("\n" + "="*60)- print("STEP 1: Creating Exterior Walls")- print("="*60)-- # Wall coordinates in feet (Revit uses imperial units by default)- # Creating a 30ft x 25ft house- wall_height = 10 # 10 feet-- # South wall (bottom)- print("\n--- Creating South Wall ---")- call_tool("revit.create_wall", {- "start_point": {"x": 0, "y": 0, "z": 0},- "end_point": {"x": 30, "y": 0, "z": 0},- "height": wall_height,- "level": "Level 1",- "wall_type": "Generic - 8\""- })-- # East wall (right)- print("\n--- Creating East Wall ---")- call_tool("revit.create_wall", {- "start_point": {"x": 30, "y": 0, "z": 0},- "end_point": {"x": 30, "y": 25, "z": 0},- "height": wall_height,- "level": "Level 1",- "wall_type": "Generic - 8\""- })-- # North wall (top)- print("\n--- Creating North Wall ---")- call_tool("revit.create_wall", {- "start_point": {"x": 30, "y": 25, "z": 0},- "end_point": {"x": 0, "y": 25, "z": 0},- "height": wall_height,- "level": "Level 1",- "wall_type": "Generic - 8\""- })-- # West wall (left)- print("\n--- Creating West Wall ---")- call_tool("revit.create_wall", {- "start_point": {"x": 0, "y": 25, "z": 0},- "end_point": {"x": 0, "y": 0, "z": 0},- "height": wall_height,- "level": "Level 1",- "wall_type": "Generic - 8\""- })-- # Step 2: Create floor- print("\n" + "="*60)- print("STEP 2: Creating Floor Slab")- print("="*60)-- call_tool("revit.create_floor", {- "boundary_points": [- {"x": 0, "y": 0, "z": 0},- {"x": 30, "y": 0, "z": 0},- {"x": 30, "y": 25, "z": 0},- {"x": 0, "y": 25, "z": 0}- ],- "level": "Level 1",- "floor_type": "Generic - 12\""- })-- # Step 3: Create Level 2 for roof- print("\n" + "="*60)- print("STEP 3: Creating Level 2 for Roof")- print("="*60)-- call_tool("revit.create_level", {- "elevation": wall_height,- "name": "Level 2"- })-- # Step 4: Create roof- print("\n" + "="*60)- print("STEP 4: Creating Roof")- print("="*60)-- call_tool("revit.create_roof", {- "boundary_points": [- {"x": -2, "y": -2, "z": wall_height},- {"x": 32, "y": -2, "z": wall_height},- {"x": 32, "y": 27, "z": wall_height},- {"x": -2, "y": 27, "z": wall_height}- ],- "level": "Level 2",- "roof_type": "Generic - 12\"",- "slope": 0.5 # 6/12 pitch- })-- # Step 5: Add door (centered on south wall)- print("\n" + "="*60)- print("STEP 5: Adding Front Door")- print("="*60)-- call_tool("revit.place_door", {- "location": {"x": 15, "y": 0, "z": 0},- "level": "Level 1",- "family_name": "Single-Flush",- "type_name": "36\" x 84\""- })-- # Step 6: Add windows- print("\n" + "="*60)- print("STEP 6: Adding Windows")- print("="*60)-- # Window on east wall- call_tool("revit.place_window", {- "location": {"x": 30, "y": 12.5, "z": 3},- "level": "Level 1",- "family_name": "Fixed",- "type_name": "36\" x 48\""- })-- # Window on west wall- call_tool("revit.place_window", {- "location": {"x": 0, "y": 12.5, "z": 3},- "level": "Level 1",- "family_name": "Fixed",- "type_name": "36\" x 48\""- })-- # Window on north wall- call_tool("revit.place_window", {- "location": {"x": 15, "y": 25, "z": 3},- "level": "Level 1",- "family_name": "Fixed",- "type_name": "36\" x 48\""- })-- # Step 7: Create a 3D view to see the result- print("\n" + "="*60)- print("STEP 7: Creating 3D View")- print("="*60)-- call_tool("revit.create_3d_view", {- "view_name": "House 3D View"- })-- # Save the document- print("\n" + "="*60)- print("SAVING DOCUMENT")- print("="*60)-- call_tool("revit.save_document", {})-- print("\n" + "="*60)- print("HOUSE CREATION COMPLETE!")- print("="*60)- print("\nCheck your Revit window to see the simple house.")- print("A 30ft x 25ft house with:")- print(" - 4 exterior walls")- print(" - Floor slab")- print(" - Roof")- print(" - 1 door (front)")- print(" - 3 windows (sides and back)")--if __name__ == "__main__":- try:- create_simple_house()- except KeyboardInterrupt:- print("\n\nOperation cancelled by user.")- except Exception as e:- print(f"\n\nFATAL ERROR: {e}")- import traceback- traceback.print_exc()diff --git a/examples/create_simple_house.py b/examples/create_simple_house.pydeleted file mode 100644index ecd7c04..0000000--- a/examples/create_simple_house.py+++ /dev/null@@ -1,100 +0,0 @@-"""-Create a simple house in Revit - simplified version with correct parameters-"""-import requests-import json--BRIDGE_URL = "http://127.0.0.1:3000"--def call_tool(tool, payload):- """Call a Revit tool."""- data = {"tool": tool, "payload": payload, "request_id": f"{tool}-{hash(str(payload))}"}- response = requests.post(f"{BRIDGE_URL}/execute", json=data, timeout=30)- result = response.json()-- status = result.get('Status', 'unknown')- print(f"\n[{tool}] Status: {status}")-- if status.lower() == 'error':- print(f" Error: {result.get('Message', 'Unknown')}")- return None- else:- res = result.get('Result', {})- if res:- print(f" Result: {json.dumps(res, indent=4)}")- return res--print("=" * 70)-print("CREATING A SIMPLE HOUSE IN REVIT")-print("=" * 70)--# Check available levels-print("\n1. Checking available levels...")-levels = call_tool("revit.list_levels", {})-if levels:- print(f" Found {levels['count']} levels")- for l in levels['levels']:- print(f" - {l['name']} @ {l['elevation_ft']:.2f} ft")--# Create 4 walls (30ft x 25ft house)-print("\n2. Creating exterior walls...")--walls = []-wall_coords = [- ("South", (0, 0, 0), (30, 0, 0)),- ("East", (30, 0, 0), (30, 25, 0)),- ("North", (30, 25, 0), (0, 25, 0)),- ("West", (0, 25, 0), (0, 0, 0))-]--for name, start, end in wall_coords:- print(f"\n Creating {name} wall...")- wall = call_tool("revit.create_wall", {- "start_point": {"x": start[0], "y": start[1], "z": start[2]},- "end_point": {"x": end[0], "y": end[1], "z": end[2]},- "height": 10,- "level": "L1"- })- if wall:- walls.append(wall)--print(f"\n [OK] Created {len(walls)} walls")--# Create floor-print("\n3. Creating floor slab...")-floor = call_tool("revit.create_floor", {- "boundary_points": [- {"x": 0, "y": 0, "z": 0},- {"x": 30, "y": 0, "z": 0},- {"x": 30, "y": 25, "z": 0},- {"x": 0, "y": 25, "z": 0}- ],- "level": "L1"-})--if floor:- print(" [OK] Floor created")--# List what we created-print("\n4. Verifying created elements...")-walls_check = call_tool("revit.list_elements_by_category", {"category": "Walls"})-if walls_check:- print(f" Total walls in model: {walls_check['count']}")--floors_check = call_tool("revit.list_elements_by_category", {"category": "Floors"})-if floors_check:- print(f" Total floors in model: {floors_check['count']}")--# Get document info-print("\n5. Document info...")-doc_info = call_tool("revit.get_document_info", {})--print("\n" + "=" * 70)-print("HOUSE CREATION COMPLETE!")-print("=" * 70)-print(f"\nCreated in Revit:")-print(f" - {len(walls)} exterior walls (30ft x 25ft footprint)")-print(f" - 1 floor slab")-print(f" - Wall height: 10 feet")-print("\nCheck your Revit window to see the simple house structure!")-print("=" * 70)diff --git a/examples/revit-mcp-config.json b/examples/revit-mcp-config.jsondeleted file mode 100644index 946d768..0000000--- a/examples/revit-mcp-config.json+++ /dev/null@@ -1,6 +0,0 @@-{- "mode": "mock",- "workspace_dir": "C:/RevitProjects",- "allowed_directories": ["C:/RevitProjects"],- "bridge_url": "http://localhost:3000"-}diff --git a/examples/test-mcp-handshake.py b/examples/test-mcp-handshake.pydeleted file mode 100644index 6724e1f..0000000--- a/examples/test-mcp-handshake.py+++ /dev/null@@ -1,129 +0,0 @@-"""-Test MCP server handshake - simulates what Claude Desktop does-"""-import json-import subprocess-import sys-import time--print("="*70)-print("MCP Server Handshake Test")-print("="*70)-print()--# Configuration from claude_desktop_config.json-config = {- "command": r"C:\Users\samo3\AppData\Local\Programs\Python\Python313\python.exe",- "args": ["-m", "revit_mcp_server.mcp_server"],- "env": {- "MCP_REVIT_WORKSPACE_DIR": r"C:\Users\samo3\Documents",- "MCP_REVIT_ALLOWED_DIRECTORIES": r"C:\Users\samo3\Documents",- "MCP_REVIT_BRIDGE_URL": "http://127.0.0.1:3000",- "MCP_REVIT_MODE": "bridge"- }-}--print("1. Starting MCP server...")-print(f" Command: {config['command']}")-print(f" Args: {' '.join(config['args'])}")-print()--# Start the server-import os-env = os.environ.copy()-env.update(config["env"])--# Change to repo directory-repo_dir = r"C:\Users\samo3\OneDrive - Heijmans N.V\Documenten\GitHub\Autodesk-Revit-MCP-Server"-os.chdir(repo_dir)--try:- process = subprocess.Popen(- [config["command"]] + config["args"],- stdin=subprocess.PIPE,- stdout=subprocess.PIPE,- stderr=subprocess.PIPE,- env=env,- text=True,- bufsize=1- )-- print("2. Server started (PID: {})".format(process.pid))- print()-- # Send MCP initialize request- initialize_request = {- "jsonrpc": "2.0",- "id": 1,- "method": "initialize",- "params": {- "protocolVersion": "2024-11-05",- "capabilities": {},- "clientInfo": {- "name": "test-client",- "version": "1.0.0"- }- }- }-- print("3. Sending initialize request...")- print(json.dumps(initialize_request, indent=2))- print()-- # Send request- process.stdin.write(json.dumps(initialize_request) + "\n")- process.stdin.flush()-- print("4. Waiting for response...")-- # Wait for response (with timeout)- import select- timeout = 5- start = time.time()-- response_lines = []- while time.time() - start < timeout:- # Check if there's output available- try:- line = process.stdout.readline()- if line:- response_lines.append(line.strip())- print(f" Received: {line.strip()}")-- # Try to parse as JSON- try:- response = json.loads(line)- print()- print("5. SUCCESS! Server responded:")- print(json.dumps(response, indent=2))- break- except json.JSONDecodeError:- # Not JSON yet, keep reading- continue- except:- break- else:- print()- print("5. TIMEOUT - No valid response received")-- # Check stderr- stderr = process.stderr.read()- if stderr:- print()- print("STDERR output:")- print(stderr)-- # Clean up- process.terminate()- process.wait(timeout=2)-- print()- print("="*70)--except Exception as e:- print(f"ERROR: {e}")- import traceback- traceback.print_exc()--print()-print("Test complete!")diff --git a/packages/mcp-server-revit/src/revit_mcp_server/mcp_server.py b/packages/mcp-server-revit/src/revit_mcp_server/mcp_server.pyindex 8316692..a7ec556 100644--- a/packages/mcp-server-revit/src/revit_mcp_server/mcp_server.py+++ b/packages/mcp-server-revit/src/revit_mcp_server/mcp_server.py@@ -34,7 +34,17 @@ async def list_tools() -> list[Tool]:"type": "object","properties": {},"required": []- }+ # Batch 7: Family Management+ "revit_convert_to_group": ("revit.convert_to_group", {+ "element_ids": arguments.get("element_ids"),+ "name": arguments.get("name")+ }),+ "revit_edit_family": ("revit.edit_family", {+ "family_name": arguments.get("family_name"),+ "family_symbol_id": arguments.get("family_symbol_id"),+ "family_instance_id": arguments.get("family_instance_id")+ }),+ }),Tool(name="revit_create_wall",@@ -818,3 +828,4 @@ if __name__ == "__main__":+diff --git a/scripts/debug-claude-connection.ps1 b/scripts/debug-claude-connection.ps1deleted file mode 100644index 539b6e5..0000000--- a/scripts/debug-claude-connection.ps1+++ /dev/null@@ -1,139 +0,0 @@-Write-Host "`nRevitMCP - Claude Desktop Connection Debugger`n" -ForegroundColor Cyan--# 1. Check config file-Write-Host "[1] Checking Claude Desktop config..." -ForegroundColor Yellow-$configPath = "$env:APPDATA\Claude\claude_desktop_config.json"-if (Test-Path $configPath) {- Write-Host " Config file: EXISTS" -ForegroundColor Green- Write-Host " Location: $configPath" -ForegroundColor Gray-- try {- $config = Get-Content $configPath -Raw | ConvertFrom-Json-- if ($config.mcpServers.revit) {- Write-Host " Revit server: CONFIGURED" -ForegroundColor Green- Write-Host " Command: $($config.mcpServers.revit.command)" -ForegroundColor Gray-- # Test Python path- $pythonPath = $config.mcpServers.revit.command- if (Test-Path $pythonPath) {- Write-Host " Python executable: EXISTS" -ForegroundColor Green- } else {- Write-Host " Python executable: NOT FOUND!" -ForegroundColor Red- Write-Host " Path: $pythonPath" -ForegroundColor Red- }- } else {- Write-Host " Revit server: NOT CONFIGURED" -ForegroundColor Red- }-- # Show full config- Write-Host "`n Current config:" -ForegroundColor Gray- Write-Host ($config | ConvertTo-Json -Depth 10) -ForegroundColor DarkGray-- } catch {- Write-Host " ERROR: Invalid JSON in config file" -ForegroundColor Red- Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Red- }-} else {- Write-Host " Config file: NOT FOUND" -ForegroundColor Red- Write-Host " Expected at: $configPath" -ForegroundColor Red-}--# 2. Test MCP server manually-Write-Host "`n[2] Testing MCP server startup..." -ForegroundColor Yellow-Write-Host " Starting server (will timeout after 3 seconds)..." -ForegroundColor Gray--try {- $job = Start-Job -ScriptBlock {- param($repoPath)- Set-Location $repoPath- python -m revit_mcp_server.mcp_server 2>&1- } -ArgumentList "C:\Users\samo3\OneDrive - Heijmans N.V\Documenten\GitHub\Autodesk-Revit-MCP-Server"-- Start-Sleep -Seconds 3- $output = Receive-Job $job -ErrorAction SilentlyContinue- Stop-Job $job -ErrorAction SilentlyContinue- Remove-Job $job -ErrorAction SilentlyContinue-- if ($output -match "error" -and $output -notmatch "Bridge") {- Write-Host " Status: FAILED" -ForegroundColor Red- Write-Host " Output:" -ForegroundColor Red- Write-Host $output -ForegroundColor Red- } elseif ($output -match "Traceback") {- Write-Host " Status: ERROR" -ForegroundColor Red- Write-Host " Output:" -ForegroundColor Red- Write-Host $output -ForegroundColor Red- } else {- Write-Host " Status: OK (server starts)" -ForegroundColor Green- }-} catch {- Write-Host " Status: ERROR" -ForegroundColor Red- Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Red-}--# 3. Test module import-Write-Host "`n[3] Testing Python module..." -ForegroundColor Yellow-try {- $result = python -c "import sys; sys.path.insert(0, 'packages/mcp-server-revit/src'); from revit_mcp_server.mcp_server import app; print('OK')" 2>&1- if ($result -match "OK") {- Write-Host " Module import: OK" -ForegroundColor Green- } else {- Write-Host " Module import: FAILED" -ForegroundColor Red- Write-Host " Output: $result" -ForegroundColor Red- }-} catch {- Write-Host " Module import: ERROR" -ForegroundColor Red- Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Red-}--# 4. Check MCP package-Write-Host "`n[4] Checking MCP SDK..." -ForegroundColor Yellow-try {- $result = python -c "import mcp; print(mcp.__version__)" 2>&1- if ($result -match "^\d") {- Write-Host " MCP SDK: Installed (v$result)" -ForegroundColor Green- } else {- Write-Host " MCP SDK: NOT INSTALLED" -ForegroundColor Red- Write-Host " Output: $result" -ForegroundColor Red- }-} catch {- Write-Host " MCP SDK: ERROR" -ForegroundColor Red-}--# 5. Suggest fixes-Write-Host "`n[5] Diagnosis & Fixes`n" -ForegroundColor Yellow--$allGood = $true--# Check if config exists-if (-not (Test-Path $configPath)) {- Write-Host "FIX: Config file missing" -ForegroundColor Red- Write-Host "Run: .\setup-claude-desktop.ps1" -ForegroundColor White- $allGood = $false-}--# Check Python path-if (Test-Path $configPath) {- $config = Get-Content $configPath -Raw | ConvertFrom-Json- $pythonPath = $config.mcpServers.revit.command- if (-not (Test-Path $pythonPath)) {- Write-Host "FIX: Python path is wrong" -ForegroundColor Red- Write-Host "Current: $pythonPath" -ForegroundColor Gray- $actualPython = (Get-Command python).Source- Write-Host "Should be: $actualPython" -ForegroundColor Green- Write-Host "Edit: $configPath" -ForegroundColor White- $allGood = $false- }-}--if ($allGood) {- Write-Host "All checks passed!" -ForegroundColor Green- Write-Host "`nNext steps:" -ForegroundColor Yellow- Write-Host "1. RESTART Claude Desktop (completely close and reopen)" -ForegroundColor White- Write-Host "2. Look for 'revit' in the MCP servers list" -ForegroundColor White- Write-Host "3. If still not visible, check Claude Developer Tools:" -ForegroundColor White- Write-Host " View > Toggle Developer Tools > Console tab" -ForegroundColor Gray- Write-Host " Look for errors related to 'revit' or MCP" -ForegroundColor Gray-}--Write-Host ""diff --git a/scripts/dev.ps1 b/scripts/dev.ps1deleted file mode 100644index 82bb255..0000000--- a/scripts/dev.ps1+++ /dev/null@@ -1,10 +0,0 @@-param(- [string]$Workspace = "C:\\RevitProjects",- [string]$Mode = "mock"-)--Set-Item Env:WORKSPACE_DIR $Workspace-Set-Item Env:MCP_REVIT_ALLOWED_DIRECTORIES $Workspace-Set-Item Env:MCP_REVIT_MODE $Mode-Set-Item Env:MCP_REVIT_WORKSPACE_DIR $Workspace-Write-Host "Environment configured. Run: python -m revit_mcp_server"diff --git a/scripts/fresh-setup.ps1 b/scripts/fresh-setup.ps1deleted file mode 100644index a07334a..0000000--- a/scripts/fresh-setup.ps1+++ /dev/null@@ -1,46 +0,0 @@-$ErrorActionPreference = "Stop"--Write-Host "== RevitMCP Local Setup ==" -ForegroundColor Cyan-$RepoDir = (Get-Item -Path $PSScriptRoot\..).FullName-Write-Host "Target: $RepoDir" -ForegroundColor Gray--# 1) Stop common processes-$procNames = @("Revit", "dotnet", "msbuild", "vbcscompiler", "devenv")-foreach ($p in $procNames) {- Get-Process -Name $p -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue-}--# 2) Clean artifacts-# Explicitly remove known build folders first (sometimes git clean fails on locked/permissioned build files)-Write-Host "Removing dist/bin/obj folders..." -ForegroundColor Yellow-$foldersToClean = Get-ChildItem -Path $RepoDir -Recurse -Directory -Force -ErrorAction SilentlyContinue | Where-Object { $_.Name -in "bin","obj","dist" }-foreach ($folder in $foldersToClean) {- Remove-Item $folder.FullName -Recurse -Force -ErrorAction SilentlyContinue-}--# Then git clean for anything else-Write-Host "Cleaning remaining artifacts (git clean -fdx)..." -ForegroundColor Yellow-Set-Location $RepoDir-# Exclude .env, .vscode, AND this script itself (fresh-setup.ps1)-git clean -fdx -e .env -e .vscode -e scripts/fresh-setup.ps1--# 3) Submodules-Write-Host "Updating submodules..." -ForegroundColor Yellow-git submodule update --init --recursive--# 4) Build Add-in-Write-Host "Building Add-in..." -ForegroundColor Yellow-& "$PSScriptRoot\build-addin.ps1" -RevitVersion 2024--# 5) Package-Write-Host "Packaging..." -ForegroundColor Yellow-$version = "1.0.0"-# Try to get version from git tag if available-try {- $gitTag = git describe --tags --abbrev=0- if ($gitTag) { $version = $gitTag -replace "^[vV]", "" }-} catch {}--& "$PSScriptRoot\package.ps1" -Version $version--Write-Host "`n✅ Setup Complete!" -ForegroundColor Greendiff --git a/scripts/run-demo.ps1 b/scripts/run-demo.ps1deleted file mode 100644index b22c050..0000000--- a/scripts/run-demo.ps1+++ /dev/null@@ -1,13 +0,0 @@-param(- [string]$Workspace = "C:\RevitProjects",- [string]$Mode = "mock"-)--Set-Item Env:WORKSPACE_DIR $Workspace-Set-Item Env:MCP_REVIT_WORKSPACE_DIR $Workspace-Set-Item Env:MCP_REVIT_ALLOWED_DIRECTORIES $Workspace-Set-Item Env:MCP_REVIT_MODE $Mode-Set-Item Env:MCP_REVIT_BRIDGE_URL "http://localhost:3000"--Write-Host "Launching Revit MCP server in $Mode mode with workspace $Workspace"-python -m revit_mcp_serverdiff --git a/scripts/setup-claude-desktop.ps1 b/scripts/setup-claude-desktop.ps1deleted file mode 100644index 7d377b6..0000000--- a/scripts/setup-claude-desktop.ps1+++ /dev/null@@ -1,211 +0,0 @@-param(- [switch]$Force-)--$ErrorActionPreference = "Stop"--Write-Host "`n" -NoNewline-Write-Host "="*70 -ForegroundColor Cyan-Write-Host "RevitMCP - Claude Desktop Setup" -ForegroundColor Cyan-Write-Host "="*70 -ForegroundColor Cyan-Write-Host ""--# Check if Claude Desktop is installed-$claudeConfigDir = "$env:APPDATA\Claude"-$claudeConfigFile = "$claudeConfigDir\claude_desktop_config.json"--if (-not (Test-Path $claudeConfigDir)) {- Write-Host "ERROR: Claude Desktop not found!" -ForegroundColor Red- Write-Host ""- Write-Host "Please install Claude Desktop first:" -ForegroundColor Yellow- Write-Host " https://claude.ai/download" -ForegroundColor White- Write-Host ""- exit 1-}--Write-Host "[1/5] Checking prerequisites..." -ForegroundColor Yellow--# Check Python-Write-Host " - Checking Python installation..."-try {- $pythonPath = (Get-Command python -ErrorAction Stop).Source- $pythonVersion = python --version 2>&1- Write-Host " Found: $pythonVersion at $pythonPath" -ForegroundColor Green-} catch {- Write-Host " ERROR: Python not found!" -ForegroundColor Red- exit 1-}--# Check Revit bridge-Write-Host " - Checking Revit bridge add-in..."-$addinFile = "$env:APPDATA\Autodesk\Revit\Addins\2024\RevitBridge.addin"-if (Test-Path $addinFile) {- Write-Host " Found: RevitBridge add-in installed" -ForegroundColor Green-} else {- Write-Host " WARNING: RevitBridge add-in not found at $addinFile" -ForegroundColor Yellow- Write-Host " Make sure the Revit add-in is installed first!" -ForegroundColor Yellow-}--# Install Python package-Write-Host "`n[2/5] Installing RevitMCP Python package..." -ForegroundColor Yellow-Push-Location "$PSScriptRoot\packages\mcp-server-revit"-try {- pip install -e . --quiet- if ($LASTEXITCODE -eq 0) {- Write-Host " Package installed successfully" -ForegroundColor Green- } else {- Write-Host " ERROR: Failed to install package" -ForegroundColor Red- exit 1- }-} finally {- Pop-Location-}--# Create config-Write-Host "`n[3/5] Creating Claude Desktop configuration..." -ForegroundColor Yellow--$config = @{- mcpServers = @{- revit = @{- command = $pythonPath- args = @(- "-m",- "revit_mcp_server.mcp_server"- )- env = @{- MCP_REVIT_WORKSPACE_DIR = "$env:USERPROFILE\Documents"- MCP_REVIT_ALLOWED_DIRECTORIES = "$env:USERPROFILE\Documents"- MCP_REVIT_BRIDGE_URL = "http://127.0.0.1:3000"- MCP_REVIT_MODE = "bridge"- }- }- }-}--# Check if config already exists-$configExists = Test-Path $claudeConfigFile-if ($configExists) {- Write-Host " Existing config found at: $claudeConfigFile" -ForegroundColor Yellow-- if (-not $Force) {- Write-Host ""- Write-Host " Options:" -ForegroundColor Cyan- Write-Host " [B] Backup existing and create new config" -ForegroundColor White- Write-Host " [M] Merge with existing config (add 'revit' server)" -ForegroundColor White- Write-Host " [O] Overwrite existing config" -ForegroundColor White- Write-Host " [C] Cancel" -ForegroundColor White- Write-Host ""- $choice = Read-Host " Choose an option [B/M/O/C]"-- switch ($choice.ToUpper()) {- "B" {- $backupFile = "$claudeConfigFile.backup-$(Get-Date -Format 'yyyyMMdd-HHmmss')"- Copy-Item $claudeConfigFile $backupFile- Write-Host " Backed up to: $backupFile" -ForegroundColor Green- $config | ConvertTo-Json -Depth 10 | Set-Content $claudeConfigFile- }- "M" {- $existing = Get-Content $claudeConfigFile | ConvertFrom-Json- if (-not $existing.mcpServers) {- $existing | Add-Member -MemberType NoteProperty -Name "mcpServers" -Value @{}- }- $existing.mcpServers | Add-Member -MemberType NoteProperty -Name "revit" -Value $config.mcpServers.revit -Force- $existing | ConvertTo-Json -Depth 10 | Set-Content $claudeConfigFile- Write-Host " Merged 'revit' server into existing config" -ForegroundColor Green- }- "O" {- $config | ConvertTo-Json -Depth 10 | Set-Content $claudeConfigFile- Write-Host " Overwritten with new config" -ForegroundColor Green- }- "C" {- Write-Host " Cancelled" -ForegroundColor Yellow- exit 0- }- default {- Write-Host " Invalid choice. Cancelled." -ForegroundColor Red- exit 1- }- }- } else {- # Force mode: backup and overwrite- $backupFile = "$claudeConfigFile.backup-$(Get-Date -Format 'yyyyMMdd-HHmmss')"- Copy-Item $claudeConfigFile $backupFile- Write-Host " Backed up to: $backupFile" -ForegroundColor Green- $config | ConvertTo-Json -Depth 10 | Set-Content $claudeConfigFile- }-} else {- # No existing config, create new- New-Item -ItemType Directory -Path $claudeConfigDir -Force | Out-Null- $config | ConvertTo-Json -Depth 10 | Set-Content $claudeConfigFile- Write-Host " Created new config at: $claudeConfigFile" -ForegroundColor Green-}--# Test MCP server-Write-Host "`n[4/5] Testing MCP server..." -ForegroundColor Yellow-Write-Host " Starting server (will timeout after 3 seconds - this is expected)..."--$testResult = $false-try {- $job = Start-Job -ScriptBlock {- param($pythonPath, $repoRoot)- Set-Location $repoRoot- & $pythonPath -m revit_mcp_server.mcp_server 2>&1- } -ArgumentList $pythonPath, $PSScriptRoot-- Start-Sleep -Seconds 3- $job | Stop-Job- $output = Receive-Job $job- Remove-Job $job-- if ($output -match "error" -and $output -notmatch "Bridge") {- Write-Host " ERROR: Server failed to start" -ForegroundColor Red- Write-Host " Output: $output" -ForegroundColor Red- } else {- Write-Host " Server started successfully (will connect to Revit when needed)" -ForegroundColor Green- $testResult = $true- }-} catch {- Write-Host " ERROR: $($_.Exception.Message)" -ForegroundColor Red-}--# Final instructions-Write-Host "`n[5/5] Setup complete!" -ForegroundColor Green--Write-Host ""-Write-Host "="*70 -ForegroundColor Cyan-Write-Host "NEXT STEPS" -ForegroundColor Cyan-Write-Host "="*70 -ForegroundColor Cyan-Write-Host ""--Write-Host "1. RESTART Claude Desktop" -ForegroundColor Yellow-Write-Host " - Completely close Claude Desktop" -ForegroundColor White-Write-Host " - Reopen it" -ForegroundColor White-Write-Host ""--Write-Host "2. START REVIT" -ForegroundColor Yellow-Write-Host " - Open Revit 2024" -ForegroundColor White-Write-Host " - Open or create a project" -ForegroundColor White-Write-Host " - The RevitMCP Bridge will start automatically" -ForegroundColor White-Write-Host ""--Write-Host "3. VERIFY IN CLAUDE DESKTOP" -ForegroundColor Yellow-Write-Host " - Look for the plug icon in Claude Desktop" -ForegroundColor White-Write-Host " - You should see 'revit' server connected" -ForegroundColor White-Write-Host " - Tools like 'revit_health', 'revit_create_wall', etc. should be available" -ForegroundColor White-Write-Host ""--Write-Host "4. TEST IT OUT" -ForegroundColor Yellow-Write-Host " Try asking Claude:" -ForegroundColor White-Write-Host " > 'Is Revit running? What project is open?'" -ForegroundColor Cyan-Write-Host " > 'Create a 30ft by 25ft house with 10ft tall walls'" -ForegroundColor Cyan-Write-Host ""--Write-Host "="*70 -ForegroundColor Cyan-Write-Host ""--Write-Host "Configuration file: $claudeConfigFile" -ForegroundColor Gray-Write-Host "Full guide: $PSScriptRoot\CLAUDE_DESKTOP_SETUP.md" -ForegroundColor Gray-Write-Host ""--Write-Host "Happy building with Claude + Revit!" -ForegroundColor Green-Write-Host ""diff --git a/scripts/test-mcp-standalone.ps1 b/scripts/test-mcp-standalone.ps1deleted file mode 100644index 5265c89..0000000--- a/scripts/test-mcp-standalone.ps1+++ /dev/null@@ -1,30 +0,0 @@-# Test MCP Server Standalone-# This runs the server exactly how Claude Desktop would run it--Write-Host "`nTesting MCP Server in Claude Desktop Mode`n" -ForegroundColor Cyan--# Set environment variables exactly as Claude Desktop would-$env:MCP_REVIT_WORKSPACE_DIR = "C:\Users\samo3\Documents"-$env:MCP_REVIT_ALLOWED_DIRECTORIES = "C:\Users\samo3\Documents"-$env:MCP_REVIT_BRIDGE_URL = "http://127.0.0.1:3000"-$env:MCP_REVIT_MODE = "bridge"--Write-Host "Environment variables set:" -ForegroundColor Yellow-Write-Host " MCP_REVIT_WORKSPACE_DIR = $env:MCP_REVIT_WORKSPACE_DIR" -ForegroundColor Gray-Write-Host " MCP_REVIT_BRIDGE_URL = $env:MCP_REVIT_BRIDGE_URL" -ForegroundColor Gray-Write-Host " MCP_REVIT_MODE = $env:MCP_REVIT_MODE" -ForegroundColor Gray--Write-Host "`nStarting MCP server..." -ForegroundColor Yellow-Write-Host "Command: python -m revit_mcp_server.mcp_server" -ForegroundColor Gray-Write-Host "`nPress Ctrl+C to stop`n" -ForegroundColor Yellow-Write-Host "="*70 -ForegroundColor Cyan--# Change to repo directory-Set-Location "C:\Users\samo3\OneDrive - Heijmans N.V\Documenten\GitHub\Autodesk-Revit-MCP-Server"--# Run the server-try {- & "C:\Users\samo3\AppData\Local\Programs\Python\Python313\python.exe" -m revit_mcp_server.mcp_server-} catch {- Write-Host "`nERROR: $($_.Exception.Message)" -ForegroundColor Red-}diff --git a/scripts/verify-setup.ps1 b/scripts/verify-setup.ps1deleted file mode 100644index 5bceffb..0000000--- a/scripts/verify-setup.ps1+++ /dev/null@@ -1,102 +0,0 @@-Write-Host "`n"-Write-Host "="*70 -ForegroundColor Cyan-Write-Host "RevitMCP - Setup Verification" -ForegroundColor Cyan-Write-Host "="*70 -ForegroundColor Cyan-Write-Host ""--# 1. Check Revit Bridge-Write-Host "[1/4] Checking Revit Bridge..." -ForegroundColor Yellow-try {- $response = Invoke-RestMethod -Uri "http://localhost:3000/health" -Method GET -TimeoutSec 5- Write-Host " Status: $($response.status)" -ForegroundColor Green- Write-Host " Revit Version: $($response.revit_version)" -ForegroundColor Green- Write-Host " Active Document: $($response.active_document)" -ForegroundColor Green- $bridgeOk = $true-} catch {- Write-Host " ERROR: Cannot connect to Revit bridge" -ForegroundColor Red- Write-Host " Make sure Revit is running with a project open!" -ForegroundColor Yellow- $bridgeOk = $false-}--# 2. Check Claude Desktop Config-Write-Host "`n[2/4] Checking Claude Desktop Configuration..." -ForegroundColor Yellow-$configFile = "$env:APPDATA\Claude\claude_desktop_config.json"-if (Test-Path $configFile) {- $config = Get-Content $configFile | ConvertFrom-Json- if ($config.mcpServers.revit) {- Write-Host " Config file: Found" -ForegroundColor Green- Write-Host " Revit server: Configured" -ForegroundColor Green- Write-Host " Python path: $($config.mcpServers.revit.command)" -ForegroundColor Gray- } else {- Write-Host " WARNING: Revit server not found in config" -ForegroundColor Yellow- }-} else {- Write-Host " ERROR: Config file not found" -ForegroundColor Red-}--# 3. Test MCP Server-Write-Host "`n[3/4] Testing MCP Server..." -ForegroundColor Yellow-try {- $job = Start-Job -ScriptBlock {- param($pythonPath)- cd "C:\Users\samo3\OneDrive - Heijmans N.V\Documenten\GitHub\Autodesk-Revit-MCP-Server"- & $pythonPath -m revit_mcp_server.mcp_server 2>&1- } -ArgumentList "C:\Users\samo3\AppData\Local\Programs\Python\Python313\python.exe"-- Start-Sleep -Seconds 2- $output = Receive-Job $job- Stop-Job $job- Remove-Job $job-- if ($output -match "error" -and $output -notmatch "Bridge") {- Write-Host " ERROR: Server failed" -ForegroundColor Red- } else {- Write-Host " MCP Server: OK (starts correctly)" -ForegroundColor Green- }-} catch {- Write-Host " ERROR: $($_.Exception.Message)" -ForegroundColor Red-}--# 4. Check Python Package-Write-Host "`n[4/4] Checking Python Package..." -ForegroundColor Yellow-try {- $result = python -c "import revit_mcp_server; print('OK')" 2>&1- if ($result -match "OK") {- Write-Host " Package: Installed" -ForegroundColor Green- } else {- Write-Host " ERROR: Package not installed" -ForegroundColor Red- }-} catch {- Write-Host " ERROR: Cannot verify package" -ForegroundColor Red-}--# Summary-Write-Host "`n"-Write-Host "="*70 -ForegroundColor Cyan-Write-Host "SUMMARY" -ForegroundColor Cyan-Write-Host "="*70 -ForegroundColor Cyan-Write-Host ""--if ($bridgeOk) {- Write-Host "Status: READY TO USE!" -ForegroundColor Green- Write-Host ""- Write-Host "Next Steps:" -ForegroundColor Yellow- Write-Host " 1. Open Claude Desktop (or restart if already open)" -ForegroundColor White- Write-Host " 2. Look for the 'revit' server in MCP tools section" -ForegroundColor White- Write-Host " 3. Start chatting!" -ForegroundColor White- Write-Host ""- Write-Host "Try saying:" -ForegroundColor Cyan- Write-Host ' "Is Revit running? What project is open?"' -ForegroundColor White- Write-Host ' "Create a 30ft by 25ft house with 10ft tall walls"' -ForegroundColor White-} else {- Write-Host "Status: Revit Bridge Not Running" -ForegroundColor Yellow- Write-Host ""- Write-Host "To Fix:" -ForegroundColor Yellow- Write-Host " 1. Open Revit 2024" -ForegroundColor White- Write-Host " 2. Open or create a project" -ForegroundColor White- Write-Host " 3. Run this script again to verify" -ForegroundColor White-}--Write-Host ""-Write-Host "="*70 -ForegroundColor Cyan-Write-Host ""