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
docs: condense README content, simplify introduction, and streamline quick start guides.
A. Sam Mohammad07d44f5dfba1
diff --git a/README.md b/README.mdindex baa1775..0fde4a1 100644--- a/README.md+++ b/README.md@@ -2,411 +2,168 @@# ποΈ Revit MCP Bridge-### **Connect AI Agents to Autodesk Revit**--Automate Revit workflows through the Model Context Protocol - from Python, TypeScript, or any MCP client+**Control Autodesk Revit from AI agents, Python scripts, or any MCP client**<br/><p align="center">- <img src="https://seeklogo.com/images/A/autodesk-revit-logo-0BEB642AE2-seeklogo.com.png" alt="Autodesk Revit" height="80"/>- - <strong style="font-size: 2em;">Γ</strong>- - <img src="https://www.python.org/static/community_logos/python-logo-generic.svg" alt="Python" height="80"/>- - <strong style="font-size: 2em;">Γ</strong>- - <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/bd/Logo_C_sharp.svg/256px-Logo_C_sharp.svg.png" alt="C#" height="80"/>+ <img src="https://cdn.worldvectorlogo.com/logos/autodesk-revit.svg" alt="Revit" height="60"/>+ + <span style="font-size: 2em;">β</span>+ + <img src="https://www.vectorlogo.zone/logos/python/python-icon.svg" alt="Python" height="60"/>+ + <img src="https://cdn.worldvectorlogo.com/logos/c--4.svg" alt="C#" height="60"/></p><br/>-[](https://github.com/Sam-AEC/mcp/actions)-[](LICENSE)-[](https://github.com/Sam-AEC/mcp/releases)-[](https://www.autodesk.com/products/revit/)-[](https://www.python.org/)-[](https://docs.microsoft.com/en-us/dotnet/csharp/)+[](https://github.com/Sam-AEC/mcp/actions)+[](LICENSE)+[](https://autodesk.com/revit)+[](https://python.org)+[](https://dotnet.microsoft.com)</div>----## π― What Is This?--A production-ready bridge that exposes **Autodesk Revit** as a Model Context Protocol (MCP) server. This enables:--- **π€ AI Agents** - Let Claude Desktop, ChatGPT, or custom agents control Revit-- **π Python Automation** - Script Revit workflows without .NET complexity-- **π CI/CD Integration** - Run QA checks, exports, and reports in pipelines-- **βοΈ Cloud Workflows** - Trigger Revit operations from web apps or serverless functions+## What It Does-**Three Components:**+Exposes **25 Revit operations** through the Model Context Protocol. Use it with:+- π€ AI agents (Claude, ChatGPT, custom tools)+- π Python/TypeScript automation+- π CI/CD pipelines+- βοΈ Cloud workflows-1. **MCP Server** (Python) - Exposes 25 Revit tools with validation and sandboxing-2. **Bridge Add-in** (C# .NET 4.8) - Runs inside Revit, executes API operations-3. **Demo Client** (Python) - Example automation showing health checks, exports, QA audits+**Components:**+- **MCP Server** (Python) β Validates requests, enforces sandboxing, logs everything+- **Bridge Add-in** (C# .NET) β Runs inside Revit, executes API calls via ExternalEvent+- **Mock Mode** β Test without Revit (perfect for CI)----## π Why This Exists--### The Problem-Revit's API is powerful but locked to .NET and Windows. Building modern automation requires:-- Complex Python β .NET interop (pythonnet, COM, or process boundaries)-- Windows-specific deployment (no Linux CI/CD)-- Manual thread marshalling (Revit API requires UI thread)-- Custom protocols for every integration--### The Solution-This bridge provides a **standard interface** using the Model Context Protocol:--β **Mock Mode** - Test without Revit (Linux CI, local dev, unit tests)-β **Workspace Sandboxing** - File operations restricted to allowed directories-β **Schema Validation** - All inputs validated with Pydantic before execution-β **Audit Logging** - Structured JSONL logs track every operation-β **Language Agnostic** - MCP clients exist for Python, TypeScript, Rust, Go+## Quick Start-**Use Cases:**-- AI agents that query Revit models and generate reports-- Automated QA checks on every commit (naming standards, parameter compliance)-- Scheduled exports (schedules, quantities, PDFs) to shared drives-- Multi-model workflows (compare baselines, batch processing)-------## β‘ Quick Start (Mock Mode)--Run the complete workflow **without Revit or Windows**. Perfect for development, testing, and CI/CD.+### Mock Mode (No Revit Required)```bash-# Clone and setup-git clone https://github.com/Sam-AEC/mcp.git-cd mcp-python -m venv venv-source venv/bin/activate # Windows: venv\Scripts\activate--# Install+git clone https://github.com/Sam-AEC/mcp.git && cd mcp+python -m venv venv && source venv/bin/activatepip install -e packages/mcp-server-revit[dev]-# Configure mock mode-export MCP_REVIT_MODE=mock-export WORKSPACE_DIR="$(pwd)/workspace"-export MCP_REVIT_ALLOWED_DIRECTORIES="$(pwd)/workspace"-mkdir -p workspace+export MCP_REVIT_MODE=mock WORKSPACE_DIR="$(pwd)/workspace"+mkdir -p workspace && pytest packages/mcp-server-revit/tests -v-# Verify-pytest packages/mcp-server-revit/tests -v--# Run server (terminal 1)-python -m revit_mcp_server--# Run demo (terminal 2)-python packages/client-demo/demo.py-```--**Expected Output:**-```json-{"status": "healthy", "mode": "mock"}-{"document_id": "sample_model", "title": "sample_model.rvt"}-{"categories_exported": 5, "output_path": "workspace/quantities.csv"}+python -m revit_mcp_server # Terminal 1+python packages/client-demo/demo.py # Terminal 2```-Check `workspace/audit.jsonl` for structured logs.-------## πͺ Quick Start (Bridge Mode)--Connect to a **real Revit instance** for production workflows.--**Prerequisites:**-- Windows 10/11-- Revit 2020-2024-- Visual Studio 2019+ or MSBuild-- Python 3.11++### Bridge Mode (Windows + Revit)```powershell-# Setup Python (same as mock mode)-git clone https://github.com/Sam-AEC/mcp.git-cd mcp-python -m venv venv-venv\Scripts\activate-pip install -e packages/mcp-server-revit[dev]--# Build Revit add-in+# After mock setup above...$env:REVIT_SDK = "C:\Program Files\Autodesk\Revit 2024\SDK".\scripts\build-addin.ps1--# Install add-in.\scripts\install-addin.ps1 -RevitYear 2024-# Start Revit (bridge auto-loads on localhost:3000)--# Configure bridge mode+# Start Revit, then:$env:MCP_REVIT_MODE = "bridge"-$env:MCP_REVIT_BRIDGE_URL = "http://localhost:3000"-$env:WORKSPACE_DIR = "C:\revit-workspace"-$env:MCP_REVIT_ALLOWED_DIRECTORIES = "C:\revit-workspace"-mkdir C:\revit-workspace -ErrorAction SilentlyContinue--# Run-python -m revit_mcp_server # Terminal 1-python packages/client-demo/demo.py # Terminal 2-```--**Expected Output:**-```json-{"status": "healthy", "mode": "bridge", "revit_version": "2024"}-// Real Revit operations execute-// Files saved to C:\revit-workspace\+python -m revit_mcp_server```----## π οΈ Available Tools (25 Total)+## Tools (25)-### π Document Operations-```python-revit.health # Bridge connectivity check-revit.open_document # Open .rvt or .rfa files-revit.list_views # Enumerate all views-```+| Category | Tools |+|----------|-------|+| **Health** | `revit.health` |+| **Documents** | `open_document`, `list_views` |+| **QA Audits** | `model_health_summary`, `warning_triage`, `naming_standards`, `parameter_compliance`, `shared_params`, `view_templates`, `tag_coverage`, `room_completeness`, `link_monitor`, `coordinate_check` |+| **Exports** | `schedules`, `quantities`, `pdf`, `dwg`, `ifc` |+| **Sheets** | `batch_create`, `place_views`, `titleblock_fill` |+| **Baseline** | `export`, `diff` |-### π QA & Audits (10 Tools)-```python-revit.model_health_summary # Overall health metrics-revit.warning_triage_report # Categorize warnings-revit.naming_standards_audit # Validate naming conventions-revit.parameter_compliance_audit # Check required parameters-revit.shared_parameter_binding_audit # Verify shared params-revit.view_template_compliance_check # Audit view templates-revit.tag_coverage_audit # Find untagged elements-revit.room_space_completeness_report # Room/space validation-revit.link_monitor_report # Linked file status-revit.coordinate_sanity_check # Project coordinates-```+[Full docs β](docs/tools.md)-### π€ Export Operations-```python-revit.export_schedules # Schedules β CSV-revit.export_quantities # Material takeoffs β CSV-revit.export_pdf_by_sheet_set # Batch PDF export-revit.export_dwg_by_sheet_set # Batch DWG export-revit.export_ifc_named_setup # IFC with custom settings-```+----### π Sheet Automation-```python-revit.batch_create_sheets_from_csv # Bulk sheet creation-revit.batch_place_views_on_sheets # Automated view placement-revit.titleblock_fill_from_csv # Populate titleblock data-```+## Example: AI QA Agent-### π Baseline Tracking```python-revit.baseline_export # Snapshot model state-revit.baseline_diff # Compare two snapshots-```--**Full documentation:** [docs/tools.md](docs/tools.md)-----+# Agent checks Revit model for issues+response = client.call_tool("revit.open_document", {+ "file_path": "/workspace/hospital.rvt"+})-## ποΈ Architecture+warnings = client.call_tool("revit.warning_triage_report", {})+# β {"issues_found": 42, "severity": "warning"}+naming = client.call_tool("revit.naming_standards_audit", {})+# β Agent generates report with fixes```-βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ-β AI Agent / Automation Script β-β (Claude Desktop, Python, TypeScript, cron jobs) β-ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ- β MCP Protocol (stdio JSON-RPC)-ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ-β MCP Server (Python 3.11+) β-β ββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββ β-β β Pydantic β β Workspace β β Audit Logger β β-β β Validation β β Sandbox β β (JSONL) β β-β ββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββ β-β β-β Mode: Mock (CI/testing) OR Bridge (production Revit) β-ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ- β HTTP POST (localhost:3000)-ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ-β Revit Bridge Add-in (C# .NET 4.8) β-β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β-β β HttpListener β ExternalEvent Queue β Revit API β β-β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β-ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ- β Revit API (.NET Framework 4.8)-ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββ-β Autodesk Revit (2020, 2021, 2022, 2023, 2024) β-β Document operations β’ Exports β’ QA metrics β-βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ-```--**Design Decisions:**--| Decision | Reason |-|----------|--------|-| **Python MCP Server** | MCP ecosystem is Python/TS, easier client integration |-| **HTTP Bridge** | Clean process boundary, debuggable (curl/Postman) |-| **ExternalEvent** | Revit API requires UI thread execution |-| **Mock Mode** | CI/CD on Linux without Revit dependency |-| **localhost-only** | No external exposure, simple security model |--**Deep dive:** [docs/architecture.md](docs/architecture.md)----## π Security--<table>-<tr>-<td width="50%">+## Architecture-**Workspace Sandboxing**-- All file paths validated against allowed directories-- Path traversal attacks blocked (`../../../etc/passwd`)-- Symbolic links resolved and validated--</td>-<td width="50%">--**Schema Validation**-- Pydantic models enforce types and constraints-- Invalid inputs rejected before execution-- Clear error messages for debugging--</td>-</tr>-<tr>-<td>--**Audit Logging**-- JSONL format with timestamps and request IDs-- Records inputs, outputs, file artifacts-- Tamper-evident chronological ordering--</td>-<td>--**Safe Defaults**-- Mock mode for CI/CD (no Revit needed)-- Bridge binds to `127.0.0.1` only-- No external network exposure--</td>-</tr>-</table>--**Details:** [docs/security.md](docs/security.md)-----+```+AI Agent/Script+ β (MCP stdio)+Python Server (validation, sandboxing, logging)+ β (HTTP localhost:3000)+C# Bridge Add-in (ExternalEvent queue)+ β (Revit API)+Autodesk Revit+```-## π Documentation+**Why?** Revit API needs .NET + Windows + UI thread. This bridge handles complexity while exposing simple JSON tools.-| Guide | Description |-|-------|-------------|-| [Installation](docs/install.md) | Mock mode, bridge mode, troubleshooting |-| [Tool Catalog](docs/tools.md) | All 25 tools with schemas and examples |-| [Architecture](docs/architecture.md) | Design decisions, trust boundaries |-| [Security](docs/security.md) | Sandboxing, validation, audit logs |-| [Contributing](CONTRIBUTING.md) | How to add tools and submit PRs |+[Architecture docs β](docs/architecture.md)----## πΊοΈ Roadmap--**v0.2.0 - Real Revit Integration**-- [ ] Implement actual Revit API calls in bridge (currently stubs)-- [ ] ExternalEvent queue processing with error handling-- [ ] Async HTTP client for parallel operations+## Security-**v0.3.0 - Enhanced Tools**-- [ ] More QA tools (circulation analysis, clash detection)-- [ ] Enhanced sheet automation (view placement optimization)-- [ ] Batch document processing (folder-level operations)+β Workspace sandboxing (paths validated)+β Schema validation (Pydantic)+β Audit logs (JSONL with timestamps)+β Mock mode (CI without Revit)+β localhost-only (no external exposure)-**Future**-- [ ] Dynamo integration for visual programming workflows-- [ ] Revit Server and BIM 360 cloud model support-- [ ] Navisworks export tool-- [ ] Optional telemetry (disabled by default, opt-in)+[Security docs β](docs/security.md)----## π€ Contributing+## Use Cases-Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.--**High-impact contributions:**-- Implement real Revit API operations in bridge (replace stubs)-- Add new tools (e.g., `revit.export_navisworks`, `revit.create_3d_view`)-- Improve test coverage-- Add more QA audit tools+**Automated QA** β Run naming/parameter checks on every commit+**Scheduled Exports** β Nightly schedule/quantity exports to shared drives+**AI Workflows** β Let agents analyze models and suggest fixes+**Baseline Tracking** β Compare model snapshots over time----## π‘ Example Use Cases--**1. Automated QA on Pull Requests**-```yaml-# .github/workflows/revit-qa.yml-- run: python -m revit_mcp_server --tool revit.naming_standards_audit-- run: python -m revit_mcp_server --tool revit.parameter_compliance_audit-```--**2. Scheduled Export Job**-```python-# Export all schedules to CSV every night-client.call_tool("revit.export_schedules", {- "output_path": "/exports/schedules-2025-01-07.csv"-})-```--**3. AI Agent Workflow**-```-User: "Check this Revit model for warnings and generate a report"-Agent: β revit.open_document- β revit.warning_triage_report- β Generates markdown report with findings-```+## Roadmap-**4. Baseline Comparison**-```python-# Track model changes over time-baseline_v1 = client.call_tool("revit.baseline_export", {...})-baseline_v2 = client.call_tool("revit.baseline_export", {...})-diff = client.call_tool("revit.baseline_diff", {- "baseline_a": baseline_v1,- "baseline_b": baseline_v2-})-```+**Next (v0.2):** Real Revit API calls (currently stubs), async HTTP, error handling+**Later:** More QA tools, Dynamo integration, Navisworks export, BIM 360 support----## π License--MIT License - see [LICENSE](LICENSE)+## Docs-Copyright (c) 2025 MCP Revit Bridge Contributors+[Install](docs/install.md) β’ [Tools](docs/tools.md) β’ [Architecture](docs/architecture.md) β’ [Security](docs/security.md) β’ [Contributing](CONTRIBUTING.md)----## π Acknowledgments+## License-- **Autodesk** for the Revit API-- **Anthropic** for the Model Context Protocol specification-- Built with [mcp-use](https://github.com/mcp-use/mcp-use) framework-- Python and .NET open-source communities-----+MIT β’ Built with [mcp-use](https://github.com/mcp-use/mcp-use) framework<div align="center">-**β Star this repo if you find it useful!**--[Report Bug](https://github.com/Sam-AEC/mcp/issues) β’ [Request Feature](https://github.com/Sam-AEC/mcp/issues) β’ [Discussions](https://github.com/Sam-AEC/mcp/discussions)+β **Star if useful** β’ [Report Bug](https://github.com/Sam-AEC/mcp/issues) β’ [Request Feature](https://github.com/Sam-AEC/mcp/issues)</div>