MCP server for Revit - Python
This MCP server connects AI clients to Autodesk Revit, letting you inspect, visualize, and modify Revit models, run IronPython code, and manage Revit installations and documents.
Status & model info: check API health (
get_revit_status), get model details (get_revit_model_info), list levels and family categories.Views & images: list exportable views, export a view as an image, and inspect the active view (info and visible elements with optional levels/locations).
Families: list available family types (filterable), list categories, and place family instances at a given XYZ with rotation, type, level, and custom properties.
Visualization: color elements by parameter value (distinct or gradient/custom colors), clear color overrides, and list parameters available per category.
Code execution: run arbitrary IronPython in the Revit context with access to
doc,uidoc,DB, andrevit.Launch & documents: discover installed Revit versions, launch Revit (optionally with a file) and wait for readiness, open documents (with detach/audit), close, Save/Save As, and sync workshared models with central.
Provides tools for interacting with Autodesk Revit, enabling AI agents to manage Revit models, elements, views, and perform actions like placing families, exporting views, and executing Revit code.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP server for Revit - Python list all levels in the project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP server for Revit - Python
A pyRevit-oriented implementation of the Model Context Protocol (MCP) for Autodesk Revit
Related MCP server: revit-mcp
Local pairing and Autodesk Marketplace publication
This project is being prepared for Autodesk Marketplace review; it is not yet certified. The review candidate retains all 20 tools, including Python execution. See publication requirements and outstanding gates, privacy information, and security boundaries.
After installing the pyRevit extension, choose MCP > Bridge > Connect in Revit to consent and create an encrypted pairing secret for your Windows user. Choose Disconnect to revoke it. Requests that change models and Python execution show their payload for review in Revit before proceeding. Pairing also permits local Revit discovery and launch. Pairing is shared across Revit instances for the same Windows user; select the correct Routes port before connecting.
The MCP-to-Revit bridge accepts only loopback hosts. Remote VM/LAN HTTP bridges are
rejected. Optional HTTP MCP transports require a paired bearer header; stdio is
the recommended publication transport and needs no token in client configuration.
Do not expose either listener to a network, tunnel or the internet.
How?
This minimal implementation leverages the Routes module inside pyRevit to create a bridge between Revit and Large Language Models (LLMs).
It provides a straightforward template to get started quickly, letting you prototype and iterate tools to give LLMs access to your Revit models.
These tools are designed to be expanded for your specific use cases. You're very welcome to fork the repo and make your own contributions.
Note: The pyRevit Routes API is currently in draft form and subject to change. This extension authenticates its own routes using Windows-user pairing. Other pyRevit routes/extensions remain outside this protection; review pyRevit server binding and the security document.
Batteries Included
This repo is aimed at:
Beginners to the Revit API
Python specialists who aren't versed in C#
Anyone wanting to prototype and iterate quickly with LLMs and Revit
It contains:
A complete Routes implementation for pyRevit
A minimal MCP server script to connect to any MCP-compatible client
Several test commands to get you started right away
Key Architecture Components
The system runs as two separate servers working together in a chain:
Claude / LLM Client
|
| MCP Protocol (stdio or HTTP)
v
main.py (MCP Server)
|
| HTTP requests (localhost:48884)
v
pyRevit Routes (REST API running inside Revit)
|
| Revit API calls
v
Revit Applicationmain.py is the MCP server. It speaks the MCP protocol so that Claude (or any MCP-compatible client) can call tools. When a tool is called, main.py translates it into an HTTP request and forwards it to Revit.
pyRevit Routes is a lightweight REST API that runs inside the Revit process. It receives those HTTP requests, executes Revit API code (since it has direct access to the running instance), and returns JSON responses.
They never conflict because they serve different roles, speak different protocols, and listen on different ports.
Note: The Launch & Document tools (
launch_revit,list_revit_installations) are the exception — they run entirely on the MCP side, usingsubprocessto start Revit and then polling the pyRevit Routes health endpoint until the bridge is ready.
MCP Server (
main.py):
Built with FastMCP
Handles HTTP communication with Revit Routes API
Registers tools from modular tool system
Provides helper functions for GET/POST/Image requests
pyRevit Extension (
revit-mcp-python.extension/):
Contains the Routes API that runs inside Revit
Modular route registration in
startup.pyIndividual route modules in
revit_mcp/directory
Tool Registration System (
tools/):
Modular tool organization by functionality
Central registration through
tools/__init__.pyEach module registers its own tools with the MCP server
Supported Tools
Current Implementation Status
Tool Name | Status | Category | Description |
| ✅ Implemented | Status & Connectivity | Check if the Revit-MCP API is active and responding |
| ✅ Implemented | Model Information | Get comprehensive information about the current Revit model |
| ✅ Implemented | Model Information | Get all levels with elevation information |
| ✅ Implemented | View & Image | Export a specific Revit view as an image |
| ✅ Implemented | View & Image | Get a list of all exportable views organized by type |
| ✅ Implemented | Family & Placement | Place a family instance at specified location with custom properties |
| ✅ Implemented | Family & Placement | Get a flat list of available family types (with filtering) |
| ✅ Implemented | Family & Placement | Get a list of all family categories in the model |
| ✅ Implemented | View Information | Get detailed information about the currently active view |
| ✅ Implemented | View Information | Get all elements visible in the current view |
| 🔄 Pending | Element Creation | Create point-based elements (doors, windows, furniture) |
| ✅ Implemented | Visualization | Color elements based on parameter values |
| ✅ Implemented | Visualization | Remove view color overrides |
| ✅ Implemented | Visualization | List category parameters and sample values |
| ✅ Implemented | Code Execution | Execute IronPython code directly in Revit context |
| ✅ Implemented | Launch & Document | Discover all Revit versions installed on the system |
| ✅ Implemented | Launch & Document | Launch Revit, optionally with a file, and poll for readiness |
| ✅ Implemented | Launch & Document | Open a document in running Revit (supports detach and audit) |
| ✅ Implemented | Launch & Document | Close the active document |
| ✅ Implemented | Launch & Document | Save or Save As the active document |
| ✅ Implemented | Launch & Document | Synchronize a workshared document with central |
| 🔄 Pending | Selection Management | Get information about currently selected elements |
| 🔄 Pending | Element Creation | Create line-based elements (walls, beams, pipes) |
| 🔄 Pending | Element Creation | Create surface-based elements (floors, ceilings) |
| 🔄 Pending | Element Management | Delete specified elements from the model |
| 🔄 Pending | Element Management | Modify element properties (instance parameters) |
| 🔄 Pending | Element Management | Reset model by deleting process model elements |
| 🔄 Pending | Annotation | Tag all walls in the current view |
| 🔄 Pending | Integration | Search for available modules/addins |
| 🔄 Pending | Integration | Execute functionality from external modules |


Getting Started
Installing uv:
Refer to ./README_UV.md
Installing the Extension on Revit
Activate pyRevit Routes
In Revit, navigate to the pyRevit tab
Open Settings
Go to
Routes> activateRoutes ServerpyRevit will start listening on porthttp://localhost:48884/
Install from pyRevit:
In Revit, navigate to the pyRevit tab
Open Extensions
Select the MCP Server for Revit Python Extension > Install extension
Select location, default is
%APPDATA%\Roaming\pyRevit\ExtensionsEnable and wait for pyRevit to reload. Restart Revit if necessary.
Manual Installation on a custom directory:
Clone the repo in a custom location:
git clone https://github.com/mcp-servers-for-revit/mcp-server-for-revit-pythonAdd
.extensionto the root folder nameIn Revit, navigate to the pyRevit tab
Open Settings
Under "Custom Extensions", add the path to the
.extensionfolderSave settings and reload pyRevit (you might need to restart Revit entirely)
Testing Your Connection
Once installed, test that the Routes API is working:
Choose MCP > Bridge > Connect in Revit, then run this authenticated check from the exact candidate directory (a browser request has no pairing header and is denied):
uv run --frozen python -c "import anyio; from main import revit_get; print(anyio.run(revit_get, '/status/'))"If successful, you should see a response like:
{"status": "active", "health": "healthy", "revit_available": true, "document_title": "your_revit_filename", "api_name": "revit_mcp"}
The Routes Service will now load automatically whenever you start Revit. To disable it, simply remove the extension path from the pyRevit settings.
Using the MCP Client
Testing with the MCP Inspector
The MCP SDK includes a handy inspector tool for debugging:
mcp dev main.pyThen access http://127.0.0.1:6274 in your browser to test your MCP server interactively.
Transport Modes
The MCP server supports multiple transport modes for different use cases:
Flag | Transport | Endpoints | Use Case |
(none) | stdio | stdin/stdout | Claude Desktop / Claude Code default |
| SSE only |
| Legacy clients |
| HTTP only |
| Modern HTTP clients |
| Both | All above | Maximum compatibility |
Running with combined transport (recommended for HTTP):
uv run --frozen main.py --combinedAfter pairing, this starts the authenticated server on http://127.0.0.1:8000 with both SSE and streamable-HTTP endpoints available.
The following unpaired requests return HTTP 401. HTTP clients must include the header returned by revit_mcp.pairing.authorization_headers(); prefer stdio to avoid copying a secret into client configuration.
Testing the endpoints:
# Test streamable-http
curl -X POST http://localhost:8000/mcp
# Test SSE
curl http://localhost:8000/sseConnecting to Claude Desktop
The simplest way to install your MCP server in Claude Desktop:
mcp install main.pyOr for manual installation:
Open Claude Desktop → Settings → Developer → Edit Config
Add this to the
mcpServerssection:
{
"mcpServers": {
"Revit Connector": {
"command": "uv",
"args": [
"run",
"--frozen",
"mcp",
"run",
"/absolute/path/to/main.py"
]
}
}
}For HTTP transport mode, the following URL-only example must also be accompanied by the paired Authorization header in a client that supports it:
{
"mcpServers": {
"Revit Connector": {
"url": "http://localhost:8000/mcp"
}
}
}Connecting to Claude Code
claude mcp add -s user "Revit-Connector" -- uv run --frozen mcp run /absolute/path/to/main.pyCreating Your Own Tools
The modular architecture of this project makes adding functionalities relatively simple. The provided LLM.txt file also gives your language model the necessary context to get started right away.
The process involves three main parts:
Part 1: Create the Route Module in Revit
Create a new Python file within the revit-mcp-python.extension/revit_mcp/ directory (e.g., revit_mcp/your_module.py). This module will contain all the related functions you want to expose.
# In revit-mcp-python.extension/revit_mcp/your_module.py
# -*- coding: UTF-8 -*-
"""
Your Module for Revit MCP
Handles your specific functionality.
"""
from pyrevit import routes, revit, DB
import json
import logging
# Standard logger setup
logger = logging.getLogger(__name__)
def register_your_routes(api):
"""Register all your routes with the API."""
# ---- Example 1: A GET request for reading data ----
@api.route('/your_endpoint/', methods=["GET"])
def get_project_title(doc):
"""Gets the project title from the Revit model."""
try:
value = doc.Title
return routes.make_response(data={"status": "success", "data": value})
except Exception as e:
logger.error("Get project title failed: {}".format(str(e)))
return routes.make_response(data={"error": str(e)}, status=500)
# ---- Example 2: A POST request for modifying the model ----
@api.route('/modify_model/', methods=["POST"])
def modify_model(doc, request):
"""Handles POST requests for modifying the Revit model."""
try:
data = json.loads(request.data) if isinstance(request.data, str) else request.data
# Use a transaction for all model modifications
t = DB.Transaction(doc, "Modify Model via MCP")
t.Start()
try:
element_id = data.get("element_id")
new_value = data.get("new_value")
element = doc.GetElement(DB.ElementId(int(element_id)))
param = element.LookupParameter("Comments")
param.Set(new_value)
t.Commit()
return routes.make_response(data={"status": "success", "result": "Element modified."})
except Exception as tx_error:
if t.HasStarted() and not t.HasEnded():
t.RollBack()
raise tx_error
except Exception as e:
logger.error("Modify model failed: {}".format(str(e)))
return routes.make_response(data={"error": str(e)}, status=500)
logger.info("Your custom routes were registered successfully.")Part 2: Create the MCP Tool Module
Create the corresponding tools for the MCP server in the tools/ directory (e.g., tools/your_tools.py). This module will use the revit_get and revit_post helpers from main.py.
# In tools/your_tools.py
# -*- coding: utf-8 -*-
"""Your tools for the MCP server."""
from mcp.server.fastmcp import Context
from .utils import format_response
def register_your_tools(mcp, revit_get, revit_post, revit_image=None):
"""Register your tools with the MCP server."""
# ---- Tool for the GET request ----
@mcp.tool()
async def get_revit_project_title(ctx: Context) -> str:
"""
Retrieves the title of the currently open Revit project.
"""
response = await revit_get("/your_endpoint/", ctx)
return format_response(response)
# ---- Tool for the POST request ----
@mcp.tool()
async def modify_revit_element_comment(
element_id: int,
new_value: str,
ctx: Context = None
) -> str:
"""
Modifies the 'Comments' parameter of a specific element.
Args:
element_id: The ID of the element to modify.
new_value: The new comment to apply to the element.
"""
payload = {"element_id": element_id, "new_value": new_value}
response = await revit_post("/modify_model/", payload, ctx)
return format_response(response)Part 3: Register Your New Modules
1. Register the Route Module
Open revit-mcp-python.extension/startup.py and add your new route registration function.
# In revit-mcp-python.extension/startup.py
# ... (other imports)
# Import the registration function from your new module
from revit_mcp.your_module import register_your_routes
def register_routes():
"""Register all MCP route modules"""
api = routes.API('revit_mcp')
try:
# ... (existing route registrations)
# Register your new routes (this registers all functions inside)
register_your_routes(api)
logger.info("All MCP routes registered successfully")
except Exception as e:
logger.error("Failed to register MCP routes: {}".format(str(e)))
raise2. Register the Tool Module
Open tools/__init__.py and add your new tool registration function.
# In tools/__init__.py
# ... (other tool imports)
# Import the registration function from your new tool module
from .your_tools import register_your_tools
def register_tools(mcp_server, revit_get_func, revit_post_func, revit_image_func):
"""Register all tools with the MCP server"""
# ... (existing tool registrations)
# Register your new tools (this registers all tools inside)
register_your_tools(mcp_server, revit_get_func, revit_post_func, revit_image_func)
return mcp_serverRoadmap
This is a work in progress and more of a demonstration than a fully-featured product. Future improvements could include:
Creating a Client inside Revit
Implementing compatibilities with other language Models
Authentication and security enhancements
More advanced Revit tools and capabilities
Better error handling and debugging features
Benchmarking with local models
Documentation and examples for common use cases
...
Contributing
Contributions are welcome! Feel free to submit pull requests or open issues for any bugs or feature requests. Feel free to reach out to me if you have any questions, ideas
Available Tools
20 toolsclear_colorsA
Clear color overrides for elements in a category
This tool removes all color overrides that have been applied to elements in the specified category, returning them to their default appearance.
Args: category_name: Name of the category to clear colors from (e.g., "Walls", "Doors") ctx: MCP context for logging
Returns: Results of the clear operation including count of elements processed
Inputs: category_name (required).
close_documentA
Close the active Revit document.
Args: save: If True, save the document before closing. If False (default), close without saving.
Inputs: save.
color_splashA
Color elements in a category based on parameter values
This tool applies color coding to Revit elements within a specified category based on their parameter values. Elements with the same parameter value will receive the same color.
Args: category_name: Name of the category to color (e.g., "Walls", "Doors", "Windows") parameter_name: Name of the parameter to use for coloring (e.g., "Mark", "Type Name") use_gradient: Whether to use gradient coloring instead of distinct colors (default: False) custom_colors: Optional list of custom colors in hex format (e.g., ["#FF0000", "#00FF00"]) ctx: MCP context for logging
Returns: Results of the coloring operation including statistics and color assignments
Inputs: category_name (required), parameter_name (required), use_gradient, custom_colors.
execute_revit_codeA
Execute IronPython code directly in Revit context.
The code has access to:
doc: The active Revit document
uidoc: The active UIDocument (use for UI operations like switching the active view)
DB: Revit API Database namespace
revit: pyRevit module
print: Function to output text (returned in response)
No transaction is opened automatically. Wrap model-modifying code yourself: t = DB.Transaction(doc, "My change") t.Start() # ... modify model ... t.Commit()
For UI operations that cannot run inside a transaction (e.g. switching the active view): all_views = DB.FilteredElementCollector(doc).OfClass(DB.View).ToElements() target = next((v for v in all_views if v.Name == "Level 1"), None) if target: uidoc.ActiveView = target
Tips:
Use getattr(element, 'Name', 'N/A') to safely access the Name property
Check elements exist before use: if element:
Use hasattr() for optional properties
Inputs: code (required), description.
get_current_view_elementsA
Get elements visible in the currently active view in Revit.
Returns per element: element_id, name, category, category_id. Also returns category_counts (always for ALL elements, even if truncated).
If the response contains truncated=true, not all elements were returned. Check total_elements vs returned_elements and increase limit if needed.
Args: limit: Maximum number of elements to return (default 5000). include_levels: Include level name and level_id per element. Default false. include_location: Include location geometry (point or curve). Default false.
Inputs: limit, include_levels, include_location.
get_current_view_infoA
Get detailed information about the currently active view in Revit.
Returns comprehensive information including:
View name, type, and ID
Scale and detail level
Crop box status
View family type
View discipline
Template status
Inputs: no named parameters.
get_revit_model_infoB
Get comprehensive information about the current Revit model
Inputs: no named parameters.
get_revit_statusA
Check if the Revit MCP API is active and responding
Inputs: no named parameters.
get_revit_viewB
Export a specific Revit view as an image
Inputs: view_name (required).
launch_revitA
Launch Revit on this machine, optionally opening a file.
Finds installed Revit versions automatically. After launching, polls the pyRevit Routes health endpoint until Revit is ready for MCP tools.
For workshared (central model) files, Revit will show its native worksharing dialog on open. Use the open_document tool after launch for more control over worksharing options like detach from central.
Args: file_path: Path to a .rvt, .rfa, or .rte file to open. Optional. version: Revit version year (e.g. "2025"). Uses latest if omitted. language: Language code (e.g. "ENU", "FRA"). Optional. timeout: Seconds to wait for Revit readiness (default 120).
Inputs: file_path, version, language, timeout.
list_category_parametersA
Get available parameters for elements in a category
This tool helps you discover what parameters are available for coloring by listing all parameters found on elements in the specified category.
Args: category_name: Name of the category to check parameters for (e.g., "Walls", "Doors") ctx: MCP context for logging
Returns: List of available parameters with their types and sample values
Inputs: category_name (required).
list_familiesA
Get a flat list of available family types in the current Revit model.
Use contains to filter by a substring of the family or type name (case-insensitive).
Inputs: contains, limit.
list_family_categoriesA
Get a list of all family categories in the current Revit model
Inputs: no named parameters.
list_levelsA
Get a list of all levels in the current Revit model
Inputs: no named parameters.
list_revit_installationsA
Discover all Revit versions installed on this system.
Returns a list of installed Revit versions with their executable paths. Use this to check what's available before calling launch_revit.
Inputs: no named parameters.
list_revit_viewsA
Get a list of all exportable views in the current Revit model
Inputs: no named parameters.
open_documentA
Open a Revit document file in the running Revit instance.
Supports workshared (central) files with options to detach from central or audit the file on open.
Args: file_path: Absolute path to a .rvt, .rfa, or .rte file. detach: If True, open detached from central (workshared files only). Preserves worksets but severs the link to the central model. audit: If True, audit the file on open to check for corruption.
Inputs: file_path (required), detach, audit.
place_familyC
Place a family instance at a specified location in the Revit model
Inputs: family_name (required), type_name, x, y, +4 more.
save_documentA
Save the active Revit document.
If file_path is omitted, saves the document in place. If file_path is provided, performs a Save As to the new location.
Args: file_path: Optional path for Save As. If omitted, saves in place.
Inputs: file_path.
sync_with_centralA
Synchronize the active workshared document with central.
Only works with workshared (central model) documents. For non-workshared documents, use save_document instead.
Args: comment: Sync comment visible in the worksharing log. compact: If True, compact the central model during sync. relinquish_all: If True (default), relinquish all borrowed elements and worksets after sync.
Inputs: comment, compact, relinquish_all.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Each tool has a clearly distinct purpose. Tools like clear_colors and color_splash are complementary and their descriptions clearly differentiate removal vs. application. All get/list/document tools target specific entities without overlap.
All tool names follow a consistent verb_noun pattern in snake_case, e.g., clear_colors, close_document, list_families. Only execute_revit_code breaks the pattern slightly but is still readable. The naming convention is uniform and predictable.
20 tools is well-scoped for a Revit server covering document management, view handling, element coloring, family listing, and code execution. It covers essential workflows without being excessive or too thin.
The tool set covers visualization (colors, view export), information retrieval (categories, families, levels), and document operations (open, close, save, sync). However, missing basic CRUD for elements (update, delete) and view/family creation are notable gaps, though the execute_revit_code tool can fill them programmatically.
Maintenance
Related MCP Connectors
Convert Revit files to XKT, IFC, or DWG and query BIM data via natural language.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Read and edit the Revit 2024–2027 model on your PC. Needs the free Revit MCP add-in.
Related MCP Servers
- AlicenseBqualityNot gradedmaintenanceAllows AI assistants to interact with Autodesk Revit through the MCP protocol, enabling the AI to create, modify, and delete elements in Revit projects.1559 npm1-
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Autodesk Revit to query project data, manage elements, and execute generated code via the Model Context Protocol. It provides full compatibility with GitHub Copilot and Claude to automate BIM modeling workflows.13MIT
- AlicenseNot gradedqualityAmaintenanceMCP server for Autodesk Revit (BIM) with 705+ API endpoints. Enables AI agents to create walls, place doors/windows, generate sheets, manage views, and produce construction documents via the Model Context Protocol. Uses named pipes for zero-crash Revit integration.22MIT
- -licenseNot gradedqualityNot gradedmaintenanceConnects MCP clients like Claude, Codex, and Cursor to a running Autodesk Revit session for typed BIM queries, verified model edits, family authoring, exports, and Power BI workflows. It is open-source, Apache-2.0, and designed for reliable, verified outcomes.-