{
  "markdown": "<div align=\"center\">\n  <img src=\"assets/logo.png\" alt=\"Revit MCP\" width=\"140\" height=\"140\">\n</div>\n\n# Revit MCP - AI-Powered Revit Control\n\nEnglish | [繁體中文](README.zh-TW.md)\n\nRevit MCP lets AI clients call Autodesk Revit tools through the Model Context Protocol (MCP). The MCP server forwards tool calls to a local Revit add-in, and the add-in executes the corresponding Revit API workflow.\n\n- Demo video: [Revit MCP - AI-Powered BIM Workflow Demonstration](https://youtu.be/YpAYF-GxrhA)\n- Knowledge site: <https://shuotao.github.io/REVIT_MCP_study/>\n- Default WebSocket port: `8964`\n\n## What is this?\n\nTalk to Revit in plain language. Ask your AI client to *\"dimension every wall on this view\"* or *\"check the curtain-wall elevations\"*, and Revit does it — through **192 MCP tools** backed by **83 professional BIM SOPs** (building code, quantity take-off, compliance checks).\n\n**Who it's for:** BIM engineers and architects who use Revit and want AI-assisted, standards-based workflows. You'll need Revit (2022–2026) on Windows and to be comfortable installing an add-in.\n\n## Quickstart (3 steps)\n\n1. **Install the Revit add-in.** Build and deploy the C# add-in — see [Manual Setup](#manual-setup). This is the half that actually talks to Revit.\n2. **Point your AI client at the MCP server.** No cloning needed — it runs straight from npm:\n   ```json\n   { \"mcpServers\": { \"revit-mcp\": { \"command\": \"npx\", \"args\": [\"-y\", \"@shuotao/revit-mcp-server\"] } } }\n   ```\n3. **Open Revit, enable the MCP service in the ribbon, and start asking.** Full setup: [AI Client Configuration](#ai-client-configuration).\n\nQuestions or want to show what you built? → **[Discussions](https://github.com/shuotao/REVIT_MCP_study/discussions)**\n\n## Current Project Counts\n\n| Item | Count | Source |\n|---|---:|---|\n| Runtime MCP tools | 192 | `registerRevitTools()` in `MCP-Server/src/tools/index.ts` |\n| Domain SOP files | 83 | `domain/*.md` except `README.md`, plus `domain/references/*.md` |\n| Claude skills | 61 | `.claude/skills/*/SKILL.md` |\n\nWhen these numbers change, update `CLAUDE.md`, `README.zh-TW.md`, this file, `docs/DOCUMENT_AUDIENCE_INVENTORY.md`, and run:\n\n```powershell\n.\\scripts\\verify-qaqc.ps1 -SkipBuild -SkipDeploy\n```\n\n## New: Interactive Clash Viewer (MCP Apps)\n\n`detect_clashes` can now render an interactive clash-review UI inline in the conversation, via the [MCP Apps](https://modelcontextprotocol.io/) extension (`io.modelcontextprotocol/ui`). This requires an MCP host that supports the extension. It is purely additive:\n\n- Interactive rendering only happens in **GUI hosts** that support MCP Apps (Claude Desktop, the claude.ai web app, VS Code GitHub Copilot). A terminal CLI like **Claude Code can't render the panel and always shows the text result — this is expected, not a fault**.\n- Hosts without MCP Apps support keep getting `detect_clashes`'s normal text result — nothing changes for them.\n- The stdio connection and the existing Revit add-in are unaffected; no reinstall or reconfiguration is needed.\n\nSee `docs/MIGRATION_GUIDE.md` for the full MCP 2026-07-28 upgrade notes.\n\n## Architecture\n\n```text\nAI Client\n  Claude Desktop / Claude Code / Gemini CLI / VS Code Copilot / Antigravity\n        |\n        | stdio\n        v\nMCP Server\n  Node.js / TypeScript\n  MCP-Server/build/index.js\n        |\n        | WebSocket ws://localhost:8964\n        v\nRevit Add-in\n  C# / Revit API\n  MCP/Application.cs\n  MCP/Core/SocketService.cs\n  MCP/Core/ExternalEventManager.cs\n        |\n        v\nAutodesk Revit\n```\n\nExternal AI clients do not need an API key inside this repository. Their account and authorization are managed by the AI client itself. Only an embedded Revit chat feature that directly calls an AI API would need an API key.\n\n## Requirements\n\n| Item | Requirement |\n|---|---|\n| OS | Windows 10 or later |\n| Revit | Autodesk Revit 2022, 2023, 2024, 2025, 2026 |\n| .NET | .NET Framework 4.8 for Revit 2022-2024; .NET 8 for Revit 2025-2026 |\n| Node.js | LTS, preferably 20.x or later |\n\n## One-Click Setup\n\nRecommended for new users:\n\n```powershell\n.\\scripts\\setup.ps1\n```\n\nFor AI agents or non-interactive setup:\n\n```powershell\npowershell -ExecutionPolicy Bypass -File scripts/setup.ps1 -NonInteractive -RevitVersions \"2024,2025\"\n```\n\nThe setup script checks prerequisites, installs dependencies, builds the MCP server, builds and deploys the Revit add-in, and helps configure common AI clients.\n\n## Install from MCP Registry\n\nThe MCP server is published on the [MCP Registry](https://registry.modelcontextprotocol.io/) as `io.github.shuotao/revit-mcp-server` (npm package `@shuotao/revit-mcp-server`). Run it directly with:\n\n```bash\nnpx -y @shuotao/revit-mcp-server\n```\n\nNote: this npm package is only the Node stdio bridge. The C# Revit add-in (`MCP/`) must still be installed separately — follow **Manual Setup** below for your Revit version.\n\n## Manual Setup\n\n### 1. Build the MCP Server\n\n```powershell\ncd MCP-Server\nnpm install\nnpm run build\n```\n\nAI clients launch:\n\n```text\nnode MCP-Server/build/index.js\n```\n\n### 2. Build the Revit Add-in\n\nChoose the configuration that matches your Revit version:\n\n```powershell\ncd MCP\ndotnet build -c Release.R22 RevitMCP.csproj   # Revit 2022\ndotnet build -c Release.R23 RevitMCP.csproj   # Revit 2023\ndotnet build -c Release.R24 RevitMCP.csproj   # Revit 2024\ndotnet build -c Release.R25 RevitMCP.csproj   # Revit 2025\ndotnet build -c Release.R26 RevitMCP.csproj   # Revit 2026\n```\n\nExpected output:\n\n```text\nMCP/bin/Release.R{YY}/RevitMCP.dll\n```\n\nExample for Revit 2024:\n\n```text\nMCP/bin/Release.R24/RevitMCP.dll\n```\n\n### 3. Deploy the Add-in\n\nRecommended:\n\n```powershell\n# Pick the Revit version explicitly. With several installed and no -Version, the script asks;\n# in -NonInteractive mode it fails rather than guessing (it never silently picks the highest).\n.\\scripts\\install-addon.ps1 -Version 2024\n\n# Deploy to every installed version that has a matching build\n.\\scripts\\install-addon.ps1 -All\n```\n\nThe script copies **every DLL in the build output** (13 for R22-R24, 8 for R25-R26 — both are correct),\nchecks the build generation matches the target Revit before copying, verifies each file by SHA256\nafterwards, and rotates old backups.\n\nFor manual deployment, place the `.addin` file and DLL under the matching Revit Addins directory, and keep the relative assembly path in `RevitMCP.addin`:\n\n```xml\n<Assembly>RevitMCP\\RevitMCP.dll</Assembly>\n```\n\nDo not create version-specific `.addin` files, and do not hardcode absolute DLL paths.\n\n## AI Client Configuration\n\nProject-level `.mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"revit-mcp\": {\n      \"type\": \"stdio\",\n      \"command\": \"node\",\n      \"args\": [\"./MCP-Server/build/index.js\"],\n      \"env\": {}\n    }\n  }\n}\n```\n\nVS Code config in `.vscode/mcp.json`:\n\n```json\n{\n  \"servers\": {\n    \"revit-mcp\": {\n      \"type\": \"stdio\",\n      \"command\": \"node\",\n      \"args\": [\"${workspaceFolder}/MCP-Server/build/index.js\"],\n      \"env\": {}\n    }\n  }\n}\n```\n\nOther AI clients use the same concept: launch `MCP-Server/build/index.js` with `node`.\n\nConfig template per client:\n\n| AI Client | Config location | Template |\n|---|---|---|\n| Claude Code | project root `.mcp.json` | built in, works out of the box |\n| Claude Desktop | `%APPDATA%\\Claude\\claude_desktop_config.json` | `MCP-Server/claude_desktop_config.json` |\n| Gemini CLI | `~/.gemini/settings.json` | `MCP-Server/gemini_mcp_config.json` |\n| VS Code Copilot | `.vscode/mcp.json` | built in |\n| Antigravity | UI settings | `Antigravity_MCP_Complete_Guide.md` |\n\nReplace `<YOUR_PROJECT_PATH>` in the templates with the actual project path on your machine.\n\n### Switching Between AI Clients\n\nThe Revit-side WebSocket service holds an exclusive lock: only one AI client can be connected at a time. A second client that tries to connect is cleanly rejected (HTTP 409), not swapped in — the first connection stays stable. Multiple AI clients are therefore used by switching, not concurrently:\n\nBefore that lock check even runs, any handshake carrying a browser `Origin` header is rejected outright with HTTP 403. This closes a separate risk: a malicious page open in your browser could otherwise drive the add-in without your knowledge, since WebSocket handshakes aren't covered by the browser's same-origin policy. It has no settings opt-out and does not affect the MCP bridge, which never sends an `Origin` header.\n\n1. In the Revit ribbon, click the **\"切換/釋放連線\" (Switch/Release Connection)** button to release the current connection.\n2. Start or reconnect the other AI client; once its MCP server connects to `localhost:8964`, it takes the lock.\n3. The **\"MCP 設定\"** dialog shows which client currently holds the connection (e.g. `claude-code`, `claude-ai`).\n4. If the connection misbehaves, use the same ribbon button, or restart the MCP service from the Revit ribbon to reset it.\n\n## Startup Flow\n\n1. Start Revit.\n2. Open or create a Revit project.\n3. Enable the MCP service from the Revit ribbon.\n4. Confirm the Revit add-in is listening on `localhost:8964`.\n5. Start or restart the AI client so it loads the MCP server.\n6. Call Revit MCP tools from the AI client.\n\nIf `localhost:8964` is unreachable, Revit may not be running, the MCP service may be off, the port may be occupied, or the AI client and Revit add-in may be using different port settings.\n\n## Project Structure\n\n```text\nREVIT_MCP/\n  MCP/                         Revit Add-in (C#)\n    Application.cs             Revit add-in entry point\n    RevitMCP.csproj            Single multi-version project\n    RevitMCP.addin             Single add-in manifest\n    Core/\n      SocketService.cs         Revit-side WebSocket server\n      ExternalEventManager.cs  UI-thread execution bridge\n      RevitCompatibility.cs    Revit 2022-2026 compatibility helpers\n      CommandExecutor.cs       Main command dispatcher\n      Commands/*.cs            Command modules\n  MCP-Server/                  MCP Server (Node.js / TypeScript)\n    src/index.ts               stdio MCP server entry\n    src/socket.ts              WebSocket client to Revit\n    src/tools/*.ts             MCP tool definitions\n  domain/                      Shared BIM SOPs; do not convert to English-only\n  .claude/                     AI commands and skills\n  docs/                        Human-facing docs and public knowledge site\n  scripts/                     Setup, deployment, QA/QC scripts\n  log/                         Append-only session and commit logs\n```\n\n## AI Docs and Human Docs\n\n| Type | Location | Rule |\n|---|---|---|\n| AI-only | `CLAUDE.md`, `.claude/commands/`, `.claude/skills/` | English-first to avoid mojibake |\n| Human-facing | `README.md`, `README.zh-TW.md`, `docs/`, `scripts/README.md` | Match the reader's language |\n| Shared | `domain/*.md`, `log/README.md` | Domain files must remain Chinese-readable and must not become English-only |\n| Historical | `docs/_archive/**`, old logs | Preserve by default |\n\nSee [docs/DOCUMENT_AUDIENCE_INVENTORY.md](./docs/DOCUMENT_AUDIENCE_INVENTORY.md).\n\n## Domain, Skill, and Tool Responsibilities\n\n- `domain/*.md`: BIM SOPs, regulatory logic, and calculation methods. Shared by humans and AI.\n- `.claude/skills/*/SKILL.md`: AI workflow orchestration.\n- `MCP-Server/src/tools/*.ts`: MCP tool definitions and input schemas.\n- `MCP/Core/Commands/*.cs`: Revit API implementation.\n\nIf a Domain file and a Skill disagree on method, the Domain file wins.\n\n## QA/QC\n\nAfter documentation, tool, Domain, Skill, build, or deployment changes, run:\n\n```powershell\n.\\scripts\\verify-qaqc.ps1 -SkipBuild -SkipDeploy\n```\n\nBefore deployment, run a full check:\n\n```powershell\n.\\scripts\\verify-qaqc.ps1 -Version 2024\n```\n\nQA/QC checks:\n\n- forbidden legacy files and paths\n- required file structure\n- README / CLAUDE / docs count alignment\n- Domain table forward and reverse coverage\n- local Markdown link rot\n- Domain frontmatter\n- document audience classification\n- mojibake risk in canonical docs\n\n## Troubleshooting\n\n### AI cannot find Revit tools\n\nCheck:\n\n1. `npm run build` has been run in `MCP-Server`.\n2. The AI client's MCP config points to the correct `MCP-Server/build/index.js`.\n3. The AI client has been restarted or has reloaded MCP servers.\n\n### MCP Server cannot connect to Revit\n\nCheck:\n\n1. Revit is running.\n2. The MCP service is enabled in the Revit ribbon.\n3. `localhost:8964` is not occupied.\n4. If HTTP.sys / PID 4 is holding the port, try:\n\n```powershell\npowershell -ExecutionPolicy Bypass -File scripts\\release-port.ps1\n```\n\n### Revit does not show the MCP Tools panel\n\nConfirm the `.addin` file and DLL were deployed under the matching `%APPDATA%\\Autodesk\\Revit\\Addins\\{version}` directory, then restart Revit.\n\n## Important Rules\n\n- Keep one `MCP/RevitMCP.csproj`.\n- Keep one `MCP/RevitMCP.addin`.\n- Do not create version-specific `.csproj` or `.addin` files.\n- Do not create nested `MCP/MCP/` directories.\n- Do not change `.addin` `<Assembly>` to an absolute path.\n- Do not convert Domain files to English-only.\n- Do not bypass the MCP server with hand-written WebSocket JSON.\n- For live Revit view, level, selection, or document state, AI must query live state in the current turn.\n\n## Document Navigation\n\n| Document | Purpose |\n|---|---|\n| [CLAUDE.md](./CLAUDE.md) | Main AI agent constitution and project map |\n| [AGENTS.md](./AGENTS.md) | Redirect to `CLAUDE.md` |\n| [GEMINI.md](./GEMINI.md) | Redirect to `CLAUDE.md` |\n| [README.zh-TW.md](./README.zh-TW.md) | Traditional Chinese README |\n| [CONTRIBUTING.md](./CONTRIBUTING.md) | Contribution guide |\n| [CHANGELOG.md](./CHANGELOG.md) | Release history |\n| [domain/README.md](./domain/README.md) | Domain SOP catalog |\n| [domain/lessons.md](./domain/lessons.md) | Project lessons |\n| [.claude/skills/](./.claude/skills/) | AI skills |\n| [.claude/commands/](./.claude/commands/) | AI slash commands |\n| [scripts/README.md](./scripts/README.md) | Script documentation |\n| [docs/DOCUMENT_AUDIENCE_INVENTORY.md](./docs/DOCUMENT_AUDIENCE_INVENTORY.md) | Document audience inventory |\n| [docs/DOCS_STRUCTURE.md](./docs/DOCS_STRUCTURE.md) | Docs directory guide |\n| [log/README.md](./log/README.md) | Log append rules |\n\n## License\n\nMIT License\n",
  "bytes": 14144,
  "sha": "30ff0b41ea48671d2c16642ae0a542cb52b3563bd63a4f377776600837551b5a",
  "repo_slug": "shuotao/revit_mcp_study",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_shuotao_revit_mcp_server_1cac5ce7/readme"
}