Logotipo de RevitMCPSDK

RevitMCPSDK

Comunidad
DTDucas

Revit MCP SDK

EditorDTDucas
RepositorioRevitMCPSDK
IdiomaC#
Forks
12
Estrellas
41
Herramientas disponibles
0
Tipo de transportestdio
LicenciaMIT
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    RevitMCPSDK ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    41 estrellas y 12 forks en el repositorio enlazado.

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

Usa el MCP de RevitMCPSDK con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado RevitMCPSDK, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade RevitMCPSDK como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de RevitMCPSDK.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "revitmcpsdk": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de RevitMCPSDK y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de RevitMCPSDK.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar RevitMCPSDK para ayudarme con esta tarea?
RevitMCPSDK
Claro. Lo he leído.
Esto he encontrado usando RevitMCPSDK.

Preguntas frecuentes

¿Para qué sirve el servidor MCP RevitMCPSDK?

RevitMCPSDK es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP RevitMCPSDK con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar RevitMCPSDK con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de RevitMCPSDK con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con RevitMCPSDK conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP RevitMCPSDK a TypingMind?

RevitMCPSDK funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP RevitMCPSDK en TypingMind?

RevitMCPSDK ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP RevitMCPSDK?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si RevitMCPSDK requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇