keyshot-mcp 0.9.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.9.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.9.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.9.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.9.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,211 +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.9.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.9.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` | `~/Documents/KeyShot MCP 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
- Run `keyshot_status` after installation. It reports the MCP and KeyShot
144
- versions, resolved executable, output write access, preset validity, headless
145
- startup result, and actionable suggestions. Additional KeyShot launch arguments
146
- are never included in the diagnostic output.
147
-
148
- ### Tools
149
-
150
- | Tool | Purpose |
151
- | --- | --- |
152
- | `keyshot_status` | Diagnose local configuration, output access, presets, and KeyShot headless startup. |
153
- | `keyshot_product_render` | Prepare, save, and render a model or existing scene in one headless process. |
154
- | `keyshot_inspect_scene` | Inspect objects, cameras, materials, model sets, and references. |
155
- | `keyshot_list_cameras` | List available camera names. |
156
- | `keyshot_render` | Render one image. |
157
- | `keyshot_render_queue` | Run independent render jobs sequentially. |
158
- | `keyshot_batch_render` | Render a supplied list of named cameras from one scene. |
159
- | `keyshot_render_all_cameras` | Discover and render every camera in one scene. |
160
- | `keyshot_import_model` | Import a model with optional composition adjustments. |
161
- | `keyshot_apply_material` | Apply a library material or material file. |
162
- | `keyshot_list_material_presets` | List local material presets. |
163
- | `keyshot_apply_material_preset` | Apply a named material preset. |
164
- | `keyshot_set_camera` | Create or update camera transform, distance, FOV, or focal length. |
165
- | `keyshot_list_camera_presets` | List standard and custom camera presets. |
166
- | `keyshot_apply_camera_preset` | Apply a standard or absolute-coordinate camera preset. |
167
- | `keyshot_set_environment` | Select or adjust an environment, brightness, or rotation. |
168
- | `keyshot_save_scene` | Save a scene to a new output path. |
169
-
170
- The server exposes 17 tools, a `keyshot_product_render` MCP prompt, and a
171
- `keyshot://workflow` resource.
172
-
173
- ### One-click product render
126
+ For a new model, import composition options default to enabled. Existing scenes
127
+ keep their current composition unless explicit changes are requested.
174
128
 
175
- In an MCP client, a designer can use a natural-language request:
129
+ #### Render every camera
176
130
 
177
131
  ```text
178
- Turn C:\models\speaker.obj into a product render. Center it, place it on the
179
- ground, use the Isometric camera preset, save the KeyShot scene, and render a
180
- 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.
181
134
  ```
182
135
 
183
- The `keyshot_product_render` tool accepts either `modelPath` or `scenePath`. New
184
- models default to centered and grounded geometry with a `Product Hero`
185
- isometric camera. Existing scenes keep their current camera, materials, and
186
- environment unless explicit changes are requested.
187
-
188
- One-click product rendering defaults to the `standard` quality preset. All
189
- rendering tools accept:
190
-
191
- | Preset | Resolution | Samples |
192
- | --- | ---: | ---: |
193
- | `preview` | 960 × 540 | 16 |
194
- | `standard` | 1920 × 1080 | 64 |
195
- | `final` | 3840 × 2160 | 256 |
136
+ Use `keyshot_batch_render` instead when only selected named cameras are required.
196
137
 
197
- Explicit `width`, `height`, or `samples` values override the corresponding
198
- preset value. `maxTimeSeconds` replaces preset samples. Explicit `samples` and
199
- `maxTimeSeconds` cannot be used together.
138
+ #### Prepare a model without rendering
200
139
 
201
- ```json
202
- {
203
- "modelPath": "C:/models/speaker.obj",
204
- "outputScenePath": "speaker-product.bip",
205
- "outputPath": "speaker-product.png",
206
- "materialAssignments": [
207
- { "objectName": "Body", "presetName": "Brushed Steel" }
208
- ],
209
- "cameraPresetName": "Isometric",
210
- "focalLength": 55,
211
- "brightness": 1.2,
212
- "rotation": 45,
213
- "qualityPreset": "standard"
214
- }
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.
215
143
  ```
216
144
 
217
- Use `renderMode: "allCameras"` with `outputDir` to render every named camera.
218
- Generated names are derived from the source filename when output paths are
219
- omitted. If an automatically named result exists, the scene and image receive
220
- the same `-2`, `-3`, and later suffix. Explicit output paths remain protected
221
- and return an error when occupied; set `overwrite: true` only when replacement
222
- is intentional. Material assignments always require an
223
- explicit object and never overwrite the entire model implicitly.
224
-
225
- ### Product composition examples
226
-
227
- Import a model and prepare its initial composition:
145
+ #### Adjust camera and environment
228
146
 
229
147
  ```text
230
- Import C:\models\speaker.obj into KeyShot. Center the geometry, place it on the
231
- ground, update the camera look-at point and environment, then save the scene as
232
- 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.
233
150
  ```
234
151
 
235
- 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.
236
155
 
237
- ```json
238
- {
239
- "centerGeometry": true,
240
- "snapToGround": true,
241
- "adjustCameraLookAt": true,
242
- "adjustEnvironment": true
243
- }
244
- ```
156
+ ### Quality presets
245
157
 
246
- 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 |
247
163
 
248
- ```text
249
- Set the Product Hero camera to a 55 mm focal length and distance 6, save a new
250
- scene, then render a PNG preview.
251
- ```
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.
252
167
 
253
- `fieldOfView` must be greater than `0` and less than `180`. `focalLength` accepts
254
- `5` to `200` mm. The two controls are mutually exclusive. `position` and
255
- `lookAt` are optional, but must be supplied together when changing the transform.
168
+ ### Tools
256
169
 
257
- 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. |
258
189
 
259
- ```text
260
- Rotate the current KeyShot environment to 45 degrees, save the edited scene,
261
- and render all cameras.
262
- ```
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.
263
194
 
264
- `rotation` accepts values from `0` inclusive to `360` exclusive.
195
+ ### Configuration
265
196
 
266
- For rendering, `samples` and `maxTimeSeconds` select different KeyShot render
267
- 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.
268
215
 
269
216
  ### Camera and material presets
270
217
 
271
- The built-in camera library includes Front, Back, Left, Right, Top, Bottom, and
272
- Isometric views. A custom `KEYSHOT_CAMERA_PRESETS` JSON file may contain standard
273
- 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.
274
221
 
275
- Material presets are stored in JSON and reference KeyShot library material names
276
- or local material files. The MCP server reads preset files but does not modify
277
- 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.
278
225
 
279
- ### Reproducible KeyShot smoke test
226
+ ### Reproducible KeyShot demo
280
227
 
281
228
  The repository includes a smoke test built from generated cube geometry in
282
- `examples/demo`. It verifies startup, import composition, scene inspection,
283
- camera presets, focal length, field of view, camera distance, environment
284
- rotation, scene saving, camera discovery, one-click model rendering, one-click
285
- 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.
286
232
 
287
233
  ```bash
288
234
  npm run smoke:keyshot
289
235
  ```
290
236
 
291
- Generated `.bip` files and test renders remain in the configured local output
292
- 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:
293
239
 
294
240
  ![KeyShot smoke test render](assets/demo/keyshot-mcp-demo.png)
295
241
 
296
- ### Development and tests
242
+ ### Development
297
243
 
298
244
  ```bash
299
245
  pnpm install
@@ -304,77 +250,73 @@ npm pack --dry-run
304
250
  ```
305
251
 
306
252
  CI runs on Windows and Ubuntu with Node.js 20 and 24. Linux CI validates the MCP
307
- server, bridge logic, and package; it does not claim that KeyShot itself runs on
308
- Linux.
253
+ server, bridge logic, metadata, and package; it does not claim that KeyShot itself
254
+ was tested on Linux.
309
255
 
310
256
  ### Roadmap
311
257
 
312
- - Verify additional KeyShot releases on real installations.
258
+ - Verify additional supported KeyShot releases on real installations.
313
259
  - Verify macOS installation and headless behavior.
314
- - Add depth-of-field and additional lens controls when stable headless APIs are
315
- available.
260
+ - Add depth-of-field and additional lens controls when stable headless APIs exist.
316
261
 
317
- ### License and security
262
+ ### License, security, and trademarks
318
263
 
319
- Released under the [MIT License](LICENSE). See [SECURITY.md](SECURITY.md) for
320
- security guidance and [CONTRIBUTING.md](CONTRIBUTING.md) for development notes.
321
- Do not commit KeyShot licenses, private scenes, customer assets, or unpublished
322
- renders.
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.
323
267
 
324
- ### Trademark and project status
325
-
326
- KeyShot is a trademark of KeyShot ApS and/or KeyShot Inc. This is an independent,
327
- open-source community project and is not affiliated with, endorsed by, or
328
- sponsored by KeyShot.
329
-
330
- This project provides only an MCP integration. It does not include KeyShot
331
- Studio, KeyShot assets, or a KeyShot license. Users must install and license
332
- KeyShot Studio separately and comply with the applicable KeyShot terms. Do not
333
- use this project to bypass licensing, share credentials, or redistribute KeyShot
334
- 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.
335
273
 
336
274
  ---
337
275
 
338
276
  ## 中文
339
277
 
340
- KeyShot MCP 是一个本地运行的
341
- [Model Context Protocol](https://modelcontextprotocol.io/) 服务,通过 KeyShot
342
- headless 脚本让兼容 MCP 的 AI Agent 检查、编辑和渲染 KeyShot 场景。场景、模型、
343
- 许可证和渲染文件均保留在本机。
278
+ ### 设计师快速开始
344
279
 
345
- ### 主要功能
280
+ 最简单的安装方式,是把下面这段话发给能够修改 MCP 配置的 Agent:
281
+
282
+ ```text
283
+ 请安装 KeyShot MCP 0.9.1,并配置到我的 MCP 客户端。
346
284
 
347
- - 检查场景对象、材质、相机、模型集和外部引用。
348
- - 导入模型,并可选择自动居中、贴地、调整相机观察点和环境。
349
- - 渲染单个相机、指定相机、场景中的全部相机或顺序渲染队列。
350
- - 通过位置、观察点、距离、视野角、焦距或预设创建和更新相机。
351
- - 直接应用材质,或使用本地材质预设库。
352
- - 选择环境、调整亮度并旋转当前环境。
353
- - 将修改后的场景保存到受控输出目录。
354
- - 通过一次工具调用完成模型或现有场景的产品构图与渲染。
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
+ ```
355
293
 
356
- ### 运行要求与兼容性
294
+ 安装后可以这样说:
295
+
296
+ ```text
297
+ 检查 KeyShot MCP 是否准备就绪,然后用 C:\models\speaker.obj 生成一张标准质量的产品渲染图。
298
+ ```
299
+
300
+ ### 使用要求
357
301
 
358
302
  - Node.js 20 或更高版本。
359
- - 本机已安装并获得许可、且支持 headless 脚本的 KeyShot。
360
- - 已实测:Windows 11KeyShot Studio 2025 / KeyShot 14.1。
361
- - 其他 KeyShot 版本在提供相同官方脚本 API 时可能兼容,但本项目尚未完成实机验证。
362
- - 本项目不包含 KeyShot 软件或许可证。
303
+ - 本机已安装、合法授权并支持 headless 脚本的 KeyShot。
304
+ - 已实测 Windows 11 + KeyShot Studio 2025 / KeyShot 14.1。
305
+ - 暴露相同脚本 API 的其他 KeyShot 版本可能可用,但本项目暂未完成实机验证。
306
+ - 本项目不包含 KeyShot、许可证、官方材质或环境资源。
363
307
 
364
308
  ### 安装
365
309
 
366
- 当前版本为 `0.9.0`。
310
+ 当前正式版本为 `0.9.1`。
367
311
 
368
- #### 方式一:使用 npx
369
-
370
- 无需全局安装 npm 包:
312
+ #### 使用 npx 免安装运行
371
313
 
372
314
  ```json
373
315
  {
374
316
  "mcpServers": {
375
317
  "keyshot": {
376
318
  "command": "npx",
377
- "args": ["-y", "keyshot-mcp@0.9.0"],
319
+ "args": ["-y", "keyshot-mcp@0.9.1"],
378
320
  "env": {
379
321
  "KEYSHOT_HEADLESS_EXE": "C:/Program Files/KeyShot Studio/bin/keyshot_headless.exe"
380
322
  }
@@ -383,10 +325,10 @@ headless 脚本让兼容 MCP 的 AI Agent 检查、编辑和渲染 KeyShot 场
383
325
  }
384
326
  ```
385
327
 
386
- #### 方式二:全局安装
328
+ #### 全局安装
387
329
 
388
330
  ```bash
389
- npm install -g keyshot-mcp@0.9.0
331
+ npm install -g keyshot-mcp@0.9.1
390
332
  ```
391
333
 
392
334
  ```json
@@ -402,7 +344,7 @@ npm install -g keyshot-mcp@0.9.0
402
344
  }
403
345
  ```
404
346
 
405
- #### 方式三:从源码运行
347
+ #### 从源码运行
406
348
 
407
349
  ```bash
408
350
  git clone https://github.com/truman-t3/keyshot-mcp.git
@@ -411,189 +353,128 @@ pnpm install
411
353
  pnpm build
412
354
  ```
413
355
 
414
- MCP 客户端配置为运行 `dist/index.js` 的绝对路径:
356
+ MCP 客户端中填写 `dist/index.js` 的绝对路径。可编辑配置示例位于
357
+ [`examples`](examples)。修改配置后重启 MCP 客户端,再调用 `keyshot_status`。
415
358
 
416
- ```json
417
- {
418
- "mcpServers": {
419
- "keyshot": {
420
- "command": "node",
421
- "args": ["C:/absolute/path/to/keyshot-mcp/dist/index.js"],
422
- "env": {
423
- "KEYSHOT_HEADLESS_EXE": "C:/Program Files/KeyShot Studio/bin/keyshot_headless.exe"
424
- }
425
- }
426
- }
427
- }
428
- ```
359
+ 状态检查会验证 MCP 版本、KeyShot 可执行文件、输出目录、bridge、预设 JSON,
360
+ 并运行最小 KeyShot 启动测试。
429
361
 
430
- 修改配置后请重启或重新加载 MCP 客户端。
362
+ ### 常用工作流
431
363
 
432
- ### 复制给 Agent 的安装提示词
364
+ #### 一句话完成产品出图
433
365
 
434
- 下面的提示词适用于有权限修改 MCP 客户端配置的编程 Agent:
366
+ 普通产品工作优先使用 `keyshot_product_render`。它能在一个 KeyShot 进程中导入模型
367
+ 或打开场景、应用指定材质、调整相机和环境、保存场景副本并渲染图片。
435
368
 
436
369
  ```text
437
- 请帮我安装 KeyShot MCP 0.9.0,并添加到我的 MCP 客户端。
438
-
439
- 1. 查找本机 KeyShot headless 可执行文件。
440
- 2. 添加名为 keyshot 的 MCP server,运行:
441
- npx -y keyshot-mcp@0.9.0
442
- 3. 将 KEYSHOT_HEADLESS_EXE 设置为可执行文件路径。
443
- 4. 保持 KEYSHOT_ALLOW_EXTERNAL_OUTPUTS 关闭。
444
- 5. 重启或重新加载 MCP 客户端,调用 keyshot_status,然后使用 keyshot_product_render 一键完成产品出图。
445
- 6. 不要上传或发布任何 KeyShot 场景、模型、渲染图或许可证数据。
370
+ 导入 C:\models\speaker.obj,自动居中贴地,使用 Isometric 相机预设和 55 mm 焦距,
371
+ 保存场景副本并输出标准质量 PNG。
446
372
  ```
447
373
 
448
- ### 配置项
449
-
450
- | 环境变量 | 默认值 | 用途 |
451
- | --- | --- | --- |
452
- | `KEYSHOT_HEADLESS_EXE` | Windows 上为 `keyshot_headless.exe` | KeyShot headless 绝对路径,或系统 `PATH` 中的命令。 |
453
- | `KEYSHOT_OUTPUT_DIR` | `~/Documents/KeyShot MCP Outputs` | 渲染图和已保存场景的根目录。 |
454
- | `KEYSHOT_ALLOW_EXTERNAL_OUTPUTS` | `false` | 明确设为 `true` 时允许写入输出根目录之外。 |
455
- | `KEYSHOT_TIMEOUT_MS` | `600000` | 单个 KeyShot headless 进程的超时时间。 |
456
- | `KEYSHOT_LICENSE_ARGS` | 空 | 可选的 KeyShot 启动参数。 |
457
- | `KEYSHOT_MATERIAL_PRESETS` | 内置 `presets/materials.json` | 自定义材质预设 JSON 路径。 |
458
- | `KEYSHOT_CAMERA_PRESETS` | 内置 `presets/cameras.json` | 自定义相机预设 JSON 路径。 |
459
-
460
- 相对输出路径会自动放入 `KEYSHOT_OUTPUT_DIR`。默认拒绝 `..`、相邻同名前缀目录和
461
- 软链接逃逸。输入场景、模型、材质和环境文件可位于其他目录。
462
-
463
- 安装后调用 `keyshot_status`,可检查 MCP 与 KeyShot 版本、实际可执行文件路径、
464
- 输出目录写入权限、预设文件和 headless 启动状态,并获得可直接执行的修复建议。
465
- 诊断结果不会回显额外的 KeyShot 启动参数。
466
-
467
- ### MCP 工具
468
-
469
- | 工具 | 用途 |
470
- | --- | --- |
471
- | `keyshot_status` | 诊断本地配置、输出权限、预设文件和 KeyShot headless 启动状态。 |
472
- | `keyshot_product_render` | 在一个 headless 进程中完成模型或场景准备、保存和渲染。 |
473
- | `keyshot_inspect_scene` | 检查对象、相机、材质、模型集和外部引用。 |
474
- | `keyshot_list_cameras` | 列出场景中的相机名称。 |
475
- | `keyshot_render` | 渲染一张图片。 |
476
- | `keyshot_render_queue` | 顺序执行多个独立渲染任务。 |
477
- | `keyshot_batch_render` | 渲染用户指定的一组相机。 |
478
- | `keyshot_render_all_cameras` | 自动发现并渲染场景中的全部相机。 |
479
- | `keyshot_import_model` | 导入模型并可选择自动构图。 |
480
- | `keyshot_apply_material` | 应用材质库名称或材质文件。 |
481
- | `keyshot_list_material_presets` | 列出本地材质预设。 |
482
- | `keyshot_apply_material_preset` | 应用指定材质预设。 |
483
- | `keyshot_set_camera` | 创建或更新相机变换、距离、视野角或焦距。 |
484
- | `keyshot_list_camera_presets` | 列出标准和自定义相机预设。 |
485
- | `keyshot_apply_camera_preset` | 应用标准视角或绝对坐标相机预设。 |
486
- | `keyshot_set_environment` | 选择环境并调整亮度或旋转角度。 |
487
- | `keyshot_save_scene` | 将场景保存到新的输出路径。 |
488
-
489
- 服务共提供 17 个工具,并提供 `keyshot_product_render` MCP 提示词和
490
- `keyshot://workflow` 资源。
374
+ 新模型的导入构图选项默认开启;已有场景在没有明确要求时保留现有构图。
491
375
 
492
- ### 一键产品出图
493
-
494
- 设计师可以直接在支持 MCP 的 Agent 中描述需求:
376
+ #### 渲染全部相机
495
377
 
496
378
  ```text
497
- C:\models\speaker.obj 做成产品渲染图。自动居中、贴地,使用 Isometric
498
- 相机预设,保存 KeyShot 场景,并用 128 采样渲染一张 1600 x 1200 PNG。
379
+ 用预览质量渲染 C:\scenes\speaker.bip 中的全部相机。某个相机失败时继续,
380
+ 并且不要覆盖已有图片。
499
381
  ```
500
382
 
501
- `keyshot_product_render` 可以接收 `modelPath` 或 `scenePath`。新模型默认自动居中、
502
- 贴地并创建名为 `Product Hero` 的等轴测相机;已有场景默认保留当前相机、材质和环境,
503
- 只有明确提供参数时才修改。
504
-
505
- 一键产品出图未指定质量时默认使用 `standard`。全部渲染工具都支持:
506
-
507
- | 预设 | 分辨率 | 采样 |
508
- | --- | ---: | ---: |
509
- | `preview` | 960 × 540 | 16 |
510
- | `standard` | 1920 × 1080 | 64 |
511
- | `final` | 3840 × 2160 | 256 |
512
-
513
- 显式填写的 `width`、`height` 或 `samples` 会分别覆盖预设值。
514
- `maxTimeSeconds` 会替代预设采样;不能同时显式提供 `samples` 和
515
- `maxTimeSeconds`。
516
-
517
- ```json
518
- {
519
- "modelPath": "C:/models/speaker.obj",
520
- "outputScenePath": "speaker-product.bip",
521
- "outputPath": "speaker-product.png",
522
- "materialAssignments": [
523
- { "objectName": "Body", "presetName": "Brushed Steel" }
524
- ],
525
- "cameraPresetName": "Isometric",
526
- "focalLength": 55,
527
- "brightness": 1.2,
528
- "rotation": 45,
529
- "qualityPreset": "standard"
530
- }
531
- ```
532
-
533
- 将 `renderMode` 设为 `allCameras` 并提供 `outputDir`,即可渲染场景中的全部命名相机。
534
- 省略输出路径时会根据源文件名自动生成。自动名称已存在时,场景和图片会统一增加
535
- `-2`、`-3` 等编号;用户明确填写的路径仍会严格防止覆盖。只有明确设置
536
- `overwrite: true` 才会替换。材质指定必须包含明确的对象,不会隐式覆盖整个模型。
537
-
538
- ### 产品构图示例
383
+ 只渲染部分指定相机时,使用 `keyshot_batch_render`。
539
384
 
540
- 导入模型并完成初始构图:
385
+ #### 只整理模型,不渲染
541
386
 
542
387
  ```text
543
- C:\models\speaker.obj 导入 KeyShot,自动居中、贴地、调整相机观察点和环境,
388
+ 导入 C:\models\speaker.obj,自动居中、贴地、调整相机观察点和环境,
544
389
  然后保存为 speaker-prepared.bip。
545
390
  ```
546
391
 
547
- 对应的 `keyshot_import_model` 参数:
392
+ #### 调整相机和环境
548
393
 
549
- ```json
550
- {
551
- "centerGeometry": true,
552
- "snapToGround": true,
553
- "adjustCameraLookAt": true,
554
- "adjustEnvironment": true
555
- }
394
+ ```text
395
+ 把 Product Hero 相机设置为 55 mm 焦距、距离 6,把当前环境旋转到 45 度,
396
+ 保存新场景并渲染预览图。
556
397
  ```
557
398
 
558
- 设置产品相机:
399
+ `fieldOfView` 与 `focalLength` 不能同时使用。`position` 和 `lookAt` 可以省略,
400
+ 但修改位置时必须成对提供。`samples` 与 `maxTimeSeconds` 对应不同渲染模式,
401
+ 不能同时使用。
559
402
 
560
- ```text
561
- 把 Product Hero 相机设为 55 mm 焦距、距离 6,保存新场景并渲染 PNG 预览图。
562
- ```
403
+ ### 质量预设
563
404
 
564
- `fieldOfView` 必须大于 `0` 且小于 `180`;`focalLength` 支持 `5–200 mm`,
565
- 两者不能同时使用。`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 | 高清最终输出 |
566
410
 
567
- 旋转当前 HDRI 或环境:
411
+ 显式填写的 `width`、`height` 和 `samples` 会分别覆盖预设值;填写
412
+ `maxTimeSeconds` 会改用限时渲染。底层渲染工具在没有指定预设时保持原有行为。
568
413
 
569
- ```text
570
- 把当前 KeyShot 环境旋转到 45 度,保存场景,然后渲染全部相机。
571
- ```
414
+ ### 工具
572
415
 
573
- `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 | 可选的用户相机预设文件。 |
574
451
 
575
- 渲染参数 `samples` 和 `maxTimeSeconds` 对应不同的 KeyShot 渲染模式,不能同时使用。
452
+ 所有 KeyShot 操作串行执行,减少许可证和文件冲突。输入模型和场景可以位于任意本地
453
+ 路径;生成的场景和图片默认只能写入 `KEYSHOT_OUTPUT_DIR`。系统会拒绝 `..`、同名前缀
454
+ 目录以及符号链接或目录联接逃逸。
455
+
456
+ 自动生成的产品输出遇到重名时会使用 `-2`、`-3` 等编号。用户明确填写的路径不会
457
+ 被静默改名;支持 `overwrite` 的操作只有在明确开启后才覆盖文件。
576
458
 
577
459
  ### 相机与材质预设
578
460
 
579
461
  内置相机库包含 Front、Back、Left、Right、Top、Bottom 和 Isometric 七个标准视角。
580
- 自定义 `KEYSHOT_CAMERA_PRESETS` JSON 可使用标准视角,也可提供绝对 `position`、
581
- `lookAt` 和可选 `up` 向量。
462
+ 自定义相机 JSON 可使用标准视角,也可提供绝对 `position`、`lookAt` 和可选 `up`。
582
463
 
583
- 材质预设通过 JSON 引用 KeyShot 材质库名称或本地材质文件。MCP 只读取预设文件,
584
- 不会自动修改它们。
464
+ 材质预设引用 KeyShot 材质库名称或本地材质文件。MCP 只读取预设文件,不自动修改。
465
+ 格式示例见 [`presets`](presets)。
585
466
 
586
- ### 可复现的 KeyShot smoke test
467
+ ### 可复现的 KeyShot Demo
587
468
 
588
- 仓库提供基于 `examples/demo` 生成立方体几何体的 smoke test,用于验证 KeyShot
589
- 启动、导入构图、场景检查、相机预设、焦距、视野角、相机距离、环境旋转、场景保存、
590
- 相机发现、模型一键出图、现有场景一键渲染全部相机和真实 PNG 输出:
469
+ 仓库使用 [`examples/demo`](examples/demo) 中生成的立方体几何体进行 smoke test
470
+ 验证启动、导入构图、场景检查、相机预设、镜头控制、环境旋转、场景保存、相机发现、
471
+ 一键产品出图和真实 PNG 输出。
591
472
 
592
473
  ```bash
593
474
  npm run smoke:keyshot
594
475
  ```
595
476
 
596
- 生成的 `.bip` 和测试渲染图只保留在配置的本地输出目录。仓库中包含一张代表性结果:
477
+ 生成的 `.bip` 和测试渲染图只保存在本地输出目录。仓库提供一张代表性结果:
597
478
 
598
479
  ![KeyShot smoke test 渲染图](assets/demo/keyshot-mcp-demo.png)
599
480
 
@@ -607,26 +488,22 @@ python -m unittest discover -s tests -p "test_*.py"
607
488
  npm pack --dry-run
608
489
  ```
609
490
 
610
- CI 在 Windows 和 Ubuntu 上使用 Node.js 20、24 运行。Linux CI 验证 MCP 服务、
611
- 桥接逻辑和 npm 包,不代表 KeyShot 软件已在 Linux 上通过实机测试。
491
+ CI 在 Windows 和 Ubuntu 上使用 Node.js 20、24Linux CI 验证 MCP 服务、bridge、
492
+ 元数据和 npm 包,不表示 KeyShot 软件已经在 Linux 上通过实机测试。
612
493
 
613
494
  ### 路线图
614
495
 
615
- - 在更多 KeyShot 正式版本上完成实机验证。
496
+ - 在更多受支持的 KeyShot 正式版本上完成实机验证。
616
497
  - 验证 macOS 安装和 headless 行为。
617
- - headless API 稳定支持后增加景深和更多镜头控制。
498
+ - 在稳定 headless API 可用后增加景深和更多镜头控制。
618
499
 
619
- ### 许可证与安全
500
+ ### 许可证、安全与商标
620
501
 
621
- 项目采用 [MIT License](LICENSE)。安全说明见 [SECURITY.md](SECURITY.md),开发说明
622
- [CONTRIBUTING.md](CONTRIBUTING.md)。请勿提交 KeyShot 许可证、私有场景、客户素材
502
+ 项目采用 [MIT License](LICENSE)。安全报告方式见 [SECURITY.md](SECURITY.md)
503
+ 开发说明见 [CONTRIBUTING.md](CONTRIBUTING.md)。请勿提交许可证、私有场景、客户素材
623
504
  或未公开渲染图。
624
505
 
625
- ### 商标与项目性质
626
-
627
- KeyShot KeyShot ApS 和/或 KeyShot Inc. 的商标。本项目是独立的开源社区项目,
628
- 与 KeyShot 官方无隶属、认可、赞助或其他合作关系。
629
-
630
- 本项目仅提供 MCP 集成功能,不包含 KeyShot Studio、KeyShot 官方素材或 KeyShot
631
- 许可证。用户必须自行安装并合法授权 KeyShot Studio,同时遵守适用的 KeyShot 条款。
632
- 不得使用本项目绕过许可证、共享账号凭据,或重新分发 KeyShot 软件及其专有资源。
506
+ KeyShot 是 KeyShot ApS 和/或 KeyShot Inc. 的商标。本项目是独立开源社区项目,
507
+ 与 KeyShot 官方无隶属、认可、赞助或其他合作关系。用户必须自行安装并合法授权
508
+ KeyShot,同时遵守适用条款。不得使用本项目绕过许可证或重新分发 KeyShot 专有软件
509
+ 及资源。