mcp-3d-printer-server 1.2.4 → 1.2.9
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/CHANGELOG.md +21 -0
- package/README.md +81 -8
- package/dist/blender-mcp-bridge.d.ts +10 -0
- package/dist/blender-mcp-bridge.js +473 -0
- package/dist/http-server.d.ts +2 -0
- package/dist/http-server.js +8 -0
- package/dist/index.js +148 -112
- package/dist/printers/bambu.js +7 -1
- package/dist/sse-server.d.ts +2 -0
- package/dist/sse-server.js +8 -0
- package/package.json +28 -11
- package/src/blender-mcp-bridge.ts +430 -0
- package/src/http-server.ts +9 -0
- package/src/index.ts +215 -131
- package/src/printers/bambu.ts +7 -1
- package/src/sse-server.ts +9 -0
- package/dist/index.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.2.9
|
|
4
|
+
|
|
5
|
+
- Address Bambu FTPS upload failures reported in #22 by using TLS 1.2 control
|
|
6
|
+
and data channels with explicit host identity and verified session reuse,
|
|
7
|
+
including the Node 22/24 wrapped-socket session regression. Physical X1C firmware
|
|
8
|
+
confirmation remains outstanding; no printer commands were sent in testing.
|
|
9
|
+
- Port standard Blender MCP discovery, tool forwarding, and verified STL edit
|
|
10
|
+
support from the Bambu fork. Preserve this server's legacy shell/stdin bridge.
|
|
11
|
+
- Validate binary STL edits in bounded memory and cap ASCII inputs at 4 MiB.
|
|
12
|
+
- Apply edit deadlines and cancellation to STL validation as well as MCP calls.
|
|
13
|
+
- Require the Bambu model on raw print starts and upload-with-print, matching
|
|
14
|
+
the fork's safety checks. Keep uploads without printing available.
|
|
15
|
+
- Isolate server and inline-upload scratch paths to prevent filename traversal
|
|
16
|
+
and collisions from overwriting or deleting unrelated files.
|
|
17
|
+
- Refresh vulnerable dependencies, pin the supported bambu-node API version,
|
|
18
|
+
declare the TypeScript build dependency, build before npm packing, and report
|
|
19
|
+
the actual package version during MCP initialization.
|
|
20
|
+
- Keep generated dist files out of Git and validate clean builds, protocols,
|
|
21
|
+
package installation, and Docker builds in CI.
|
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@ Thank you to the [FULU Foundation](https://github.com/FULU-Foundation/OrcaSlicer
|
|
|
8
8
|
[](https://www.npmjs.com/package/mcp-3d-printer-server)
|
|
9
9
|
[](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
|
|
10
10
|
[](https://www.typescriptlang.org/)
|
|
11
|
-
[](https://github.com/
|
|
11
|
+
[](https://github.com/DMontgomery40/mcp-3D-printer-server/graphs/commit-activity)
|
|
12
12
|
[](https://makeapullrequest.com)
|
|
13
13
|
[](https://nodejs.org/en/download/)
|
|
14
14
|
[](https://www.npmjs.com/package/mcp-3d-printer-server)
|
|
15
|
-
[](https://github.com/
|
|
15
|
+
[](https://github.com/DMontgomery40/mcp-3D-printer-server)
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
<a href="https://glama.ai/mcp/servers/7f6v2enbgk">
|
|
@@ -25,7 +25,7 @@ Thank you to the [FULU Foundation](https://github.com/FULU-Foundation/OrcaSlicer
|
|
|
25
25
|
- **Dual Local Transports:** Added explicit `stdio` and `streamable-http` runtime modes with environment-based transport selection.
|
|
26
26
|
- **FULU OrcaSlicer-bambulab Support:** Added `orcaslicer-bambulab` / `fulu_orca` slicer support for Bambu project 3MF export, and made it the default Bambu slicer target when no slicer is configured.
|
|
27
27
|
- **Bambu Reliability Pass:** Fixed Bambu argument wiring bugs, added FTP-backed file operations, improved status refresh behavior, and implemented practical command paths for `startJob`, `setTemperature`, and `print_3mf`.
|
|
28
|
-
- **Blender
|
|
28
|
+
- **Blender MCP:** Discover and call a standard Blender MCP server with `blender_mcp_status` and `blender_mcp_call`, or prepare and execute STL edits with verified output through `blender_mcp_edit_model`.
|
|
29
29
|
- **Transport Behavior Tests:** Added real behavior tests for both transports (`initialize`, `tools/list`, success + failing `tools/call`, origin rejection).
|
|
30
30
|
- **Docker Modernization:** Updated Docker build flow to work without BuildKit-specific features and verified streamable HTTP initialization in container smoke testing.
|
|
31
31
|
|
|
@@ -154,7 +154,8 @@ npm install -g mcp-3d-printer-server
|
|
|
154
154
|
```bash
|
|
155
155
|
git clone https://github.com/dmontgomery40/mcp-3d-printer-server.git
|
|
156
156
|
cd mcp-3d-printer-server
|
|
157
|
-
npm
|
|
157
|
+
npm ci
|
|
158
|
+
npm run build
|
|
158
159
|
npm link # Makes the command available globally
|
|
159
160
|
```
|
|
160
161
|
|
|
@@ -256,6 +257,13 @@ MCP_HTTP_ALLOWED_ORIGINS=http://localhost
|
|
|
256
257
|
|
|
257
258
|
# Optional bridge command for blender_mcp_edit_model execute=true mode
|
|
258
259
|
BLENDER_MCP_BRIDGE_COMMAND=
|
|
260
|
+
|
|
261
|
+
# Accept per-call executable selectors instead of reading commands and paths
|
|
262
|
+
# from server environment configuration. Off by default: slicer_path,
|
|
263
|
+
# bridge_command, and active-probe path overrides can select which local
|
|
264
|
+
# executable launches. MCP_ALLOW_BRIDGE_COMMAND_ARG remains a legacy alias for
|
|
265
|
+
# bridge commands and bridge-derived probe paths only.
|
|
266
|
+
MCP_ALLOW_EXECUTABLE_ARG=false
|
|
259
267
|
```
|
|
260
268
|
|
|
261
269
|
## Usage
|
|
@@ -393,6 +401,16 @@ Ask your MCP client to call `check_fulu_orca_setup`, or call it from an agent wi
|
|
|
393
401
|
|
|
394
402
|
The result reports missing payload files, install/verify commands, the MCP env values to use, and bridge handshake/capability/runtime info when probing is enabled.
|
|
395
403
|
|
|
404
|
+
> **Per-call executable selectors require `MCP_ALLOW_EXECUTABLE_ARG=1`.**
|
|
405
|
+
> By default the bridge command and its derived paths are read from server environment
|
|
406
|
+
> configuration. Passing `bridge_command`, or passing `slicer_path`, `plugin_dir`, or
|
|
407
|
+
> `runtime_dir` with `run_bridge_probe=true`, returns an error naming the opt-in flag.
|
|
408
|
+
> Non-executing setup inspection can still use the path arguments without the flag. These values
|
|
409
|
+
> select which local executable this server launches, so accepting them for a probe lets whatever
|
|
410
|
+
> is steering the model — a downloaded model's description, a README in an archive, 3MF metadata —
|
|
411
|
+
> choose that program. The same gate applies to `slicer_path` on slicing tools. Set the
|
|
412
|
+
> flag only for trusted iterative diagnostics; leave it off for normal use.
|
|
413
|
+
|
|
396
414
|
#### FULU Bridge RPC
|
|
397
415
|
|
|
398
416
|
`fulu_bambu_network_rpc` speaks the FULU bridge frame protocol from the MCP side. The protocol is little-endian binary frames with JSON bodies, using methods such as `bridge.handshake`, `bridge.capabilities`, `bridge.runtime_info`, and `net.get_user_print_info`.
|
|
@@ -453,6 +471,59 @@ Anthropic and Cloudflare independently demonstrated this pattern reduces MCP tok
|
|
|
453
471
|
|
|
454
472
|
This applies to all MCP servers, not just this one.
|
|
455
473
|
|
|
474
|
+
### Blender MCP
|
|
475
|
+
|
|
476
|
+
Set `BLENDER_MCP_COMMAND` to the executable for your standard stdio Blender
|
|
477
|
+
MCP server (for example the full path to `uvx`) and `BLENDER_MCP_ARGS` to a
|
|
478
|
+
JSON argument array such as `["blender-mcp"]`. Install and enable the matching
|
|
479
|
+
addon in Blender, then start its connection. Both processes must be able to
|
|
480
|
+
access the same local files. Printer tools work without Blender configured.
|
|
481
|
+
|
|
482
|
+
1. Call `blender_mcp_status` with `{"connect":true}` to initialize the server
|
|
483
|
+
and inspect its advertised tools and input schemas.
|
|
484
|
+
2. Call `blender_mcp_call` with a discovered `tool_name` and `arguments`.
|
|
485
|
+
For example, use `get_scene_info` with `{"user_prompt":"Inspect my scene"}`
|
|
486
|
+
when advertised. Preserve the user's request in `user_prompt` when the
|
|
487
|
+
remote schema asks for it. MCP images, errors, and metadata are preserved.
|
|
488
|
+
3. Use `blender_mcp_edit_model` for an STL import/edit/export operation:
|
|
489
|
+
|
|
490
|
+
```json
|
|
491
|
+
{
|
|
492
|
+
"stl_path": "/path/to/model.stl",
|
|
493
|
+
"output_path": "/path/to/model-edited.stl",
|
|
494
|
+
"operations": ["decimate:0.5"],
|
|
495
|
+
"user_prompt": "Reduce the triangle count for printing",
|
|
496
|
+
"execute": false
|
|
497
|
+
}
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
The default preview validates inputs and returns the generated Python without
|
|
501
|
+
launching Blender. Omitting `output_path` selects a unique `model-edited-<id>.stl`
|
|
502
|
+
beside the input; reuse the returned path when executing a previewed plan. Set `execute` to `true` to apply the edit. Supported operations
|
|
503
|
+
are `decimate:<ratio>` (greater than zero through one), `remesh:<positive voxel
|
|
504
|
+
size in STL units>`, and `boolean_union:<STL path>`. The helper requires Object
|
|
505
|
+
Mode, preserves existing scene objects and selection, and publishes a new STL
|
|
506
|
+
only after checking a matching export receipt and a finite triangle mesh.
|
|
507
|
+
Binary STLs are validated in small chunks and may be up to 256 MiB. ASCII STLs
|
|
508
|
+
are limited to 4 MiB; export larger meshes as binary STL.
|
|
509
|
+
Existing input and output files are never overwritten. Inspect the result
|
|
510
|
+
before slicing: valid STL geometry does not guarantee printability.
|
|
511
|
+
|
|
512
|
+
`BLENDER_MCP_TIMEOUT_MS` defaults to 120000 (range 100–300000). Requests have
|
|
513
|
+
bounded connection/discovery/call deadlines, close their child connection,
|
|
514
|
+
and never automatically replay interrupted edits. After an interruption,
|
|
515
|
+
inspect Blender before retrying because an edit may already have started.
|
|
516
|
+
The edit deadline also covers input and output validation; cancellation stops
|
|
517
|
+
validation between file reads, including scans of Boolean operands.
|
|
518
|
+
MCP connection success alone does not prove the Blender addon is connected.
|
|
519
|
+
|
|
520
|
+
Legacy `BLENDER_MCP_BRIDGE_COMMAND` shell commands remain supported. They
|
|
521
|
+
receive JSON on stdin containing `modelPath`, `operations`, and `source`, plus
|
|
522
|
+
`stlPath` and the same JSON in `MCP_BLENDER_PAYLOAD` for fork compatibility.
|
|
523
|
+
Their result reports `output_verified: false`. Per-call executable overrides
|
|
524
|
+
still require `MCP_ALLOW_EXECUTABLE_ARG=1` (or the legacy bridge-only opt-in).
|
|
525
|
+
The standard MCP executable and its arguments are always server configuration.
|
|
526
|
+
|
|
456
527
|
## Supported Printer Management Systems
|
|
457
528
|
|
|
458
529
|
### OctoPrint
|
|
@@ -488,7 +559,7 @@ Repetier-Server is a host software for 3D printers.
|
|
|
488
559
|
Bambu Lab printers use MQTT for status and control and FTP for file operations.
|
|
489
560
|
|
|
490
561
|
- Authentication: Serial number and access token required (set `BAMBU_SERIAL` and `BAMBU_TOKEN`)
|
|
491
|
-
- Printer model: **Required** (set `BAMBU_MODEL`). Valid values: `p1s`, `p1p`, `x1c`, `x1e`, `a1`, `a1mini`, `h2d`.
|
|
562
|
+
- Printer model: **Required** (set `BAMBU_MODEL`). Valid values: `p1s`, `p1p`, `x1c`, `x1e`, `a1`, `a1mini`, `h2d`. The guard applies to `start_print` and `upload_gcode` with `print=true` as well as the slicing/3MF paths. Pre-sliced files must already match the physical printer; the model setting does not inspect or convert their G-code.
|
|
492
563
|
- Requirements: Printer must be on the same network with Developer Mode and LAN Only Mode enabled
|
|
493
564
|
- Compatible with: X1C, X1E, P1S, P1P, A1, A1 Mini, H2D
|
|
494
565
|
|
|
@@ -866,6 +937,8 @@ For Bambu printers, this dispatches firmware G-code temperature commands (`M104`
|
|
|
866
937
|
|
|
867
938
|
Inspects the FULU OrcaSlicer-bambulab executable, platform runtime payload, setup commands, and optional BambuNetwork bridge probe.
|
|
868
939
|
|
|
940
|
+
The `bridge_command` shown below requires `MCP_ALLOW_EXECUTABLE_ARG=1`; otherwise it is read from `FULU_BAMBU_BRIDGE_COMMAND`. See [Check The Setup Through MCP](#check-the-setup-through-mcp).
|
|
941
|
+
|
|
869
942
|
```json
|
|
870
943
|
{
|
|
871
944
|
"platform": "darwin",
|
|
@@ -990,7 +1063,7 @@ Due to the nature of the Bambu Lab printer API, there are some limitations:
|
|
|
990
1063
|
|
|
991
1064
|
3. **Temperature control path:** Temperature updates are implemented through G-code command dispatch (`M104`/`M140`) over MQTT, so effective behavior still depends on printer firmware acceptance and current printer state.
|
|
992
1065
|
|
|
993
|
-
4. **File transfer channel:** Uploads use Bambu's FTPS path (port 990) directly through `basic-ftp` with implicit TLS. Some read/list operations still use `bambu-js` helpers.
|
|
1066
|
+
4. **File transfer channel:** Uploads use Bambu's FTPS path (port 990) directly through `basic-ftp` with implicit TLS 1.2 on both channels, allowing the data connection to reuse the control session. TLS options also explicitly preserve the printer host identity on the data connection, fixing [Node session binding](https://github.com/nodejs/node/issues/64402) on current Node 22/24. TLS 1.2 avoids additional TLS 1.3 session-ticket timing differences. The compatibility path is tested against a local FTPS server; confirmation on the reporting X1C firmware is still needed. Some read/list operations still use `bambu-js` helpers.
|
|
994
1067
|
|
|
995
1068
|
5. **Direct start path scope:** `startJob` currently targets `.gcode` files on printer storage; `.3mf` jobs should be initiated through `print_3mf` so metadata and plate selection are handled.
|
|
996
1069
|
|
|
@@ -1045,11 +1118,11 @@ Prompt injection is an open problem for tool-using agents. Practical mitigations
|
|
|
1045
1118
|
| [](https://www.npmjs.com/package/mcp-3d-printer-server) | The current version of the package on npm |
|
|
1046
1119
|
| [](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) | This project is licensed under GPL-2.0 |
|
|
1047
1120
|
| [](https://www.typescriptlang.org/) | This project is written in TypeScript 4.9+ |
|
|
1048
|
-
| [](https://github.com/
|
|
1121
|
+
| [](https://github.com/DMontgomery40/mcp-3D-printer-server/graphs/commit-activity) | This project is actively maintained |
|
|
1049
1122
|
| [](https://makeapullrequest.com) | We welcome contributions via Pull Requests |
|
|
1050
1123
|
| [](https://nodejs.org/en/download/) | Requires Node.js 18.0.0 or higher |
|
|
1051
1124
|
| [](https://www.npmjs.com/package/mcp-3d-printer-server) | Number of downloads per month from npm |
|
|
1052
|
-
| [](https://github.com/
|
|
1125
|
+
| [](https://github.com/DMontgomery40/mcp-3D-printer-server) | Number of GitHub stars this project has received |
|
|
1053
1126
|
|
|
1054
1127
|
## License
|
|
1055
1128
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
type Arguments = Record<string, unknown>;
|
|
3
|
+
export declare class BlenderMcpBridge {
|
|
4
|
+
private session;
|
|
5
|
+
private invoke;
|
|
6
|
+
status(args: Arguments, signal?: AbortSignal): Promise<unknown>;
|
|
7
|
+
call(args: Arguments, signal?: AbortSignal): Promise<CallToolResult>;
|
|
8
|
+
edit(args: Arguments, legacyCommand?: string, signal?: AbortSignal): Promise<unknown>;
|
|
9
|
+
}
|
|
10
|
+
export {};
|