keyshot-mcp 0.8.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,53 +6,66 @@
6
6
 
7
7
  [English](#english) | [中文](#中文)
8
8
 
9
- KeyShot MCP is a local [Model Context Protocol](https://modelcontextprotocol.io/)
10
- server for inspecting, editing, and rendering KeyShot scenes through KeyShot
11
- headless scripting. It lets an MCP-compatible AI agent perform repeatable product
12
- visualization tasks while scenes, models, licenses, and rendered files remain on
13
- the local computer.
9
+ > **Useful for your KeyShot workflow? Star the repository to help other designers discover it.**
10
+ >
11
+ > **如果它改善了你的 KeyShot 工作流,欢迎点一个 Star,让更多设计师发现这个项目。**
12
+
13
+ KeyShot MCP connects an MCP-compatible AI agent to a licensed KeyShot installation
14
+ on the same computer. It can inspect scenes, import models, apply materials, set
15
+ cameras and environments, save scene copies, and render images through KeyShot
16
+ headless scripting. Models, scenes, licenses, and renders stay local.
14
17
 
15
18
  ![KeyShot MCP workflow](assets/workflow.svg)
16
19
 
17
20
  ## English
18
21
 
19
- ### What it can do
22
+ ### Quick start for designers
23
+
24
+ The easiest setup is to send this prompt to an agent that can edit your MCP
25
+ configuration:
26
+
27
+ ```text
28
+ Install KeyShot MCP 0.9.1 and configure it in my MCP client.
20
29
 
21
- - Inspect scene objects, materials, cameras, model sets, and external references.
22
- - Import models and optionally center them, place them on the ground, update the
23
- camera target, and adjust the environment.
24
- - Render one camera, selected cameras, every camera in a scene, or a sequential
25
- render queue.
26
- - Create and update cameras by position, look-at point, distance, field of view,
27
- focal length, or reusable presets.
28
- - Apply materials directly or through a local material preset library.
29
- - Select environments, change brightness, and rotate the active environment.
30
- - Save edited scenes to a controlled output directory.
31
- - Prepare and render a product from a model or existing scene in one tool call.
30
+ 1. Use: npx -y keyshot-mcp@0.9.1
31
+ 2. Find my local keyshot_headless.exe and set KEYSHOT_HEADLESS_EXE to its full path.
32
+ 3. Keep outputs in the default KeyShot MCP Outputs folder unless I choose another safe folder.
33
+ 4. Keep KEYSHOT_ALLOW_EXTERNAL_OUTPUTS disabled.
34
+ 5. Restart or reload the MCP client and run keyshot_status.
35
+ 6. Explain any problem and its suggested fix in plain language.
36
+ 7. Do not upload or publish my KeyShot files, renders, or license information.
37
+ ```
32
38
 
33
- ### Requirements and compatibility
39
+ After setup, try:
40
+
41
+ ```text
42
+ Check whether KeyShot MCP is ready, then prepare a standard-quality product render
43
+ from C:\models\speaker.obj.
44
+ ```
45
+
46
+ ### Requirements
34
47
 
35
48
  - Node.js 20 or newer.
36
- - A locally installed and licensed KeyShot version with headless scripting.
49
+ - A locally installed and licensed KeyShot edition with headless scripting.
37
50
  - Windows 11 with KeyShot Studio 2025 / KeyShot 14.1 is tested.
38
- - Other KeyShot versions may work when they expose the same official scripting
39
- APIs, but they are not currently verified by this project.
40
- - KeyShot and its license are not included.
51
+ - Other KeyShot versions may work when they expose the same scripting APIs, but
52
+ they are not currently verified by this project.
53
+ - KeyShot, its license, materials, and environments are not included.
41
54
 
42
55
  ### Install
43
56
 
44
- The current release is `0.8.0`.
57
+ The current release is `0.9.1`.
45
58
 
46
- #### Option 1: run with npx
59
+ #### Run with npx
47
60
 
48
- This requires no global npm installation:
61
+ No global npm installation is required:
49
62
 
50
63
  ```json
51
64
  {
52
65
  "mcpServers": {
53
66
  "keyshot": {
54
67
  "command": "npx",
55
- "args": ["-y", "keyshot-mcp@0.8.0"],
68
+ "args": ["-y", "keyshot-mcp@0.9.1"],
56
69
  "env": {
57
70
  "KEYSHOT_HEADLESS_EXE": "C:/Program Files/KeyShot Studio/bin/keyshot_headless.exe"
58
71
  }
@@ -61,10 +74,10 @@ This requires no global npm installation:
61
74
  }
62
75
  ```
63
76
 
64
- #### Option 2: install globally
77
+ #### Install globally
65
78
 
66
79
  ```bash
67
- npm install -g keyshot-mcp@0.8.0
80
+ npm install -g keyshot-mcp@0.9.1
68
81
  ```
69
82
 
70
83
  ```json
@@ -80,7 +93,7 @@ npm install -g keyshot-mcp@0.8.0
80
93
  }
81
94
  ```
82
95
 
83
- #### Option 3: run from source
96
+ #### Run from source
84
97
 
85
98
  ```bash
86
99
  git clone https://github.com/truman-t3/keyshot-mcp.git
@@ -89,193 +102,144 @@ pnpm install
89
102
  pnpm build
90
103
  ```
91
104
 
92
- Configure the MCP client to run the absolute path to `dist/index.js`:
105
+ Point the MCP client to the absolute path of `dist/index.js`. Ready-to-edit examples
106
+ are available in [`examples`](examples).
93
107
 
94
- ```json
95
- {
96
- "mcpServers": {
97
- "keyshot": {
98
- "command": "node",
99
- "args": ["C:/absolute/path/to/keyshot-mcp/dist/index.js"],
100
- "env": {
101
- "KEYSHOT_HEADLESS_EXE": "C:/Program Files/KeyShot Studio/bin/keyshot_headless.exe"
102
- }
103
- }
104
- }
105
- }
106
- ```
108
+ Restart the MCP client after changing its configuration, then call
109
+ `keyshot_status`. The status result checks the MCP version, KeyShot executable,
110
+ output access, bridge files, preset JSON, and a minimal KeyShot startup.
107
111
 
108
- Restart the MCP client after changing its configuration.
112
+ ### Common workflows
109
113
 
110
- ### Agent installation prompt
114
+ #### One-call product render
111
115
 
112
- The following prompt can be pasted into a coding agent that is allowed to edit
113
- the MCP client configuration:
116
+ `keyshot_product_render` is the recommended high-level tool for ordinary product
117
+ work. It can import a model or open a scene, apply object-specific materials,
118
+ configure a camera and environment, save a scene copy, and render in one KeyShot
119
+ process.
114
120
 
115
121
  ```text
116
- Install KeyShot MCP 0.8.0 and configure it in my MCP client.
117
-
118
- 1. Find the local KeyShot headless executable.
119
- 2. Add an MCP server named "keyshot" that runs:
120
- npx -y keyshot-mcp@0.8.0
121
- 3. Set KEYSHOT_HEADLESS_EXE to the executable path.
122
- 4. Keep KEYSHOT_ALLOW_EXTERNAL_OUTPUTS disabled.
123
- 5. Restart or reload the MCP client, call keyshot_status, then use keyshot_product_render for a one-click product render.
124
- 6. Do not upload or publish any KeyShot scenes, models, renders, or license data.
122
+ Import C:\models\speaker.obj, center and ground it, use the Isometric camera preset,
123
+ set a 55 mm focal length, save a scene copy, and render a standard PNG.
125
124
  ```
126
125
 
127
- ### Configuration
128
-
129
- | Variable | Default | Purpose |
130
- | --- | --- | --- |
131
- | `KEYSHOT_HEADLESS_EXE` | `keyshot_headless.exe` on Windows | Absolute executable path or a command available on `PATH`. |
132
- | `KEYSHOT_OUTPUT_DIR` | Package-local `outputs` | Root directory for rendered images and saved scenes. |
133
- | `KEYSHOT_ALLOW_EXTERNAL_OUTPUTS` | `false` | Allows output paths outside `KEYSHOT_OUTPUT_DIR` when explicitly set to `true`. |
134
- | `KEYSHOT_TIMEOUT_MS` | `600000` | Timeout for one KeyShot headless process. |
135
- | `KEYSHOT_LICENSE_ARGS` | empty | Optional additional KeyShot launch arguments. |
136
- | `KEYSHOT_MATERIAL_PRESETS` | Built-in `presets/materials.json` | Path to a user-managed material preset file. |
137
- | `KEYSHOT_CAMERA_PRESETS` | Built-in `presets/cameras.json` | Path to a user-managed camera preset file. |
138
-
139
- Relative output paths are resolved inside `KEYSHOT_OUTPUT_DIR`. Parent traversal,
140
- adjacent-prefix paths, and symbolic-link escapes are rejected by default. Input
141
- scene, model, material, and environment paths may be located elsewhere.
142
-
143
- ### Tools
144
-
145
- | Tool | Purpose |
146
- | --- | --- |
147
- | `keyshot_status` | Verify that KeyShot headless can start and report its version. |
148
- | `keyshot_product_render` | Prepare, save, and render a model or existing scene in one headless process. |
149
- | `keyshot_inspect_scene` | Inspect objects, cameras, materials, model sets, and references. |
150
- | `keyshot_list_cameras` | List available camera names. |
151
- | `keyshot_render` | Render one image. |
152
- | `keyshot_render_queue` | Run independent render jobs sequentially. |
153
- | `keyshot_batch_render` | Render a supplied list of named cameras from one scene. |
154
- | `keyshot_render_all_cameras` | Discover and render every camera in one scene. |
155
- | `keyshot_import_model` | Import a model with optional composition adjustments. |
156
- | `keyshot_apply_material` | Apply a library material or material file. |
157
- | `keyshot_list_material_presets` | List local material presets. |
158
- | `keyshot_apply_material_preset` | Apply a named material preset. |
159
- | `keyshot_set_camera` | Create or update camera transform, distance, FOV, or focal length. |
160
- | `keyshot_list_camera_presets` | List standard and custom camera presets. |
161
- | `keyshot_apply_camera_preset` | Apply a standard or absolute-coordinate camera preset. |
162
- | `keyshot_set_environment` | Select or adjust an environment, brightness, or rotation. |
163
- | `keyshot_save_scene` | Save a scene to a new output path. |
164
-
165
- The server exposes 17 tools, a `keyshot_product_render` MCP prompt, and a
166
- `keyshot://workflow` resource.
126
+ For a new model, import composition options default to enabled. Existing scenes
127
+ keep their current composition unless explicit changes are requested.
167
128
 
168
- ### One-click product render
169
-
170
- In an MCP client, a designer can use a natural-language request:
129
+ #### Render every camera
171
130
 
172
131
  ```text
173
- Turn C:\models\speaker.obj into a product render. Center it, place it on the
174
- ground, use the Isometric camera preset, save the KeyShot scene, and render a
175
- 1600 x 1200 PNG with 128 samples.
132
+ Render every saved camera in C:\scenes\speaker.bip at preview quality. Continue if
133
+ one camera fails and do not overwrite existing images.
176
134
  ```
177
135
 
178
- The `keyshot_product_render` tool accepts either `modelPath` or `scenePath`. New
179
- models default to centered and grounded geometry with a `Product Hero`
180
- isometric camera. Existing scenes keep their current camera, materials, and
181
- environment unless explicit changes are requested.
136
+ Use `keyshot_batch_render` instead when only selected named cameras are required.
182
137
 
183
- ```json
184
- {
185
- "modelPath": "C:/models/speaker.obj",
186
- "outputScenePath": "speaker-product.bip",
187
- "outputPath": "speaker-product.png",
188
- "materialAssignments": [
189
- { "objectName": "Body", "presetName": "Brushed Steel" }
190
- ],
191
- "cameraPresetName": "Isometric",
192
- "focalLength": 55,
193
- "brightness": 1.2,
194
- "rotation": 45,
195
- "width": 1600,
196
- "height": 1200,
197
- "samples": 128
198
- }
199
- ```
200
-
201
- Use `renderMode: "allCameras"` with `outputDir` to render every named camera.
202
- Generated names are derived from the source filename when output paths are
203
- omitted. Existing files are protected by default; set `overwrite: true` only
204
- when replacement is intentional. Material assignments always require an
205
- explicit object and never overwrite the entire model implicitly.
138
+ #### Prepare a model without rendering
206
139
 
207
- ### Product composition examples
140
+ ```text
141
+ Import C:\models\speaker.obj, center it, place it on the ground, adjust the camera
142
+ target and environment, then save speaker-prepared.bip.
143
+ ```
208
144
 
209
- Import a model and prepare its initial composition:
145
+ #### Adjust camera and environment
210
146
 
211
147
  ```text
212
- Import C:\models\speaker.obj into KeyShot. Center the geometry, place it on the
213
- ground, update the camera look-at point and environment, then save the scene as
214
- speaker-prepared.bip.
148
+ Set the Product Hero camera to a 55 mm focal length and distance 6, rotate the
149
+ current environment to 45 degrees, save a new scene, then render a preview.
215
150
  ```
216
151
 
217
- The corresponding `keyshot_import_model` options are:
152
+ `fieldOfView` and `focalLength` cannot be used together. `position` and `lookAt`
153
+ are optional, but must be supplied as a pair. `samples` and `maxTimeSeconds` select
154
+ different KeyShot render modes and cannot be combined.
218
155
 
219
- ```json
220
- {
221
- "centerGeometry": true,
222
- "snapToGround": true,
223
- "adjustCameraLookAt": true,
224
- "adjustEnvironment": true
225
- }
226
- ```
156
+ ### Quality presets
227
157
 
228
- Create a product camera with one lens control:
158
+ | Preset | Resolution | Samples | Use |
159
+ | --- | ---: | ---: | --- |
160
+ | `preview` | 960 x 540 | 16 | Fast composition and material checks |
161
+ | `standard` | 1920 x 1080 | 64 | Default for `keyshot_product_render` |
162
+ | `final` | 3840 x 2160 | 256 | High-resolution final output |
229
163
 
230
- ```text
231
- Set the Product Hero camera to a 55 mm focal length and distance 6, save a new
232
- scene, then render a PNG preview.
233
- ```
164
+ Explicit `width`, `height`, and `samples` override the corresponding preset values.
165
+ Explicit `maxTimeSeconds` switches to time-based rendering instead of preset samples.
166
+ Lower-level render tools preserve their existing behavior when no preset is given.
234
167
 
235
- `fieldOfView` must be greater than `0` and less than `180`. `focalLength` accepts
236
- `5` to `200` mm. The two controls are mutually exclusive. `position` and
237
- `lookAt` are optional, but must be supplied together when changing the transform.
168
+ ### Tools
238
169
 
239
- Rotate the active HDRI or environment:
170
+ | Tool | Purpose |
171
+ | --- | --- |
172
+ | `keyshot_status` | Diagnose local configuration, output access, presets, and KeyShot startup. |
173
+ | `keyshot_product_render` | Prepare, save, and render a model or scene in one process. |
174
+ | `keyshot_inspect_scene` | List scene metadata, objects, cameras, materials, model sets, and references. |
175
+ | `keyshot_list_cameras` | Return saved camera names before a selected-camera render. |
176
+ | `keyshot_render` | Render one active or named camera. |
177
+ | `keyshot_render_queue` | Run independent render jobs sequentially. |
178
+ | `keyshot_batch_render` | Render selected named cameras from one scene. |
179
+ | `keyshot_render_all_cameras` | Discover and render every saved camera. |
180
+ | `keyshot_import_model` | Import a model into an empty or base scene and save it. |
181
+ | `keyshot_apply_material` | Apply a KeyShot material name or local material file to one object. |
182
+ | `keyshot_list_material_presets` | List configured material presets. |
183
+ | `keyshot_apply_material_preset` | Apply a configured material preset to one object. |
184
+ | `keyshot_set_camera` | Create or update camera transform, distance, FOV, or focal length. |
185
+ | `keyshot_list_camera_presets` | List standard and custom camera presets. |
186
+ | `keyshot_apply_camera_preset` | Create or update a camera from a preset. |
187
+ | `keyshot_set_environment` | Select or adjust an environment, brightness, and rotation. |
188
+ | `keyshot_save_scene` | Save an existing scene to a controlled output path. |
240
189
 
241
- ```text
242
- Rotate the current KeyShot environment to 45 degrees, save the edited scene,
243
- and render all cameras.
244
- ```
190
+ The server also exposes one MCP Prompt for product rendering and one MCP Resource
191
+ describing the KeyShot headless workflow. The bundled Agent Skill in
192
+ [`skills/keyshot-mcp`](skills/keyshot-mcp) teaches compatible agents how to install,
193
+ diagnose, and use the server safely.
245
194
 
246
- `rotation` accepts values from `0` inclusive to `360` exclusive.
195
+ ### Configuration
247
196
 
248
- For rendering, `samples` and `maxTimeSeconds` select different KeyShot render
249
- modes and cannot be supplied together.
197
+ | Variable | Default | Description |
198
+ | --- | --- | --- |
199
+ | `KEYSHOT_HEADLESS_EXE` | `D:\keyshot2025_183972\bin\keyshot_headless.exe` | Full executable path or a command available on `PATH`. |
200
+ | `KEYSHOT_OUTPUT_DIR` | `<home>/Documents/KeyShot MCP Outputs` | Root for rendered images and saved scenes. |
201
+ | `KEYSHOT_ALLOW_EXTERNAL_OUTPUTS` | `false` | Allow output outside the configured root only when explicitly set to `true`. |
202
+ | `KEYSHOT_TIMEOUT_MS` | `600000` | Timeout for one KeyShot process. |
203
+ | `KEYSHOT_LICENSE_ARGS` | empty | Optional launch arguments; diagnostics never echo their values. |
204
+ | `KEYSHOT_MATERIAL_PRESETS` | bundled JSON | Optional user-managed material preset file. |
205
+ | `KEYSHOT_CAMERA_PRESETS` | bundled JSON | Optional user-managed camera preset file. |
206
+
207
+ All KeyShot operations run sequentially to reduce license and output conflicts.
208
+ Input scenes and models may come from any local path. By default, generated images
209
+ and scenes must remain inside `KEYSHOT_OUTPUT_DIR`; `..`, sibling-prefix, and
210
+ symlink/junction escapes are rejected.
211
+
212
+ Automatically generated product outputs use `-2`, `-3`, and later suffixes when a
213
+ name already exists. Explicit output paths are not silently renamed. Operations
214
+ that support `overwrite` require it to be set deliberately before replacing files.
250
215
 
251
216
  ### Camera and material presets
252
217
 
253
- The built-in camera library includes Front, Back, Left, Right, Top, Bottom, and
254
- Isometric views. A custom `KEYSHOT_CAMERA_PRESETS` JSON file may contain standard
255
- views or absolute `position`, `lookAt`, and optional `up` vectors.
218
+ The bundled camera library contains Front, Back, Left, Right, Top, Bottom, and
219
+ Isometric standard views. A custom camera JSON may define a standard view or an
220
+ absolute `position`, `lookAt`, and optional `up` vector.
256
221
 
257
- Material presets are stored in JSON and reference KeyShot library material names
258
- or local material files. The MCP server reads preset files but does not modify
259
- them.
222
+ Material presets reference a KeyShot library material name or local material file.
223
+ The MCP server reads preset files but does not edit them automatically. See
224
+ [`presets`](presets) for the supported formats.
260
225
 
261
- ### Reproducible KeyShot smoke test
226
+ ### Reproducible KeyShot demo
262
227
 
263
228
  The repository includes a smoke test built from generated cube geometry in
264
- `examples/demo`. It verifies startup, import composition, scene inspection,
265
- camera presets, focal length, field of view, camera distance, environment
266
- rotation, scene saving, camera discovery, one-click model rendering, one-click
267
- existing-scene rendering, and real PNG output:
229
+ [`examples/demo`](examples/demo). It verifies startup, import composition, scene
230
+ inspection, camera presets, lens controls, environment rotation, scene saving,
231
+ camera discovery, one-call product rendering, and real PNG output.
268
232
 
269
233
  ```bash
270
234
  npm run smoke:keyshot
271
235
  ```
272
236
 
273
- Generated `.bip` files and test renders remain in the configured local output
274
- directory. The repository includes one representative result:
237
+ Generated `.bip` files and test renders stay in the configured local output
238
+ directory. A representative result is included below:
275
239
 
276
240
  ![KeyShot smoke test render](assets/demo/keyshot-mcp-demo.png)
277
241
 
278
- ### Development and tests
242
+ ### Development
279
243
 
280
244
  ```bash
281
245
  pnpm install
@@ -286,77 +250,73 @@ npm pack --dry-run
286
250
  ```
287
251
 
288
252
  CI runs on Windows and Ubuntu with Node.js 20 and 24. Linux CI validates the MCP
289
- server, bridge logic, and package; it does not claim that KeyShot itself runs on
290
- Linux.
253
+ server, bridge logic, metadata, and package; it does not claim that KeyShot itself
254
+ was tested on Linux.
291
255
 
292
256
  ### Roadmap
293
257
 
294
- - Verify additional KeyShot releases on real installations.
258
+ - Verify additional supported KeyShot releases on real installations.
295
259
  - Verify macOS installation and headless behavior.
296
- - Add depth-of-field and additional lens controls when stable headless APIs are
297
- available.
298
-
299
- ### License and security
260
+ - Add depth-of-field and additional lens controls when stable headless APIs exist.
300
261
 
301
- Released under the [MIT License](LICENSE). See [SECURITY.md](SECURITY.md) for
302
- security guidance and [CONTRIBUTING.md](CONTRIBUTING.md) for development notes.
303
- Do not commit KeyShot licenses, private scenes, customer assets, or unpublished
304
- renders.
262
+ ### License, security, and trademarks
305
263
 
306
- ### Trademark and project status
264
+ This project uses the [MIT License](LICENSE). See [SECURITY.md](SECURITY.md) for
265
+ security reporting and [CONTRIBUTING.md](CONTRIBUTING.md) for development guidance.
266
+ Do not commit licenses, private scenes, customer assets, or unpublished renders.
307
267
 
308
- KeyShot is a trademark of KeyShot ApS and/or KeyShot Inc. This is an independent,
309
- open-source community project and is not affiliated with, endorsed by, or
310
- sponsored by KeyShot.
311
-
312
- This project provides only an MCP integration. It does not include KeyShot
313
- Studio, KeyShot assets, or a KeyShot license. Users must install and license
314
- KeyShot Studio separately and comply with the applicable KeyShot terms. Do not
315
- use this project to bypass licensing, share credentials, or redistribute KeyShot
316
- software or proprietary resources.
268
+ KeyShot is a trademark of KeyShot ApS and/or KeyShot Inc. This independent
269
+ open-source community project is not affiliated with, endorsed by, sponsored by,
270
+ or otherwise associated with KeyShot. Users must install and license KeyShot
271
+ separately and comply with its applicable terms. This project must not be used to
272
+ bypass licensing or redistribute proprietary KeyShot software or assets.
317
273
 
318
274
  ---
319
275
 
320
276
  ## 中文
321
277
 
322
- KeyShot MCP 是一个本地运行的
323
- [Model Context Protocol](https://modelcontextprotocol.io/) 服务,通过 KeyShot
324
- headless 脚本让兼容 MCP AI Agent 检查、编辑和渲染 KeyShot 场景。场景、模型、
325
- 许可证和渲染文件均保留在本机。
278
+ ### 设计师快速开始
279
+
280
+ 最简单的安装方式,是把下面这段话发给能够修改 MCP 配置的 Agent
326
281
 
327
- ### 主要功能
282
+ ```text
283
+ 请安装 KeyShot MCP 0.9.1,并配置到我的 MCP 客户端。
328
284
 
329
- - 检查场景对象、材质、相机、模型集和外部引用。
330
- - 导入模型,并可选择自动居中、贴地、调整相机观察点和环境。
331
- - 渲染单个相机、指定相机、场景中的全部相机或顺序渲染队列。
332
- - 通过位置、观察点、距离、视野角、焦距或预设创建和更新相机。
333
- - 直接应用材质,或使用本地材质预设库。
334
- - 选择环境、调整亮度并旋转当前环境。
335
- - 将修改后的场景保存到受控输出目录。
336
- - 通过一次工具调用完成模型或现有场景的产品构图与渲染。
285
+ 1. 使用:npx -y keyshot-mcp@0.9.1
286
+ 2. 查找本机 keyshot_headless.exe,并把完整路径设置为 KEYSHOT_HEADLESS_EXE。
287
+ 3. 默认把结果保存在“文档/KeyShot MCP Outputs”,除非我明确选择其他安全目录。
288
+ 4. 保持 KEYSHOT_ALLOW_EXTERNAL_OUTPUTS 关闭。
289
+ 5. 重启或重新加载 MCP 客户端,然后运行 keyshot_status。
290
+ 6. 用普通设计师能理解的语言说明问题和修复建议。
291
+ 7. 不要上传或发布我的 KeyShot 文件、渲染图或许可证信息。
292
+ ```
337
293
 
338
- ### 运行要求与兼容性
294
+ 安装后可以这样说:
295
+
296
+ ```text
297
+ 检查 KeyShot MCP 是否准备就绪,然后用 C:\models\speaker.obj 生成一张标准质量的产品渲染图。
298
+ ```
299
+
300
+ ### 使用要求
339
301
 
340
302
  - Node.js 20 或更高版本。
341
- - 本机已安装并获得许可、且支持 headless 脚本的 KeyShot。
342
- - 已实测:Windows 11KeyShot Studio 2025 / KeyShot 14.1。
343
- - 其他 KeyShot 版本在提供相同官方脚本 API 时可能兼容,但本项目尚未完成实机验证。
344
- - 本项目不包含 KeyShot 软件或许可证。
303
+ - 本机已安装、合法授权并支持 headless 脚本的 KeyShot。
304
+ - 已实测 Windows 11 + KeyShot Studio 2025 / KeyShot 14.1。
305
+ - 暴露相同脚本 API 的其他 KeyShot 版本可能可用,但本项目暂未完成实机验证。
306
+ - 本项目不包含 KeyShot、许可证、官方材质或环境资源。
345
307
 
346
308
  ### 安装
347
309
 
348
- 当前版本为 `0.8.0`。
349
-
350
- #### 方式一:使用 npx
310
+ 当前正式版本为 `0.9.1`。
351
311
 
352
- 无需全局安装 npm 包:
312
+ #### 使用 npx 免安装运行
353
313
 
354
314
  ```json
355
315
  {
356
316
  "mcpServers": {
357
317
  "keyshot": {
358
318
  "command": "npx",
359
- "args": ["-y", "keyshot-mcp@0.8.0"],
319
+ "args": ["-y", "keyshot-mcp@0.9.1"],
360
320
  "env": {
361
321
  "KEYSHOT_HEADLESS_EXE": "C:/Program Files/KeyShot Studio/bin/keyshot_headless.exe"
362
322
  }
@@ -365,10 +325,10 @@ headless 脚本让兼容 MCP 的 AI Agent 检查、编辑和渲染 KeyShot 场
365
325
  }
366
326
  ```
367
327
 
368
- #### 方式二:全局安装
328
+ #### 全局安装
369
329
 
370
330
  ```bash
371
- npm install -g keyshot-mcp@0.8.0
331
+ npm install -g keyshot-mcp@0.9.1
372
332
  ```
373
333
 
374
334
  ```json
@@ -384,7 +344,7 @@ npm install -g keyshot-mcp@0.8.0
384
344
  }
385
345
  ```
386
346
 
387
- #### 方式三:从源码运行
347
+ #### 从源码运行
388
348
 
389
349
  ```bash
390
350
  git clone https://github.com/truman-t3/keyshot-mcp.git
@@ -393,174 +353,128 @@ pnpm install
393
353
  pnpm build
394
354
  ```
395
355
 
396
- MCP 客户端配置为运行 `dist/index.js` 的绝对路径:
356
+ MCP 客户端中填写 `dist/index.js` 的绝对路径。可编辑配置示例位于
357
+ [`examples`](examples)。修改配置后重启 MCP 客户端,再调用 `keyshot_status`。
397
358
 
398
- ```json
399
- {
400
- "mcpServers": {
401
- "keyshot": {
402
- "command": "node",
403
- "args": ["C:/absolute/path/to/keyshot-mcp/dist/index.js"],
404
- "env": {
405
- "KEYSHOT_HEADLESS_EXE": "C:/Program Files/KeyShot Studio/bin/keyshot_headless.exe"
406
- }
407
- }
408
- }
409
- }
410
- ```
359
+ 状态检查会验证 MCP 版本、KeyShot 可执行文件、输出目录、bridge、预设 JSON,
360
+ 并运行最小 KeyShot 启动测试。
411
361
 
412
- 修改配置后请重启或重新加载 MCP 客户端。
362
+ ### 常用工作流
413
363
 
414
- ### 复制给 Agent 的安装提示词
364
+ #### 一句话完成产品出图
415
365
 
416
- 下面的提示词适用于有权限修改 MCP 客户端配置的编程 Agent:
366
+ 普通产品工作优先使用 `keyshot_product_render`。它能在一个 KeyShot 进程中导入模型
367
+ 或打开场景、应用指定材质、调整相机和环境、保存场景副本并渲染图片。
417
368
 
418
369
  ```text
419
- 请帮我安装 KeyShot MCP 0.8.0,并添加到我的 MCP 客户端。
420
-
421
- 1. 查找本机 KeyShot headless 可执行文件。
422
- 2. 添加名为 keyshot 的 MCP server,运行:
423
- npx -y keyshot-mcp@0.8.0
424
- 3. 将 KEYSHOT_HEADLESS_EXE 设置为可执行文件路径。
425
- 4. 保持 KEYSHOT_ALLOW_EXTERNAL_OUTPUTS 关闭。
426
- 5. 重启或重新加载 MCP 客户端,调用 keyshot_status,然后使用 keyshot_product_render 一键完成产品出图。
427
- 6. 不要上传或发布任何 KeyShot 场景、模型、渲染图或许可证数据。
370
+ 导入 C:\models\speaker.obj,自动居中贴地,使用 Isometric 相机预设和 55 mm 焦距,
371
+ 保存场景副本并输出标准质量 PNG。
428
372
  ```
429
373
 
430
- ### 配置项
374
+ 新模型的导入构图选项默认开启;已有场景在没有明确要求时保留现有构图。
431
375
 
432
- | 环境变量 | 默认值 | 用途 |
433
- | --- | --- | --- |
434
- | `KEYSHOT_HEADLESS_EXE` | Windows 上为 `keyshot_headless.exe` | KeyShot headless 绝对路径,或系统 `PATH` 中的命令。 |
435
- | `KEYSHOT_OUTPUT_DIR` | 包内 `outputs` | 渲染图和已保存场景的根目录。 |
436
- | `KEYSHOT_ALLOW_EXTERNAL_OUTPUTS` | `false` | 明确设为 `true` 时允许写入输出根目录之外。 |
437
- | `KEYSHOT_TIMEOUT_MS` | `600000` | 单个 KeyShot headless 进程的超时时间。 |
438
- | `KEYSHOT_LICENSE_ARGS` | 空 | 可选的 KeyShot 启动参数。 |
439
- | `KEYSHOT_MATERIAL_PRESETS` | 内置 `presets/materials.json` | 自定义材质预设 JSON 路径。 |
440
- | `KEYSHOT_CAMERA_PRESETS` | 内置 `presets/cameras.json` | 自定义相机预设 JSON 路径。 |
441
-
442
- 相对输出路径会自动放入 `KEYSHOT_OUTPUT_DIR`。默认拒绝 `..`、相邻同名前缀目录和
443
- 软链接逃逸。输入场景、模型、材质和环境文件可位于其他目录。
444
-
445
- ### MCP 工具
446
-
447
- | 工具 | 用途 |
448
- | --- | --- |
449
- | `keyshot_status` | 检查 KeyShot headless 是否可启动并读取版本。 |
450
- | `keyshot_product_render` | 在一个 headless 进程中完成模型或场景准备、保存和渲染。 |
451
- | `keyshot_inspect_scene` | 检查对象、相机、材质、模型集和外部引用。 |
452
- | `keyshot_list_cameras` | 列出场景中的相机名称。 |
453
- | `keyshot_render` | 渲染一张图片。 |
454
- | `keyshot_render_queue` | 顺序执行多个独立渲染任务。 |
455
- | `keyshot_batch_render` | 渲染用户指定的一组相机。 |
456
- | `keyshot_render_all_cameras` | 自动发现并渲染场景中的全部相机。 |
457
- | `keyshot_import_model` | 导入模型并可选择自动构图。 |
458
- | `keyshot_apply_material` | 应用材质库名称或材质文件。 |
459
- | `keyshot_list_material_presets` | 列出本地材质预设。 |
460
- | `keyshot_apply_material_preset` | 应用指定材质预设。 |
461
- | `keyshot_set_camera` | 创建或更新相机变换、距离、视野角或焦距。 |
462
- | `keyshot_list_camera_presets` | 列出标准和自定义相机预设。 |
463
- | `keyshot_apply_camera_preset` | 应用标准视角或绝对坐标相机预设。 |
464
- | `keyshot_set_environment` | 选择环境并调整亮度或旋转角度。 |
465
- | `keyshot_save_scene` | 将场景保存到新的输出路径。 |
466
-
467
- 服务共提供 17 个工具,并提供 `keyshot_product_render` MCP 提示词和
468
- `keyshot://workflow` 资源。
469
-
470
- ### 一键产品出图
471
-
472
- 设计师可以直接在支持 MCP 的 Agent 中描述需求:
376
+ #### 渲染全部相机
473
377
 
474
378
  ```text
475
- C:\models\speaker.obj 做成产品渲染图。自动居中、贴地,使用 Isometric
476
- 相机预设,保存 KeyShot 场景,并用 128 采样渲染一张 1600 x 1200 PNG。
477
- ```
478
-
479
- `keyshot_product_render` 可以接收 `modelPath` 或 `scenePath`。新模型默认自动居中、
480
- 贴地并创建名为 `Product Hero` 的等轴测相机;已有场景默认保留当前相机、材质和环境,
481
- 只有明确提供参数时才修改。
482
-
483
- ```json
484
- {
485
- "modelPath": "C:/models/speaker.obj",
486
- "outputScenePath": "speaker-product.bip",
487
- "outputPath": "speaker-product.png",
488
- "materialAssignments": [
489
- { "objectName": "Body", "presetName": "Brushed Steel" }
490
- ],
491
- "cameraPresetName": "Isometric",
492
- "focalLength": 55,
493
- "brightness": 1.2,
494
- "rotation": 45,
495
- "width": 1600,
496
- "height": 1200,
497
- "samples": 128
498
- }
379
+ 用预览质量渲染 C:\scenes\speaker.bip 中的全部相机。某个相机失败时继续,
380
+ 并且不要覆盖已有图片。
499
381
  ```
500
382
 
501
- `renderMode` 设为 `allCameras` 并提供 `outputDir`,即可渲染场景中的全部命名相机。
502
- 省略输出路径时会根据源文件名自动生成。默认不会覆盖已有文件,只有明确设置
503
- `overwrite: true` 才会替换。材质指定必须包含明确的对象,不会隐式覆盖整个模型。
504
-
505
- ### 产品构图示例
383
+ 只渲染部分指定相机时,使用 `keyshot_batch_render`。
506
384
 
507
- 导入模型并完成初始构图:
385
+ #### 只整理模型,不渲染
508
386
 
509
387
  ```text
510
- C:\models\speaker.obj 导入 KeyShot,自动居中、贴地、调整相机观察点和环境,
388
+ 导入 C:\models\speaker.obj,自动居中、贴地、调整相机观察点和环境,
511
389
  然后保存为 speaker-prepared.bip。
512
390
  ```
513
391
 
514
- 对应的 `keyshot_import_model` 参数:
392
+ #### 调整相机和环境
515
393
 
516
- ```json
517
- {
518
- "centerGeometry": true,
519
- "snapToGround": true,
520
- "adjustCameraLookAt": true,
521
- "adjustEnvironment": true
522
- }
394
+ ```text
395
+ 把 Product Hero 相机设置为 55 mm 焦距、距离 6,把当前环境旋转到 45 度,
396
+ 保存新场景并渲染预览图。
523
397
  ```
524
398
 
525
- 设置产品相机:
399
+ `fieldOfView` 与 `focalLength` 不能同时使用。`position` 和 `lookAt` 可以省略,
400
+ 但修改位置时必须成对提供。`samples` 与 `maxTimeSeconds` 对应不同渲染模式,
401
+ 不能同时使用。
526
402
 
527
- ```text
528
- 把 Product Hero 相机设为 55 mm 焦距、距离 6,保存新场景并渲染 PNG 预览图。
529
- ```
403
+ ### 质量预设
530
404
 
531
- `fieldOfView` 必须大于 `0` 且小于 `180`;`focalLength` 支持 `5–200 mm`,
532
- 两者不能同时使用。`position` `lookAt` 可不填写,但修改相机位置时必须成对提供。
405
+ | 预设 | 分辨率 | 采样 | 用途 |
406
+ | --- | ---: | ---: | --- |
407
+ | `preview` | 960 x 540 | 16 | 快速检查构图和材质 |
408
+ | `standard` | 1920 x 1080 | 64 | `keyshot_product_render` 的默认值 |
409
+ | `final` | 3840 x 2160 | 256 | 高清最终输出 |
533
410
 
534
- 旋转当前 HDRI 或环境:
411
+ 显式填写的 `width`、`height` 和 `samples` 会分别覆盖预设值;填写
412
+ `maxTimeSeconds` 会改用限时渲染。底层渲染工具在没有指定预设时保持原有行为。
535
413
 
536
- ```text
537
- 把当前 KeyShot 环境旋转到 45 度,保存场景,然后渲染全部相机。
538
- ```
414
+ ### 工具
539
415
 
540
- `rotation` 支持大于等于 `0` 且小于 `360` 的数值。
416
+ | 工具 | 用途 |
417
+ | --- | --- |
418
+ | `keyshot_status` | 检查本机配置、输出目录、预设和 KeyShot 启动状态。 |
419
+ | `keyshot_product_render` | 在一个进程中整理、保存并渲染模型或场景。 |
420
+ | `keyshot_inspect_scene` | 查看场景、对象、相机、材质、模型集和外部引用。 |
421
+ | `keyshot_list_cameras` | 返回场景中的相机名称。 |
422
+ | `keyshot_render` | 渲染当前或指定相机。 |
423
+ | `keyshot_render_queue` | 顺序执行多个独立渲染任务。 |
424
+ | `keyshot_batch_render` | 渲染选定的多个相机。 |
425
+ | `keyshot_render_all_cameras` | 自动发现并渲染全部相机。 |
426
+ | `keyshot_import_model` | 导入模型并保存为场景。 |
427
+ | `keyshot_apply_material` | 给指定对象应用材质名称或本地材质文件。 |
428
+ | `keyshot_list_material_presets` | 列出材质预设。 |
429
+ | `keyshot_apply_material_preset` | 给指定对象应用材质预设。 |
430
+ | `keyshot_set_camera` | 创建或修改相机位置、距离、视野角或焦距。 |
431
+ | `keyshot_list_camera_presets` | 列出标准与自定义相机预设。 |
432
+ | `keyshot_apply_camera_preset` | 根据预设创建或修改相机。 |
433
+ | `keyshot_set_environment` | 选择或调整环境、亮度和旋转。 |
434
+ | `keyshot_save_scene` | 将场景保存到受控输出路径。 |
435
+
436
+ 服务还提供一个产品渲染 MCP Prompt,以及一个说明 headless 工作流程的 MCP Resource。
437
+ [`skills/keyshot-mcp`](skills/keyshot-mcp) 中的 Agent Skill 会指导兼容的 Agent 安装、
438
+ 诊断并安全使用这些工具。
439
+
440
+ ### 配置
441
+
442
+ | 环境变量 | 默认值 | 说明 |
443
+ | --- | --- | --- |
444
+ | `KEYSHOT_HEADLESS_EXE` | `D:\keyshot2025_183972\bin\keyshot_headless.exe` | 完整路径,或系统 `PATH` 中可执行的命令。 |
445
+ | `KEYSHOT_OUTPUT_DIR` | `<用户目录>/Documents/KeyShot MCP Outputs` | 渲染图和场景副本的根目录。 |
446
+ | `KEYSHOT_ALLOW_EXTERNAL_OUTPUTS` | `false` | 只有明确设为 `true` 时才允许写到输出根目录之外。 |
447
+ | `KEYSHOT_TIMEOUT_MS` | `600000` | 单次 KeyShot 进程超时时间。 |
448
+ | `KEYSHOT_LICENSE_ARGS` | 空 | 可选启动参数;诊断结果不会回显具体内容。 |
449
+ | `KEYSHOT_MATERIAL_PRESETS` | 内置 JSON | 可选的用户材质预设文件。 |
450
+ | `KEYSHOT_CAMERA_PRESETS` | 内置 JSON | 可选的用户相机预设文件。 |
541
451
 
542
- 渲染参数 `samples` 和 `maxTimeSeconds` 对应不同的 KeyShot 渲染模式,不能同时使用。
452
+ 所有 KeyShot 操作串行执行,减少许可证和文件冲突。输入模型和场景可以位于任意本地
453
+ 路径;生成的场景和图片默认只能写入 `KEYSHOT_OUTPUT_DIR`。系统会拒绝 `..`、同名前缀
454
+ 目录以及符号链接或目录联接逃逸。
455
+
456
+ 自动生成的产品输出遇到重名时会使用 `-2`、`-3` 等编号。用户明确填写的路径不会
457
+ 被静默改名;支持 `overwrite` 的操作只有在明确开启后才覆盖文件。
543
458
 
544
459
  ### 相机与材质预设
545
460
 
546
461
  内置相机库包含 Front、Back、Left、Right、Top、Bottom 和 Isometric 七个标准视角。
547
- 自定义 `KEYSHOT_CAMERA_PRESETS` JSON 可使用标准视角,也可提供绝对 `position`、
548
- `lookAt` 和可选 `up` 向量。
462
+ 自定义相机 JSON 可使用标准视角,也可提供绝对 `position`、`lookAt` 和可选 `up`。
549
463
 
550
- 材质预设通过 JSON 引用 KeyShot 材质库名称或本地材质文件。MCP 只读取预设文件,
551
- 不会自动修改它们。
464
+ 材质预设引用 KeyShot 材质库名称或本地材质文件。MCP 只读取预设文件,不自动修改。
465
+ 格式示例见 [`presets`](presets)。
552
466
 
553
- ### 可复现的 KeyShot smoke test
467
+ ### 可复现的 KeyShot Demo
554
468
 
555
- 仓库提供基于 `examples/demo` 生成立方体几何体的 smoke test,用于验证 KeyShot
556
- 启动、导入构图、场景检查、相机预设、焦距、视野角、相机距离、环境旋转、场景保存、
557
- 相机发现、模型一键出图、现有场景一键渲染全部相机和真实 PNG 输出:
469
+ 仓库使用 [`examples/demo`](examples/demo) 中生成的立方体几何体进行 smoke test
470
+ 验证启动、导入构图、场景检查、相机预设、镜头控制、环境旋转、场景保存、相机发现、
471
+ 一键产品出图和真实 PNG 输出。
558
472
 
559
473
  ```bash
560
474
  npm run smoke:keyshot
561
475
  ```
562
476
 
563
- 生成的 `.bip` 和测试渲染图只保留在配置的本地输出目录。仓库中包含一张代表性结果:
477
+ 生成的 `.bip` 和测试渲染图只保存在本地输出目录。仓库提供一张代表性结果:
564
478
 
565
479
  ![KeyShot smoke test 渲染图](assets/demo/keyshot-mcp-demo.png)
566
480
 
@@ -574,26 +488,22 @@ python -m unittest discover -s tests -p "test_*.py"
574
488
  npm pack --dry-run
575
489
  ```
576
490
 
577
- CI 在 Windows 和 Ubuntu 上使用 Node.js 20、24 运行。Linux CI 验证 MCP 服务、
578
- 桥接逻辑和 npm 包,不代表 KeyShot 软件已在 Linux 上通过实机测试。
491
+ CI 在 Windows 和 Ubuntu 上使用 Node.js 20、24Linux CI 验证 MCP 服务、bridge、
492
+ 元数据和 npm 包,不表示 KeyShot 软件已经在 Linux 上通过实机测试。
579
493
 
580
494
  ### 路线图
581
495
 
582
- - 在更多 KeyShot 正式版本上完成实机验证。
496
+ - 在更多受支持的 KeyShot 正式版本上完成实机验证。
583
497
  - 验证 macOS 安装和 headless 行为。
584
- - headless API 稳定支持后增加景深和更多镜头控制。
498
+ - 在稳定 headless API 可用后增加景深和更多镜头控制。
585
499
 
586
- ### 许可证与安全
500
+ ### 许可证、安全与商标
587
501
 
588
- 项目采用 [MIT License](LICENSE)。安全说明见 [SECURITY.md](SECURITY.md),开发说明
589
- [CONTRIBUTING.md](CONTRIBUTING.md)。请勿提交 KeyShot 许可证、私有场景、客户素材
502
+ 项目采用 [MIT License](LICENSE)。安全报告方式见 [SECURITY.md](SECURITY.md)
503
+ 开发说明见 [CONTRIBUTING.md](CONTRIBUTING.md)。请勿提交许可证、私有场景、客户素材
590
504
  或未公开渲染图。
591
505
 
592
- ### 商标与项目性质
593
-
594
- KeyShot KeyShot ApS 和/或 KeyShot Inc. 的商标。本项目是独立的开源社区项目,
595
- 与 KeyShot 官方无隶属、认可、赞助或其他合作关系。
596
-
597
- 本项目仅提供 MCP 集成功能,不包含 KeyShot Studio、KeyShot 官方素材或 KeyShot
598
- 许可证。用户必须自行安装并合法授权 KeyShot Studio,同时遵守适用的 KeyShot 条款。
599
- 不得使用本项目绕过许可证、共享账号凭据,或重新分发 KeyShot 软件及其专有资源。
506
+ KeyShot 是 KeyShot ApS 和/或 KeyShot Inc. 的商标。本项目是独立开源社区项目,
507
+ 与 KeyShot 官方无隶属、认可、赞助或其他合作关系。用户必须自行安装并合法授权
508
+ KeyShot,同时遵守适用条款。不得使用本项目绕过许可证或重新分发 KeyShot 专有软件
509
+ 及资源。