Agentic AI for Revit
CEO & Co-founder
Published
Updated

TL;DR
We built an AI agent that runs inside a Revit session, connects to Claude Code through a local MCP server and can both answer questions about the model and change it.
Instead of a separate MCP tool for every task, the agent writes C# code against the Revit API, compiles it with Roslyn and executes it in the open model.
Agentic AI for Revit
Many AI assistants for Revit still work from the outside, they answer questions in a chat window, and the engineer goes back to the model to do the actual work by hand. Software developers have already moved past that stage, because in a terminal an AI agent reads the project, writes code, runs it and shows the result for review.
In 2026 Claude Code became very popular among all the developers. So we decided to create an agentic AI which will work inside a Revit session. The goal was to bring the same way of working into Revit, so the user describes a task in plain language and Claude writes and runs the Revit API code for it.
Below we explain how the agent is structured, what it can do in a live model, and how we built it step by step.
Structure
We create a local MCP (Model Context Protocol) server which uses active claude code subscription. On Revit Startup, we connect this MCP to Revit. Then the user can call an Agent by a ribbon button. Inside the Agent user can communicate with Claude. The user writes a message, Claude analyzes it, asks the data from Revit if needed, and creates a C#-code which will be executed inside Revit. A special service compiles and executes the code, and return the result. If there are any problems in generated code, Claude tries to fix it by creating a new one.
Revit AI-agent
For the user, all of the setup described above comes down to one window inside Revit.
It is a modeless window which gives the user an ability to communicate with Claude. You need to have active Claude subscription to use it. You can write any question about the model, and it will return an answer:

The same way you can ask Claude to modify the model:

The code executes inside IExternalEventHandler, so the Agent is modeless and modifies model on the fly.
AI-agent creation
We started creation of this agent by the following steps:
- MCP-server creation. We should be aware that we have access to Revit and can read data from it. It can be achieved using ModelContextProtocol.AspNetCore.
- Create some tools to read data from Revit. First task was to list all the 3D-views in active model and return them to an output.
- Next step was to make some simple modification. We decided to export active model to Navisworks by request. On these steps, we wrote prompts for it in a simple Claude Code session with the Revit turned in differently.
- After make sure we can export model, we try to do the same using simple AI-agent window. So we start to communicate with Claude only inside Revit.
- And after that, we have created an instrument, that compiles the C# code on-the fly and executes it. Nothing special, just Microsoft.CodeAnalysis; namespace:
public Script<object> Compile(string code, CancellationToken ct = default)
{
ArgumentNullException.ThrowIfNull(code);
var script = CSharpScript.Create<object>(code, ScriptOptions, typeof(ScriptGlobals));
var diagnostics = script.Compile(ct);
var errors = diagnostics
.Where(d => d.Severity == DiagnosticSeverity.Error)
.Select(d => d.ToString())
.ToArray();
if (errors.Length > 0)
{
throw new InvalidOperationException(
"Compilation failed:\n" + string.Join("\n", errors));
}
return script;
}
public object? Run(Script<object> script, UIApplication uiApplication, CancellationToken ct = default)
{
ArgumentNullException.ThrowIfNull(script);
ArgumentNullException.ThrowIfNull(uiApplication);
var state = script
.RunAsync(new ScriptGlobals(uiApplication), ct)
.GetAwaiter()
.GetResult();
return state.ReturnValue;
}
That's it! Now we do not need to manually (or using Claude, yes) write hundreds of tools, while Claude agent just orchestrate them. Now we do not have any problems to execute any code that engineer wants Claude to ask (the main point is that Claude should be able to generate this code).
Want to see it in action? Watch the video below to see how our Agentic AI seamlessly generates and executes C# code inside a live Revit session.
How does this agent compare with other Revit MCP servers?
So far, there are three common ways to connect an AI assistant to Revit, and the main difference is whether the AI calls a fixed set of tools or writes its own code.
| Approach | Suitable for | Main advantage | Main drawback |
|---|---|---|---|
| Revit Public MCP Server by Autodesk | Teams on Revit 2027 that need to query and review models | Official server supported by Autodesk | Read-only in the current Tech Preview |
| Open-source MCP servers such as revit-mcp or pyRevit MCP | Developers ready to install and maintain community add-ins | Free to use and open to extend | Updates and support depend on the community |
| Code-generating agent, the approach in this article | Teams with Revit API experience that need to modify models | Covers any task the Revit API supports without a tool per task | Generated code runs with full API access and needs review |
Autodesk released the Revit Public MCP Server as a Tech Preview add-on for Revit 2027, and it connects Claude Desktop or Cursor to a running model.
According to Autodesk's announcement, "The current release focuses on read-only access to your Revit model."
Autodesk says it plans to handle creating and modifying elements through a separate write server, and at the time of writing we found no release of it in Autodesk's materials.
Why generate code instead of writing more MCP tools?
A code-generating agent needs one execution tool, while a tool-based agent needs a separate tool for every operation the team might ask for.
In other words, covering schedules, parameters, views, exports and element placement with dedicated tools can mean writing and maintaining hundreds of them, and a user can still ask for something none of them covers.
Threading deserves particular attention.
Revit accepts API calls only from a valid API context, so a modeless window cannot call the API from its own thread. An external event hands the work back to Revit, which runs it when the application is ready.
Summary: when a code-generating agent makes sense
- Your team already writes Revit API code and can review what the agent produces
- Requests vary too much to cover with a fixed set of tools
- You need the agent to change the model, not only read it
Bottom line: which approach should your team choose?
The right choice depends on whether you need to read models or change them, and on how much C# your team can review.
- If you only need to query and review models in Revit 2027, the Autodesk server may be enough, and there is little reason to build anything else.
- If you repeat the same few edits on every project, a classic Revit plugin or a small set of MCP tools can be easier to test and support than an agent.
- If you want an assistant that handles new requests and edits the model, a code-generating agent is worth considering, provided someone on the team can read the code it writes.
Plus, MCP servers can work together, and our article on Pinly MCP shows how an AI assistant can find elements through Revit MCP and pin comments on them.
If you are weighing a custom agent or workflow automation for your own team, it may help to consult with a Revit development team before committing to one approach.
FAQ
Do I need a Claude subscription to use the agent?
Yes. The agent runs through a local MCP server that uses an active Claude Code subscription.
Does Revit have a built-in MCP server?
Yes, for Revit 2027. Autodesk released the Revit Public MCP Server as a Tech Preview add-on, and so far the release reads the model without changing it.
Can the agent modify the Revit model?
Yes. It generates C# code that changes the model, for example adding a window to a room, and runs that code inside an IExternalEventHandler while the window stays open.
What happens when the generated code has errors?
Claude tries to fix the code by generating a new version.
Which AI clients work with Revit MCP servers?
Autodesk's server configures Claude Desktop and Cursor automatically, and other MCP-compatible clients can connect with a similar configuration. Our agent uses Claude Code.
CEO & Co-founder
Ilia Ivanov is a BIM and AEC software development expert with over 10 years of experience. He specializes in Autodesk Revit, BIM automation, and custom software development for the AEC industry. Ilia shares practical insights on the Revit API, AI-powered engineering workflows, and building tools that help design teams work more efficiently.

