Skip to content

MCP Overview

Truong Giang Vu edited this page May 31, 2026 · 1 revision

AI Tool Integration (MCP)

Model Context Protocol (MCP) integration lets AI assistants and external clients discover and interact with running Revit, AutoCAD, and Civil 3D instances.

Architecture: docs/MCP/README.md

Architecture

RevitDevTool MCP has two parts:

  1. Standalone MCPServerMCPServer.exe runs outside host processes, discovers all running instances, and exposes tools to AI clients via stdio
  2. In-host runtime — each host registers Python/C# toolsets that the server dispatches to via Named Pipe
AI Client (Cursor, Claude, etc.)
  ↓ MCP protocol (stdio)
MCPServer.exe
  ↓ Named Pipe ({Host}_{Version}_{PID})
Host Process (Revit / AutoCAD / Civil 3D)
  ↓ Tool dispatch
Registered toolsets (Python, C#)

Setup

Claude Desktop / Cursor / VS Code

Add to your MCP configuration:

{
  "mcpServers": {
    "revitdevtool": {
      "command": "%APPDATA%/Autodesk/ApplicationPlugins/RevitDevTool.bundle/Contents/MCPServer/DevTools.McpServer.exe"
    }
  }
}

The server auto-discovers all running host instances.

Built-In Tools

Standalone Tools (run without host context)

Tool Description
list_host_instances List all connected Revit/AutoCAD/Civil3D instances
launch_host Launch a new host instance (Revit, AutoCAD, Civil3D)
read_file_info Read file metadata and Revit model basic info
open_model Open a document in a specific host instance

In-Host Tools (dispatched to a running host)

Tool Description
execute_csharp_code Compile and run C# code in the host process
open_document Open a document file in the connected host

Multi-Host Discovery

The server scans Named Pipes matching {Host}_{Version}_{PID}:

Revit_2025_12345    → Revit 2025
AutoCad_2026_7890   → AutoCAD 2026
Civil3D_2026_4444   → Civil 3D 2026
Plant3D_2027_5555   → Plant 3D 2027

AI clients can target a specific instance by host type, version, or PID.

Custom Toolsets

Python Toolsets

Place Python files in mcp_tools/ under your scripts folder:

# mcp_tools/my_tool.py
"""
description: Query walls in the active document
"""

from Autodesk.Revit.DB import FilteredElementCollector, Wall

def run(doc):
    walls = FilteredElementCollector(doc).OfClass(Wall).ToElements()
    return f"Found {len(list(walls))} walls"

C# Toolsets

Compile a .NET assembly with classes implementing the MCP tool interface and place it where the server discovers it.

Supported Toolset Modes

Mode Status Use When
.NET assembly Supported Compiled C# MCP tools
Python 3.13 + PythonNet Supported Modern Python with full ecosystem
IronPython Future IronPython/.NET-style toolsets
C# script Future Script-first C# toolsets
F# script Future Script-first F# toolsets

Toolset Samples

Samples/McpToolsetDemo/     — .NET toolset sample
Samples/RevitMcpToolSet/    — Revit-specific C# tools
Samples/PythonDemo/mcp_tools/ — Python toolset samples

Important Notes

  • In-host dispatch requires a running host with RevitDevTool loaded
  • Python MCP toolsets use the same Python 3.13/PythonNet/Pixi environment as normal script execution
  • Standalone tools (list, launch, read) work without any host running
  • Multiple hosts can be connected simultaneously — the server routes to the correct one

Clone this wiki locally