pyRevit Agent MCP [pyRevit 7]

@romangolev Has been working hard on a pyRevit MCP server that is built into the core library and not dependent on ‘routes’ or other 3rd party extensions.

Keeping this brief because I don’t want to steal his thunder. Roman please correct me if I’ve mis-stated, and feel free to outline other features you have in mind or go into more detail about any of these.

How it works

  • pyrevit mcp: an MCP server built into the pyRevit CLI. Register a client with pyrevit mcp install <client> (Claude Code, Codex, Cursor, VS Code, OpenCode).
  • The server talks to a host inside Revit over a local named pipe; scripts run on Revit’s main thread via ExternalEvent.
  • Engines: IronPython 2.7, IronPython 3.4, CPython 3.12.
  • Off by default; enable with pyrevit configs agent enable.

What an agent can do

  • Orient: get_context, list_revit_instances
  • Learn: lookup_revit_api, lookup_pyrevit_api, list_skills, get_skill
  • Inspect and show: inspect_elements, navigate_revit_link, show_elements, capture_view
  • Act: run_query, run_modify, list_automation, run_automation
  • Audit: get_run

Safety model

  • Policy: readonly, ask (you approve the change set in Revit), or auto.
  • Each modify run is a single undo entry and is logged.
  • The pipe is local to your Windows user, with no other authentication.

Library and skills

  • New pyrevitlib helpers for creating walls, floors, roofs, views, sheets and schedules.
  • Skills: task guides the agent reads. Several ship with pyRevit; firm skills are opt-in.
  • Automations: library functions registered with validated inputs, so the agent calls them instead of writing code.

One item I think is lacking in most of the Revit MCPs that I’ve seen is UI inside of Revit that gives the user feedback about what the agent is doing, when it’s acting, what project an agent session is interacting with, etc.

I’d like to see a dockable panel inside Revit that shows when the active project differs from the one the agent session started in, shows a history of commands with descriptions, etc.

I think this could also be a good place to have UI about session permission modes, and maybe in the future even allow an agent to request form inputs within Revit.

@romangolev, I have some thoughts here and can work on a PR if you’re open to the idea and haven’t starting something like this already.

I’m also curious if you see extensions being able to ship skills and automations that the pyRevit MPC adds to it’s library.

Hi @ccrosley and thanks for opening this topic!

The main idea is to be able to control the pyRevit runtime and be able to make data query from model or models along with the ability to modify it. At the moment of the release it does support integration with some of the cli tools like claude, codex, opencode, but might be extended painlessly to include more of them.

Also there is a room for improvement skill-wise. I’ve only tested the agent with simple architectural tasks and I believe that this gap can be filled.

What also I had in mind is the ability to use some of the first-party pyRevit tools within the agent. (This will need the refactoring of tools in order for the agent to be able to use not only the human). The pyRevit runtime already knows about tools that had been loaded (try “Search” tool on the main panel), so technically agent could call them as well.

Some of pyrevitlib and rpw methods need to be adapted for the use with mcp agent. There is a decorator that marks method for mcp agent and tells it what it does. Extending helpers is basically more of a routine job as I see it. There are a lot of code in the library that ought to be revised.

Of course the implementation of the UI should be on the table as well. Haven’t seen many mcps for Revit, that’s why I cannot advise on that. Maybe the output logging window could be reused for that task as well, could be a dockable, maybe both at some point :smile:

Technically, the app tries to search active skills. I believe extensions could support skills from extensions as well. It could be a skill folder alongside a lib folder :thinking: or a separate skill types of extension (we have lib extension now, why not make skill extension?)

For the future we might need something more graceful like skills manager UI as well. In order to be able to manage them and save it with settings :light_bulb:

Check out my latest PR. :smiling_face_with_sunglasses: It adds a dockable panel that shows command story but also helps manage which Revit session the agent is using. Long-term, I think the agent could also request input here with a button that could launch pyRevit buttons or even custom UI.