Author: Sanjay Chauhan | GitHub
Natural language control of Revit models through Claude AI and the Model Context Protocol (MCP)
A native Revit plugin that provides a chat interface for controlling your BIM model using natural language. Built on Anthropic's Model Context Protocol with full conversation context and session persistence.
Example interactions:
- "Duplicate Level 1 and place it on a new sheet"
- "Find all walls longer than 20 feet"
- "List all grids" → "Hide them" (remembers context)
- "Calculate total conduit length by size"
Three-layer architecture connecting Revit to Claude AI:
- Revit Plugin (C# .NET 4.8) – WPF chat panel, WebSocket client, tool execution, model indexing
- MCP Server (Node.js/TypeScript) – WebSocket orchestration, Claude API integration, conversation management
- Claude AI (Anthropic) – Natural language processing, tool selection, response generation
- User types command in Revit chat panel
- Plugin sends WebSocket message with model context (views, levels, selection)
- Server forwards to Claude with conversation history and available tools
- Claude selects appropriate tools and returns execution plan
- Server sends commands back to plugin
- Plugin executes via ExternalEvent (thread-safe)
- Results return to Claude for natural language response
- Persistent WebSocket during active use
- Auto-disconnect after 15 minutes idle (prevents rate limiting)
- Auto-reconnect on next message
- Real-time connection status indicator
|
|
- Maintains last 20 messages
- Tracks session state (selection, cached queries)
- Includes model context (active view, level)
- Smart pronoun resolution ("hide them" after "list grids")
- Thread-safe – ExternalEvent pattern for Revit API calls
- Atomic transactions – Multi-step operations succeed or fail as one unit
- Composable tools – Inheritance-based design for easy extension
- Session persistence – SQLite-backed conversation history
- Performance optimized – Prompt caching reduces tokens from ~5000 to ~200 per request
- Automatic resource cleanup (WebSocket, GDI handles, timers)
- Connection resilience with auto-reconnect
- Comprehensive error logging with timestamps
- Race condition prevention
- Memory-efficient design
- Autodesk Revit 2024
- Node.js 18.0+
- Anthropic API key
1. Clone repository
git clone https://github.com/schauh11/revit-mcp-server.git
cd revit-mcp-server2. Configure MCP server
cd mcp-server
npm install
cp .env.example .env
# Edit .env and add your CLAUDE_API_KEY3. Build plugin
- Open
RevitPlugin/RevitPlugin.csprojin Visual Studio - Build in Release mode
- Copy
RevitPlugin.dllandRevitMCP.addinto:
C:\ProgramData\Autodesk\Revit\Addins\2024\
- Edit
RevitMCP.addinwith correct DLL path
4. Launch
- Open Revit
- Find "pySC Chat" in Add-Ins ribbon
- Click "Start Server"
"List all the walls"
→ Returns walls grouped by type
"List all grids"
→ Shows grids with IDs
"Hide them"
→ Hides grids (remembers context)
"Find all walls longer than 20 feet"
→ Stores 35 walls in session
"Which is the longest?"
→ Returns 81.0 ft wall from cache
"Duplicate Level 2 and place on sheet A221"
→ Executes: duplicate view + create sheet + place viewport
(single atomic transaction)
"Timeout: No response after 90 seconds"
- Verify server is running (console: "Server listening on port 3000")
- Check
CLAUDE_API_KEYin.env - Review rate limits at console.anthropic.com
"Auto-disconnected due to inactivity"
- Normal after 15 minutes idle
- Send any message to reconnect
"Failed to connect to MCP server"
- Click "Start Server" in panel
- Check port 3000 availability
- Restart Revit if needed
Slow responses (>20s)
- First request includes model indexing
- Subsequent requests use cache
- Check internet connection
revit-mcp-server/
├── RevitPlugin/ # C# plugin
│ ├── Commands/ # App lifecycle
│ ├── UI/ # WPF chat panel
│ ├── Services/ # WebSocket, tools, indexing
│ └── Helpers/ # Utilities
├── mcp-server/ # TypeScript server
│ ├── src/
│ │ ├── index.ts
│ │ ├── websocketHandler.ts
│ │ ├── claudeClient.ts
│ │ └── logger.ts
│ └── tools.json # Tool definitions
└── docs/ # Diagrams
Contributions welcome. Open an issue before major changes.
MIT License – see LICENSE
Free to use, modify, and distribute.
- Anthropic Claude – Claude Haiku 4.5
- Revit API – BIM automation
- Model Context Protocol – Tool orchestration



