Skip to content

Commit 28584bb

Browse files
author
李锶厅(lisiting01)
committed
update readme
1 parent ddf331b commit 28584bb

File tree

3 files changed

+208
-186
lines changed

3 files changed

+208
-186
lines changed

LICENSE.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 77 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
# revit-mcp-plugin
22

3-
[Chinese Version](#简介)
3+
English | [简体中文](README_zh.md)
44

5-
# Introduction
5+
## Introduction
66

7-
The revit-mcp-plugin allows you to interact with Revit through the MCP protocol using the Claude client.
7+
revit-mcp-plugin is a Revit plugin based on the MCP protocol, enabling AI to interact with Revit.
88

9-
This project is the Revit client (receives messages, operates Revit) and needs to be used in conjunction with [revit-mcp](https://github.com/revit-mcp/revit-mcp) (provides tools to AI).
9+
This project is part of the revit-mcp project (receives messages, loads command sets, operates Revit), and needs to be used in conjunction with [revit-mcp](https://github.com/revit-mcp/revit-mcp) (provides tools to AI) and [revit-mcp-commandset](https://github.com/revit-mcp/revit-mcp-commandset) (specific feature implementations).
1010

1111
## Environment Requirements
12-
* Revit 2019
12+
13+
- Revit 2019~2024
1314

1415
## Usage Instructions
1516

1617
### Register Plugin
18+
1719
Register the plugin and restart Revit:
1820

1921
```xml
2022
<?xml version="1.0" encoding="utf-8"?>
2123
<RevitAddIns>
2224
<AddIn Type="Application">
2325
<Name>revit-mcp</Name>
24-
<Assembly>revit-mcp-plugin.dll</Assembly>
26+
<Assembly>%your_path%\revit-mcp-plugin.dll</Assembly>
2527
<FullClassName>revit_mcp_plugin.Core.Application</FullClassName>
2628
<ClientId>090A4C8C-61DC-426D-87DF-E4BAE0F80EC1</ClientId>
2729
<VendorId>revit-mcp</VendorId>
@@ -30,190 +32,100 @@ Register the plugin and restart Revit:
3032
</RevitAddIns>
3133
```
3234

33-
### Enable Service
34-
Add-in Modules -> mcp -> Start mcp service listening
35-
36-
### Adding Commands
37-
To add commands, you only need to focus on the Commands directory (specific command implementation) and the Core/SocketService.cs file (command registration).
35+
`%your_path%` needs to be replaced with the actual path after compilation.
3836

39-
Each command in the Commands directory is divided into two parts:
40-
* `XXXCommand` is responsible for parsing parameters and triggering event handlers, while also handling timeouts and errors
41-
* `XXXEventHandler` is responsible for the actual operation, using transactions to ensure atomicity
37+
### Configure Commands
4238

43-
Commands need to be registered in the RegisterCommands method of SocketService before they can be called by the mcp service.
39+
Add-in Modules -> Revit MCP Plugin -> Settings
4440

45-
**Process**
46-
1. Create a new feature subdirectory in the `Commands` directory (e.g., `Commands/window/`)
47-
2. Add an event handler (e.g., `CreateWindowEventHandler.cs`), which is based on Revit's external event
48-
3. Add a command class (e.g., `CreateWindowCommand.cs`), which parses information from the mcp server and calls the handler for implementation
49-
4. Register the new command in the `RegisterCommands` method of `SocketService`
50-
51-
## Project File Organization
41+
This interface is used to configure the commands to be loaded into Revit. Click OpenCommandSetFolder to open the folder storing command sets. A typical command set folder structure looks like this:
5242

5343
```
54-
revit_mcp/
55-
├── Core/
56-
│ ├── Application.cs # Application entry point
57-
│ ├── MCPServiceConnection.cs # Revit external command
58-
│ ├── SocketService.cs # Socket service implementation
59-
│ └── JsonRPC/ # JSON-RPC related classes
60-
│ ├── JsonRPCRequest.cs # Request model
61-
│ ├── JsonRPCResponse.cs # Response model
62-
│ ├── JsonRPCErrorCodes.cs # Error code constants
63-
│ └── JsonRPCSerializer.cs # Serialization/deserialization helper
64-
65-
├── Commands/
66-
│ ├── Interfaces/ # Command interfaces
67-
│ │ ├── IRevitCommand.cs # Command interface
68-
│ │ └── IWaitableExternalEventHandler.cs # Event wait handler interface
69-
│ │
70-
│ ├── Base/
71-
│ │ └── ExternalEventCommandBase.cs # External event-based command base class
72-
│ │
73-
│ ├── Registry/
74-
│ │ └── RevitCommandRegistry.cs # Command registration
75-
│ │
76-
│ ├── Wall/ # Wall-related commands
77-
│ │ ├── CreateWallEventHandler.cs # Create wall event handler
78-
│ │ └── CreateWallCommand.cs # Create wall command
79-
│ │
80-
│ └── Code/ # Code execution related commands
81-
│ ├── ExecuteCodeEventHandler.cs # Execute code event handler
82-
│ └── ExecuteCodeCommand.cs # Execute code command
83-
84-
├── Utils/ # Utility classes
85-
86-
└── Models/ # Data models
44+
CommandSetName/
45+
├── 2019/ # Compatible executable files for different versions
46+
├── 2020/
47+
├── 2021/
48+
├── 2022/
49+
├── 2023/
50+
├── 2024/
51+
└── command.json # Configuration file
8752
```
8853

89-
### Core Directory
90-
1. **Application.cs**: Application entry point, responsible for initializing the plugin
91-
2. **MCPServiceConnection.cs**: Revit external command, used to start the service
92-
3. **SocketService.cs**: Socket service implementation, responsible for communicating with external clients
93-
4. **JsonRPC Directory**: Contains classes and implementations related to the JSON-RPC protocol
94-
95-
### Commands Directory
96-
1. **Interfaces Directory**: Command-related interface definitions
97-
2. **Base Directory**: Contains base class implementations for commands
98-
3. **Registry Directory**: Command registration and management
99-
4. **Functional Directories** (Wall, Code, etc.): Contains specific functionality commands and event handlers
100-
101-
### Utils Directory
102-
Contains various utility classes to help handle repeatedly used functionality.
103-
104-
### Models Directory
105-
Contains data model classes used to pass data between different parts of the system.
106-
107-
108-
109-
## 简介
110-
111-
revit-mcp-plugin 允许你使用claude客户端通过 MCP 协议与 Revit 进行交互。
112-
113-
本项目是revit客户端(接收信息,操作revit),还需要配合[revit-mcp](https://github.com/revit-mcp/revit-mcp)(向AI提供tools)使用。
114-
115-
## 环境要求
116-
117-
- revit 2019
118-
119-
## 使用方法
120-
121-
### 注册插件
54+
Successfully identified commands need to be checked to be loaded and used.
12255

123-
注册插件,重启Revit
124-
125-
```
126-
<?xml version="1.0" encoding="utf-8"?>
127-
<RevitAddIns>
128-
<AddIn Type="Application">
129-
<Name>revit-mcp</Name>
130-
<Assembly>revit-mcp-plugin.dll</Assembly>
131-
<FullClassName>revit_mcp_plugin.Core.Application</FullClassName>
132-
<ClientId>090A4C8C-61DC-426D-87DF-E4BAE0F80EC1</ClientId>
133-
<VendorId>revit-mcp</VendorId>
134-
<VendorDescription>https://github.com/revit-mcp/revit-mcp-plugin</VendorDescription>
135-
</AddIn>
136-
</RevitAddIns>
137-
```
138-
139-
### 启用服务
140-
141-
附加模块->mcp->开启mcp服务监听
142-
143-
## 添加命令
144-
145-
对于添加命令,仅需要聚焦Commands目录(命令的具体实现)以及Core/SocketService.cs文件(注册命令)
56+
### Enable Service
14657

147-
Commands中的每一个命令分为两个部分:
58+
Add-in -> Revit MCP Plugin -> Revit MCP Switch
14859

149-
- `XXXCommand`负责解析参数并触发事件处理程序,同时处理超时和错误
150-
- `XXXEventHandler`负责实际的操作,使用事务确保操作的原子性
60+
Open the service to allow AI to discover your Revit program. Now AI can control your Revit!
15161

152-
命令需要在SocketService中的RegisterCommands注册后才能被mcp服务调用
62+
> Note: If you modify the configured commands after enabling the service, you may need to restart REVIT for the configuration to take effect. This is related to whether the command has already been registered.
15363
154-
**流程**
64+
## Custom Commands
15565

156-
1.`Commands`目录下创建新的功能子目录(例如`Commands/window/`
157-
2. 添加事件处理器(例如`CreateWindowEventHandler.cs`),事件处理器基于Revit的外部事件
158-
3. 添加命令类(例如`CreateWindowCommand.cs`),解析来自mcp服务器的信息,调用处理器实现
159-
4.`SocketService``RegisterCommands`方法中注册新命令
66+
You can refer to the [revit-mcp-commandset](https://github.com/revit-mcp/revit-mcp-commandset) project to develop custom commands.
16067

161-
## 项目文件组织
68+
## Project File Organization
16269

16370
```
164-
revit_mcp/
165-
├── Core/
166-
│ ├── Application.cs # 应用程序入口点
167-
│ ├── MCPServiceConnection.cs # Revit外部命令
168-
│ ├── SocketService.cs # Socket服务实现
169-
│ └── JsonRPC/ # JSON-RPC相关类
170-
│ ├── JsonRPCRequest.cs # 请求模型
171-
│ ├── JsonRPCResponse.cs # 响应模型
172-
│ ├── JsonRPCErrorCodes.cs # 错误代码常量
173-
│ └── JsonRPCSerializer.cs # 序列化/反序列化帮助类
71+
revit-mcp-plugin/
72+
├── Configuration/ # Configuration management related classes
73+
│ ├── CommandConfig.cs # Command configuration
74+
│ ├── ConfigurationManager.cs # Configuration manager
75+
│ ├── DeveloperInfo.cs # Developer information
76+
│ ├── FrameworkConfig.cs # Framework configuration
77+
│ └── ServiceSettings.cs # Service settings
78+
79+
├── Core/ # Program entry and core functionality
80+
│ ├── Application.cs # Application entry point
81+
│ ├── CommandExecutor.cs # Command executor
82+
│ ├── CommandManager.cs # Command manager
83+
│ ├── ExternalEventManager.cs # External event manager
84+
│ ├── MCPServiceConnection.cs # MCP service connection
85+
│ ├── RevitCommandRegistry.cs # Revit command registration
86+
│ ├── Settings.cs # Application settings
87+
│ └── SocketService.cs # Socket service implementation
17488
175-
├── Commands/
176-
│ ├── Interfaces/ # 命令接口
177-
│ │ ├── IRevitCommand.cs # 命令接口
178-
│ │ └── IWaitableExternalEventHandler.cs # 事件等待处理器接口
179-
│ │
180-
│ ├── Base/
181-
│ │ └── ExternalEventCommandBase.cs # 基于外部事件的命令基类
182-
│ │
183-
│ ├── Registry/
184-
│ │ └── RevitCommandRegistry.cs # 命令注册
185-
│ │
186-
│ ├── Wall/ # 墙相关命令
187-
│ │ ├── CreateWallEventHandler.cs # 创建墙事件处理器
188-
│ │ └── CreateWallCommand.cs # 创建墙命令
189-
│ │
190-
│ └── Code/ # 代码执行相关命令
191-
│ ├── ExecuteCodeEventHandler.cs # 执行代码事件处理器
192-
│ └── ExecuteCodeCommand.cs # 执行代码命令
89+
├── Models/ # Data models
90+
│ └── ... # Various data model classes
19391
194-
├── Utils/ # 工具类
92+
├── UI/ # WPF form interfaces
93+
│ └── ... # Interface related classes
19594
196-
└── Models/ # 数据模型
95+
└── Utils/ # Utility classes
96+
├── Logger.cs # Logging utility
97+
└── PathManager.cs # Path management utility
19798
```
19899

199-
### Core 目录
100+
### Configuration Directory
101+
Responsible for managing various configuration information for the plugin:
200102

201-
1. **Application.cs**: 应用程序入口点,负责初始化插件
202-
2. **MCPServiceConnection.cs**: Revit外部命令,用于启动服务
203-
3. **SocketService.cs**: Socket服务实现,负责与外部客户端通信
204-
4. **JsonRPC目录**: 包含JSON-RPC协议相关的类和实现
103+
- CommandConfig.cs: Defines command-related configuration
104+
- ConfigurationManager.cs: Manages loading, saving, and accessing configurations
105+
- DeveloperInfo.cs: Stores developer-related information
106+
- FrameworkConfig.cs: Framework-level configuration settings
107+
- ServiceSettings.cs: Service-related settings
205108

206-
### Commands 目录
109+
### Core Directory
110+
Contains the core functionality and entry point of the plugin:
207111

208-
1. **Interfaces目录**: 命令相关接口定义
209-
2. **Base目录**: 包含命令的基类实现
210-
3. **Registry目录**: 命令注册和管理
211-
4. **功能性目录** (Wall, Code等): 包含特定功能的命令和事件处理器
112+
- Application.cs: Application entry point, responsible for initializing the plugin
113+
- CommandExecutor.cs: Core component responsible for executing Revit commands
114+
- CommandManager.cs: Manages and dispatches various commands in the plugin
115+
- ExternalEventManager.cs: Manages Revit external events
116+
- MCPServiceConnection.cs: MCP service connection
117+
- RevitCommandRegistry.cs: Registers and manages available Revit commands
118+
- Settings.cs: Triggers the display of the settings interface
119+
- SocketService.cs: Implements Socket communication with external clients
212120

213-
### Utils 目录
121+
### Models Directory
122+
Contains data model classes used to pass data between different parts of the system.
214123

215-
包含各种工具类,帮助处理重复使用的功能。
124+
### UI Directory
125+
Contains user interface related components of the plugin, implemented using the WPF framework.
216126

217-
### Models 目录
127+
### Utils Directory
128+
Provides various auxiliary tools:
218129

219-
包含数据模型类,用于在系统各部分之间传递数据。
130+
- Logger.cs: Logging tool for debugging and error tracking
131+
- PathManager.cs: Project-related file path management

0 commit comments

Comments
 (0)