{"id":27114966,"url":"https://github.com/dtducas/revitmcpsdk","last_synced_at":"2026-03-16T22:03:44.072Z","repository":{"id":286384440,"uuid":"961240337","full_name":"DTDucas/RevitMCPSDK","owner":"DTDucas","description":"Revit MCP SDK","archived":false,"fork":false,"pushed_at":"2025-04-12T09:02:39.000Z","size":1816,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T19:06:13.485Z","etag":null,"topics":["mcp","revit","revit-mcp","revitapi","revitapi-nuget","sdk"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/RevitMCPSDK","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DTDucas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-06T04:23:13.000Z","updated_at":"2025-06-10T02:42:09.000Z","dependencies_parsed_at":"2025-04-12T17:54:20.042Z","dependency_job_id":"5b6c44a3-0c42-4b50-bef7-e225a80fef3e","html_url":"https://github.com/DTDucas/RevitMCPSDK","commit_stats":null,"previous_names":["dtducas/revitmcpsdk"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/DTDucas/RevitMCPSDK","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DTDucas%2FRevitMCPSDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DTDucas%2FRevitMCPSDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DTDucas%2FRevitMCPSDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DTDucas%2FRevitMCPSDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DTDucas","download_url":"https://codeload.github.com/DTDucas/RevitMCPSDK/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DTDucas%2FRevitMCPSDK/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260424784,"owners_count":23007045,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mcp","revit","revit-mcp","revitapi","revitapi-nuget","sdk"],"created_at":"2025-04-07T04:39:32.165Z","updated_at":"2026-03-16T22:03:44.067Z","avatar_url":"https://github.com/DTDucas.png","language":"C#","readme":"# RevitMCPSDK\n\n## Overview\n\nRevitMCPSDK 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.\n\n## Key Features\n\n- **Multi-Version Support**: Compatible with Revit 2020-2026\n- **JSON-RPC 2.0 Implementation**: Standardized communication protocol\n- **MVVM Architecture**: Clean separation of Model-View-ViewModel for WPF applications\n- **SOLID Principles**: Follows best practices in software design\n- **Command Pattern**: Simplified command execution with error handling\n- **External Event Framework**: Thread-safe execution of Revit API operations\n- **Versioning Support**: Compatibility management between different Revit versions\n- **Comprehensive Error Handling**: Standardized error codes and reporting\n\n## Installation\n\n### NuGet Package\n\nThe RevitMCPSDK is available as a NuGet package for each supported Revit version:\n\n```\nInstall-Package RevitMCPSDK -Version 2020.0.0.1 // For Revit 2020\nInstall-Package RevitMCPSDK -Version 2021.0.0.1 // For Revit 2021\nInstall-Package RevitMCPSDK -Version 2022.0.0.1 // For Revit 2022\nInstall-Package RevitMCPSDK -Version 2023.0.0.1 // For Revit 2023\nInstall-Package RevitMCPSDK -Version 2024.0.0.1 // For Revit 2024\nInstall-Package RevitMCPSDK -Version 2025.0.0.1 // For Revit 2025\nInstall-Package RevitMCPSDK -Version 2026.0.0.1 // For Revit 2026\n```\nOr, if you prefer using PackageReference in your .csproj file:\n\n```xml\n\u003cPackageReference Include=\"RevitMCPSDK\" Version=\"$(RevitVersion).*\" /\u003e\n```\n\n### Manual Installation\n\nAlternatively, you can download the appropriate version of the SDK from the [GitHub releases page](https://github.com/DTDucas/RevitMCPSDK/releases) and reference it in your project.\n\n## Architecture\n\nRevitMCPSDK is built on the following architectural foundations:\n\n### MVVM Pattern\n\nThe SDK follows the Model-View-ViewModel pattern to facilitate:\n\n- Clean separation of concerns\n- Improved testability\n- Better code maintainability\n- UI/UX flexibility\n\n### SOLID Principles\n\n- **S**ingle Responsibility: Each class has one responsibility\n- **O**pen/Closed: Open for extension, closed for modification\n- **L**iskov Substitution: Derived classes can be substituted for base classes\n- **I**nterface Segregation: Focused interfaces for specific purposes\n- **D**ependency Inversion: Abstractions over implementations\n\n### JSON-RPC 2.0\n\nThe SDK implements the JSON-RPC 2.0 specification for communication between Revit and external applications:\n\n- Standardized request/response format\n- Support for notifications\n- Comprehensive error handling\n- Versioned protocol\n\n## Core Components\n\n### Command System\n\nThe command system allows execution of Revit API operations:\n\n```csharp\n// Register a command\ncommandRegistry.RegisterCommand(new YourCustomCommand());\n\n// Execute a command\nJObject parameters = JObject.FromObject(new { /* your parameters */ });\nobject result = revitCommand.Execute(parameters, \"requestId\");\n```\n\n### External Events\n\nThread-safe execution of Revit API operations:\n\n```csharp\npublic class YourExternalEvent : ExternalEventCommandBase\n{\n    public YourExternalEvent(IWaitableExternalEventHandler handler, UIApplication uiApp)\n        : base(handler, uiApp)\n    {\n    }\n\n    public override string CommandName =\u003e \"YourCommandName\";\n\n    public override object Execute(JObject parameters, string requestId)\n    {\n        // Extract parameters\n        if (!parameters.TryGetValue(\"parameter1\", out JToken param1Value))\n            throw new CommandExecutionException(\"Missing required parameter: parameter1\");\n\n        // Raise the external event and wait for completion\n        if (!RaiseAndWaitForCompletion())\n            throw CreateTimeoutException(CommandName);\n\n        // Return success result\n        return CommandResult.CreateSuccess(new { /* result data */ });\n    }\n}\n```\n\n### Versioning Support\n\nThe SDK includes utilities for managing compatibility across different Revit versions:\n\n```csharp\n// Check if the current Revit version is supported\nRevitVersionAdapter adapter = new RevitVersionAdapter(application);\nbool isSupported = adapter.IsVersionSupported(new[] { \"2020\", \"2021\", \"2022\", \"2023\", \"2024\", \"2025\", \"2026\" });\n\n// Compare versions\nint result = VersionHelper.CompareVersions(\"2020\", \"2025\"); // Returns -1 (2020 \u003c 2025)\n```\n\n## Getting Started\n\n### Creating a Basic Revit Plugin\n\n1. Create a new Class Library project in Visual Studio\n2. Install the RevitMCPSDK NuGet package for your target Revit version\n3. Implement a custom command:\n\n```csharp\nusing Autodesk.Revit.UI;\nusing Newtonsoft.Json.Linq;\nusing RevitMCPSDK.API.Base;\nusing RevitMCPSDK.API.Interfaces;\nusing RevitMCPSDK.API.Models;\n\nnamespace YourNamespace\n{\n    public class GetElementCommand : ExternalEventCommandBase\n    {\n        public GetElementCommand(IWaitableExternalEventHandler handler, UIApplication uiApp)\n            : base(handler, uiApp)\n        {\n        }\n\n        public override string CommandName =\u003e \"GetElement\";\n\n        public override object Execute(JObject parameters, string requestId)\n        {\n            // Extract element ID from parameters\n            if (!parameters.TryGetValue(\"elementId\", out JToken elementIdToken))\n                return CommandResult.CreateError(\"Missing elementId parameter\");\n\n            int elementId = elementIdToken.Value\u003cint\u003e();\n\n            // Get the document\n            var doc = UiApp.ActiveUIDocument.Document;\n            \n            // Find the element\n            var element = doc.GetElement(new Autodesk.Revit.DB.ElementId(elementId));\n            \n            if (element == null)\n                return CommandResult.CreateError($\"Element with ID {elementId} not found\", \n                    new { ErrorCode = JsonRPCErrorCodes.ElementNotFound });\n\n            // Return element information\n            return CommandResult.CreateSuccess(new\n            {\n                Id = element.Id.IntegerValue,\n                Name = element.Name,\n                Category = element.Category?.Name\n            });\n        }\n    }\n}\n```\n\n4. Register your command in your Revit external application:\n\n```csharp\nusing Autodesk.Revit.UI;\nusing RevitMCPSDK.API.Interfaces;\nusing System;\n\nnamespace YourNamespace\n{\n    public class YourRevitApp : IExternalApplication\n    {\n        private ICommandRegistry _commandRegistry;\n\n        public Result OnStartup(UIControlledApplication application)\n        {\n            try\n            {\n                // Initialize the command registry\n                _commandRegistry = new CommandRegistry();\n                \n                // Create and register your commands\n                var handler = new YourExternalEventHandler();\n                var uiApp = new UIApplication(application.ControlledApplication);\n                \n                var getElementCommand = new GetElementCommand(handler, uiApp);\n                _commandRegistry.RegisterCommand(getElementCommand);\n                \n                // Initialize communication channel\n                // ...\n                \n                return Result.Succeeded;\n            }\n            catch (Exception ex)\n            {\n                // Log the error\n                return Result.Failed;\n            }\n        }\n\n        public Result OnShutdown(UIControlledApplication application)\n        {\n            // Cleanup resources\n            return Result.Succeeded;\n        }\n    }\n}\n```\n\n## Error Handling\n\nThe SDK provides standardized error codes and handling:\n\n```csharp\ntry\n{\n    // Execute some Revit API operation\n}\ncatch (Exception ex)\n{\n    return CommandResult.CreateError(\n        $\"Failed to execute operation: {ex.Message}\",\n        new { ErrorCode = JsonRPCErrorCodes.RevitApiError }\n    );\n}\n```\n\n## Best Practices\n\n- **Keep Commands Focused**: Each command should do one thing well\n- **Validate Parameters**: Always validate input parameters before execution\n- **Handle Errors Gracefully**: Use the standardized error system\n- **Consider Version Compatibility**: Use the versioning system to manage differences between Revit versions\n- **Follow UI/UX Guidelines**: When building WPF interfaces, follow Revit UI/UX guidelines\n- **Optimize Performance**: Keep commands lightweight and efficient\n- **Use Transactions Properly**: Begin transactions only when necessary and commit them as soon as possible\n\n## License\n\nRevitMCPSDK is licensed under the MIT License. See the LICENSE file for details.\n\n## Support\n\nFor support, please open an issue on the [GitHub repository](https://github.com/DTDucas/RevitMCPSDK/issues).\n\n## Author\n\nDuong Tran Quang - DTDucas\n\nCopyright © 2025 Duong Tran Quang - DTDucas","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtducas%2Frevitmcpsdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtducas%2Frevitmcpsdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtducas%2Frevitmcpsdk/lists"}