RevitMCPSDK logo

RevitMCPSDK

Community
DTDucas

Revit MCP SDK

PublisherDTDucas
RepositoryRevitMCPSDK
LanguageC#
Forks
12
Stars
41
Available tools
0
Transport typestdio
LicenseMIT
Links
  • Connect tools to AI workflows

    RevitMCPSDK exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    41 stars and 12 forks from the linked repository.

RevitMCPSDK

Overview

RevitMCPSDK is a comprehensive software development kit for Autodesk Revit that implements the Model Context Protocol (MCP). This SDK simplifies the development of Revit plugins by providing a robust framework for communication between Revit and external applications through a JSON-RPC 2.0 interface.

Key Features

  • Multi-Version Support: Compatible with Revit 2020-2027
  • JSON-RPC 2.0 Implementation: Standardized communication protocol
  • MVVM Architecture: Clean separation of Model-View-ViewModel for WPF applications
  • SOLID Principles: Follows best practices in software design
  • Command Pattern: Simplified command execution with error handling
  • External Event Framework: Thread-safe execution of Revit API operations
  • Versioning Support: Compatibility management between different Revit versions
  • Comprehensive Error Handling: Standardized error codes and reporting

Installation

NuGet Package

The RevitMCPSDK is available as a NuGet package for each supported Revit version:

Install-Package RevitMCPSDK -Version 2020.0.0.1 // For Revit 2020
Install-Package RevitMCPSDK -Version 2021.0.0.1 // For Revit 2021
Install-Package RevitMCPSDK -Version 2022.0.0.1 // For Revit 2022
Install-Package RevitMCPSDK -Version 2023.0.0.1 // For Revit 2023
Install-Package RevitMCPSDK -Version 2024.0.0.1 // For Revit 2024
Install-Package RevitMCPSDK -Version 2025.0.0.1 // For Revit 2025
Install-Package RevitMCPSDK -Version 2026.0.0.1 // For Revit 2026
Install-Package RevitMCPSDK -Version 2027.0.0.1 // For Revit 2027

Or, if you prefer using PackageReference in your .csproj file:

xml
<PackageReference Include="RevitMCPSDK" Version="$(RevitVersion).*" />

Manual Installation

Alternatively, you can download the appropriate version of the SDK from the GitHub releases page and reference it in your project.

Architecture

RevitMCPSDK is built on the following architectural foundations:

MVVM Pattern

The SDK follows the Model-View-ViewModel pattern to facilitate:

  • Clean separation of concerns
  • Improved testability
  • Better code maintainability
  • UI/UX flexibility

SOLID Principles

  • Single Responsibility: Each class has one responsibility
  • Open/Closed: Open for extension, closed for modification
  • Liskov Substitution: Derived classes can be substituted for base classes
  • Interface Segregation: Focused interfaces for specific purposes
  • Dependency Inversion: Abstractions over implementations

JSON-RPC 2.0

The SDK implements the JSON-RPC 2.0 specification for communication between Revit and external applications:

  • Standardized request/response format
  • Support for notifications
  • Comprehensive error handling
  • Versioned protocol

Core Components

Command System

The command system allows execution of Revit API operations:

csharp
// Register a command
commandRegistry.RegisterCommand(new YourCustomCommand());

// Execute a command
JObject parameters = JObject.FromObject(new { /* your parameters */ });
object result = revitCommand.Execute(parameters, "requestId");

External Events

Thread-safe execution of Revit API operations:

csharp
public class YourExternalEvent : ExternalEventCommandBase
{
    public YourExternalEvent(IWaitableExternalEventHandler handler, UIApplication uiApp)
        : base(handler, uiApp)
    {
    }

    public override string CommandName => "YourCommandName";

    public override object Execute(JObject parameters, string requestId)
    {
        // Extract parameters
        if (!parameters.TryGetValue("parameter1", out JToken param1Value))
            throw new CommandExecutionException("Missing required parameter: parameter1");

        // Raise the external event and wait for completion
        if (!RaiseAndWaitForCompletion())
            throw CreateTimeoutException(CommandName);

        // Return success result
        return CommandResult.CreateSuccess(new { /* result data */ });
    }
}

Versioning Support

The SDK includes utilities for managing compatibility across different Revit versions:

csharp
// Check if the current Revit version is supported
RevitVersionAdapter adapter = new RevitVersionAdapter(application);
bool isSupported = adapter.IsVersionSupported(new[] { "2020", "2021", "2022", "2023", "2024", "2025", "2026", "2027" });

// Compare versions
int result = VersionHelper.CompareVersions("2020", "2025"); // Returns -1 (2020 < 2025)

Getting Started

Creating a Basic Revit Plugin

  1. Create a new Class Library project in Visual Studio
  2. Install the RevitMCPSDK NuGet package for your target Revit version
  3. Implement a custom command:
csharp
using Autodesk.Revit.UI;
using Newtonsoft.Json.Linq;
using RevitMCPSDK.API.Base;
using RevitMCPSDK.API.Interfaces;
using RevitMCPSDK.API.Models;

namespace YourNamespace
{
    public class GetElementCommand : ExternalEventCommandBase
    {
        public GetElementCommand(IWaitableExternalEventHandler handler, UIApplication uiApp)
            : base(handler, uiApp)
        {
        }

        public override string CommandName => "GetElement";

        public override object Execute(JObject parameters, string requestId)
        {
            // Extract element ID from parameters
            if (!parameters.TryGetValue("elementId", out JToken elementIdToken))
                return CommandResult.CreateError("Missing elementId parameter");

            int elementId = elementIdToken.Value<int>();

            // Get the document
            var doc = UiApp.ActiveUIDocument.Document;
            
            // Find the element
            var element = doc.GetElement(new Autodesk.Revit.DB.ElementId(elementId));
            
            if (element == null)
                return CommandResult.CreateError($"Element with ID {elementId} not found", 
                    new { ErrorCode = JsonRPCErrorCodes.ElementNotFound });

            // Return element information
            return CommandResult.CreateSuccess(new
            {
                Id = element.Id.IntegerValue,
                Name = element.Name,
                Category = element.Category?.Name
            });
        }
    }
}
  1. Register your command in your Revit external application:
csharp
using Autodesk.Revit.UI;
using RevitMCPSDK.API.Interfaces;
using System;

namespace YourNamespace
{
    public class YourRevitApp : IExternalApplication
    {
        private ICommandRegistry _commandRegistry;

        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                // Initialize the command registry
                _commandRegistry = new CommandRegistry();
                
                // Create and register your commands
                var handler = new YourExternalEventHandler();
                var uiApp = new UIApplication(application.ControlledApplication);
                
                var getElementCommand = new GetElementCommand(handler, uiApp);
                _commandRegistry.RegisterCommand(getElementCommand);
                
                // Initialize communication channel
                // ...
                
                return Result.Succeeded;
            }
            catch (Exception ex)
            {
                // Log the error
                return Result.Failed;
            }
        }

        public Result OnShutdown(UIControlledApplication application)
        {
            // Cleanup resources
            return Result.Succeeded;
        }
    }
}

Error Handling

The SDK provides standardized error codes and handling:

csharp
try
{
    // Execute some Revit API operation
}
catch (Exception ex)
{
    return CommandResult.CreateError(
        $"Failed to execute operation: {ex.Message}",
        new { ErrorCode = JsonRPCErrorCodes.RevitApiError }
    );
}

Best Practices

  • Keep Commands Focused: Each command should do one thing well
  • Validate Parameters: Always validate input parameters before execution
  • Handle Errors Gracefully: Use the standardized error system
  • Consider Version Compatibility: Use the versioning system to manage differences between Revit versions
  • Follow UI/UX Guidelines: When building WPF interfaces, follow Revit UI/UX guidelines
  • Optimize Performance: Keep commands lightweight and efficient
  • Use Transactions Properly: Begin transactions only when necessary and commit them as soon as possible

License

RevitMCPSDK is licensed under the MIT License. See the LICENSE file for details.

Support

For support, please open an issue on the GitHub repository.

Author

Duong Tran Quang (DTDucas) contact@dtducas.com · baymax.contact@gmail.com github.com/DTDucas Author: dtducas.com

Copyright © 2025 Duong Tran Quang - DTDucas

Use RevitMCPSDK MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once RevitMCPSDK is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add RevitMCPSDK as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the RevitMCPSDK MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "revitmcpsdk": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the RevitMCPSDK MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the RevitMCPSDK MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use RevitMCPSDK to help me with this task?
RevitMCPSDK
Sure. I read it.
Here is what I found using RevitMCPSDK.

Frequently asked questions

What is the RevitMCPSDK MCP server used for?

RevitMCPSDK is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use RevitMCPSDK MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use RevitMCPSDK with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use RevitMCPSDK MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With RevitMCPSDK connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect RevitMCPSDK MCP to TypingMind?

RevitMCPSDK runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does RevitMCPSDK MCP provide in TypingMind?

RevitMCPSDK exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use RevitMCPSDK MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If RevitMCPSDK requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇