pyrevit-mcp

pyrevit-mcp

An MCP server that exposes an open Autodesk Revit model to MCP clients, enabling natural language inspection and editing of the model via Revit API calls through pyRevit Routes.

Category
访问服务器

README

pyrevit-mcp

An MCP server that exposes an open Autodesk Revit model to any MCP client, so the model can be inspected and edited in plain language instead of through the Revit UI.

Ask "find all doors narrower than 1.2m and highlight them in red" or "rename this room to ICU Recovery", and the server translates that into Revit API calls through pyRevit Routes. A small web chat UI is included for demos: split-screen with Revit, CSV import and export, undo, and screenshots of the model right in the chat.

Built for customer demos, prototyping and my own day-to-day work.

This is not an official Autodesk product and comes with no support commitment. I work at Autodesk as a Technical Specialist for Emerging Tech in Construction, and this project is not part of that role. See Disclaimer and support.

How it works

MCP client (Claude Code, Claude Desktop, ...)
        │ stdio
        ▼
server.py (Python 3 / FastMCP)  ──HTTP :48884──>  pyRevit Routes (IronPython, inside Revit)
        ▲                                                  │
        │ shared revit_get/revit_post                      ▼
app.py (FastAPI :8100) ◄── web chat UI            Revit API, Transactions
        │
        ▼ Claude API

Two entry points share one bridge:

  • server.py is the MCP server. Any MCP client can connect over stdio and gets 21 tools.
  • app.py is a FastAPI backend with a chat UI (web/index.html) driven by the Claude API. It exposes the same tools plus CSV export, and renders images, downloads, and undo in the chat.

Inside Revit, a pyRevit extension (pyrevit-mcp.extension/) registers REST routes. pyRevit injects the active document into the handlers, which run in the Revit API context, one transaction per write.

What it covers

21 MCP tools:

Area Tools
Orientation get_status, get_model_info, get_levels, get_views, get_categories, list_parameters
Query get_elements, find_elements (level + parameter filters, returns requested parameters in one call), get_element_properties
Write set_parameter, set_parameters (bulk, one transaction, one undo entry)
Visual override_graphics, isolate_elements, color_by_parameter (legend included), reset_view, export_image
Selection get_selection, set_selection
Views set_active_view
Model health get_warnings (grouped, with failing element ids)
Persistence save_document (save or synchronize with central)

Parameter access covers instance and type parameters: reads fall back to the element type automatically, and a type write reports how many instances it affects before you trust it. Values are returned as display values in project units. Doors report their room assignment (FromRoom/ToRoom).

Documentation

The full guide with a validated per-tool reference is hosted at mk92at.github.io/pyrevit-mcp/pyrevit-mcp.html. It supports English and German (?lang=en|de), light and dark themes, and per-tool anchors (#find_elements). The web chat UI links into it from the tool reference sidebar.

Requirements

  • Autodesk Revit 2024 or newer (developed against Revit 2027) with pyRevit installed
  • Python 3.11 or newer and uv
  • For the web chat UI: an Anthropic API key

Setup

1. Install the Revit extension. Copy or clone this repository, then add pyrevit-mcp.extension to pyRevit's extension search paths (pyRevit Settings → Custom Extension Directories, pointing at this repository's root). Enable the Routes server in pyRevit's settings. Restart Revit.

2. Verify the bridge. With a model open:

curl http://localhost:48884/pyrevit_mcp/status/

The trailing slash is mandatory on every route.

3. Install the Python side:

uv sync

4a. Register with an MCP client, e.g. Claude Code:

claude mcp add revit -s user -- uv --directory "<path-to>/pyrevit-mcp" run python server.py

4b. Or run the web chat UI. Create a .env with your ANTHROPIC_API_KEY (see .env.example), then:

uv run uvicorn app:app --port 8100

Open http://localhost:8100. The sidebar has a tool reference generated from the server at runtime, with a clickable example per tool.

After any change to the extension code, restart Revit cold. The Routes server (Beta) crashes Revit on a pyRevit reload. scripts/restart_revit.ps1 automates the cold restart and test_routes.py smoke-tests every route afterwards.

Layout

server.py                       MCP server, 21 tools, shared HTTP bridge
app.py                          FastAPI chat backend (CSV, undo, images, downloads)
web/index.html                  chat UI, single file
test_routes.py                  end-to-end smoke test for every route
scripts/restart_revit.ps1       automated cold restart
pyrevit-mcp.extension/
  startup.py                    route registration
  lib/pyrevit_mcp/
    status.py, elements.py, parameters.py, views.py, selection.py, model.py
    utils.py                    ElementId helpers, safe JSON encoding, parameter access

Known limits

  • No geometry creation or deletion; this server reads, writes parameters, and visualises.
  • Type parameters are written with a warning, but there is no dry-run mode.
  • Rooms queries slow down on very large models.
  • The Routes server is a pyRevit beta feature; treat the whole bridge as a prototype.

Disclaimer and support

I work at Autodesk as a Technical Specialist for Emerging Tech in Construction. This project grew out of my own exploration of MCP and the Revit API and runs alongside that work, not as part of it. It is not an official Autodesk product or project. Nothing here is built, reviewed, endorsed or maintained by Autodesk, and nothing in this repository is a statement on behalf of Autodesk. Reaching me through my job is not a way to get help with it.

On support I want to be straight with you, because the honest answer has two halves.

I would like to offer as much help as I can, and I am genuinely interested in developing this further together with anyone who finds it useful. Issues and pull requests are welcome and I will read them. Tell me what you built with it.

What I cannot do is promise any of that. There is no guaranteed response, no timeline, no fix for your blocker, and no commitment that this keeps working against future Revit or pyRevit changes. If you are building something that has to work, fork it and own your copy.

This project stands on pyRevit by Ehsan Iran-Nejad and the pyRevit Labs community, licensed GPL-3.0. pyRevit and its Routes module are the bridge that makes any of this possible; this repository contains no pyRevit code and you install pyRevit yourself. Patterns for the ElementId handling and the route registration were adapted from revit-mcp-server by Talal Ahmed (Demolinator), licensed MIT. The code in this repository is my own and is licensed MIT as well, see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选