prusactl

io.github.trevin-leev0.1.4更新于 Sep 29, 2026

Run a Prusa 3D printer: status, camera, files, printing, G-code, over PrusaLink or Prusa Connect.

已验证STDIO仅桌面Media & DesignDeveloper Tools

安装

在 SourceWeft 中

  1. 打开 控制台中的 prusactl,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

prusactl

Hand your Prusa 3D printer to an AI agent.
An MCP server that talks to the printer directly on your network, and through Prusa Connect from anywhere, with a small CLI to set it up and check on it.

[CI] [Go version] [MCP server] [License: MIT]


prusactl mcp gives an agent such as Claude hands on your printer. It can:

  • Watch: check state, temperatures, job progress, and (with Connect) the camera.
  • Print: upload files, start them, pause, resume, and stop, and (with Connect) queue them.
  • Control: heat, home, move, load and unload filament, and level the bed: through Connect at any time, or as G-code while the printer is idle.
  • Answer the printer: press the buttons on dialogs shown on its screen, such as runout or errors. Needs Connect.
  • Run G-code: any G-code, over the direct connection, while the printer is idle.

It is one Go binary with no browser involved. Setup is two terminal prompts.

Things you can ask

How's the print going? Show me the camera.

Print ~/Downloads/bracket.bgcode.

Preheat for PETG.

Object 3 is spaghetti. Cancel just that one.

The printer is showing a dialog. What does it say?

What did I print this week, and how many failed?

The camera, cancelling one object, reading a dialog, and print history go through Prusa Connect, so those need prusactl login; the rest works directly.

Install

Homebrew (macOS and Linux):

sh
brew install trevin-lee/tap/prusactl

This builds prusactl from source, so Homebrew installs Go first if you don't have it; the build itself takes seconds. Tab completion for bash, zsh, and fish comes with it. Update with brew upgrade prusactl. To remove it, see Uninstall.

Installed prusactl 0.1.3 or earlier? That was a cask. Switch once with brew uninstall --cask prusactl && brew update && brew install trevin-lee/tap/prusactl. Your saved printer and Prusa Connect session are kept.

A downloaded binary: get the archive for your system from Releases: macOS (universal), Linux (x86-64, ARM64, ARMv7 such as a Raspberry Pi), or Windows (x86-64, ARM64). checksums.txt lists their SHA-256 sums.

sh
tar -xzf prusactl_*_linux_arm64.tar.gz   # macOS and Linux: unpack the one you downloadedsudo install prusactl /usr/local/bin/    # or any other folder on your PATH

On Windows, unzip it and put prusactl.exe in a folder on your PATH. The binaries aren't code-signed: if macOS won't open it because it can't verify the developer, run xattr -d com.apple.quarantine /usr/local/bin/prusactl. To update, replace the file with a newer release. prusactl help completion shows how to add Tab completion.

Go:

sh
go install github.com/trevin-lee/prusactl/cmd/prusactl@latest

This puts it in $(go env GOPATH)/bin, which needs to be on your PATH. It needs Go 1.26.6 or newer; recent Go versions fetch that on their own.

Check it worked with prusactl --version.

Uninstall

First remove what prusactl saved: prusactl setup --forget deletes the printer's address and password, and prusactl logout deletes the Prusa Connect session. Then remove the program with brew uninstall prusactl, or by deleting the file. All that's left is a prusactl folder holding an empty lock file, in your config directory (~/Library/Application Support on macOS, ~/.config on Linux, %AppData% on Windows); delete it too if you like.

Quick start

sh
prusactl setup 192.168.1.50    # the printer's address; asks for its PrusaLink passwordprusactl status
prusactl login                 # optional: Prusa Connect, for remote access, camera, dialogs

The PrusaLink password is on the printer under Settings → Network → PrusaLink. PrusaLink is on by default; if someone turned it off, turn it back on there.

setup saves one printer for the direct route; running it again for another printer replaces the first (it says so). With several printers, set up the one you use most and reach the others through Prusa Connect.

Connect an AI agent

Claude Code:

sh
claude mcp add --scope user prusa -- "$(command -v prusactl)" mcp

$(command -v prusactl) saves the full path, so it works even when the app isn't started from a terminal that has your PATH.

Any other MCP client: add prusactl as a stdio server, using the path that command -v prusactl prints (where prusactl on Windows):

json
{  "mcpServers": {    "prusa": { "command": "/opt/homebrew/bin/prusactl", "args": ["mcp"] }  }}

The MCP bundle: each release includes prusactl.mcpb, which carries its own copy of prusactl for macOS, Linux x86-64, and Windows x86-64. Open it in an app that installs MCPB extensions, such as Claude Desktop (double-click the file), and enter the printer's address and PrusaLink password when asked. The bundle covers the direct route; Prusa Connect sign-in still needs prusactl login from an installed copy.

prusactl is also listed in the MCP Registry as io.github.trevin-lee/prusactl, for clients that browse it.

How it works

mermaid
flowchart LR    agent["AI agent<br/>(Claude Code, …)"] -- "MCP over stdio" --> px["prusactl"]    you["You, in a terminal"] --> px    px -- "local network<br/>PrusaLink API" --> printer["Your printer"]    px -. "internet, optional" .-> connect["Prusa Connect"]    connect <-.-> printer    px --- keychain[("OS keychain")]

prusactl reaches the printer two ways, and each tool picks one:

Direct (PrusaLink)Prusa Connect
Set up withprusactl setup and the password on the printer's screenprusactl login with your Prusa Account
Reaches the printerOn your networkFrom anywhere
Status, files, upload, print, pause/resume/stop✅✅
Heat, move, filament, leveling✅ via run_gcode (printer idle)✅ via firmware commands
Any G-code✅❌
Camera, on-screen dialogs, queue, history, events❌✅

The direct route is used whenever the printer answers. Otherwise, or for Connect-only features, the tool goes through Connect. Every result says which route it used.

Signing in to Prusa Connect

prusactl login asks for your Prusa Account email and password, plus a 2FA code if your account has one. It fills in Prusa's own login page over HTTPS the same way a browser would. It then trades the resulting code for tokens, using the OAuth + PKCE flow of the Connect web app.

  • Your password is sent only to account.prusa3d.com and is never stored.
  • Where tokens are kept: the OS keychain (macOS Keychain, Secret Service, or Windows Credential Manager), under the service prusactl. A machine without one, such as a headless Raspberry Pi, gets secrets.json in prusactl's config directory instead, readable only by you; PRUSACTL_KEYRING=file forces that.
  • Staying signed in: tokens refresh on their own. Prusa rotates refresh tokens, so refreshes are coordinated between processes. Several agents can share one session without signing each other out.
  • Google or Apple sign-in accounts need a Prusa Account password set before this works.

The printer's PrusaLink password is kept in the same keychain.

MCP tools

ToolRouteWhat it does
connection_statusbothHow the printer can be reached right now, and what to set up
list_printers, get_printerbothState, temperatures, job progress, and (via Connect) any dialog on screen
list_printer_files, delete_printer_filesbothBrowse or clean up the printer's storage
download_printer_filedirectCopy a file from the printer to this computer, e.g. to check the slicer settings a print used
upload_filebothSend a local .bgcode/.gcode to the printer, and optionally start or queue it
start_printbothPrint a file already on the printer
control_printbothPause, resume, or stop
get_transfersbothFile transfers in progress
run_gcodedirectRun G-code, such as heating, homing, moving, or filament changes, while the printer is idle
get_camera_snapshotConnectLatest camera image, with how old it is
respond_to_dialogConnectPress a button on the printer's screen
list_supported_commands, send_command, get_commandConnectEvery firmware command Connect exposes, with arguments and allowed states
get_queue, add_to_queue, remove_from_queueConnectThe print queue
list_jobs, get_jobConnectPrint history, and the objects in a job that can be cancelled
get_telemetry, list_eventsConnectTelemetry history and the event log
list_connect_filesConnectConnect cloud storage
api_requestbothAny other endpoint: /api/... goes to the printer, /app/... to Connect

Every printer argument accepts a name, serial number, or Connect UUID. With one printer you can leave it out. via: "direct" or via: "connect" forces a route.

CLI

text
prusactl setup [ADDRESS]           connect directly to the printer on your networkprusactl login                     optional: sign in to Prusa Connectprusactl logout                    forget the Prusa Connect sessionprusactl status                    printer state and how it is reachableprusactl mcp                       run the MCP server on stdioprusactl download PATH [DEST]      copy a file from the printer to this computerprusactl api [METHOD] PATH [JSON]  /api/... to the printer, /app/... to Prusa Connectprusactl completion bash|zsh|fish  print a shell completion scriptprusactl help [COMMAND]            the command list, or one command's detailsprusactl --version

prusactl help <command> (or <command> --help) explains a command and its flags, and flags work before or after the arguments. Tab completion covers commands, flags, and their values: Homebrew installs it for bash, zsh, and fish, and prusactl help completion shows how to add it otherwise.

prusactl setup --forget removes the saved printer. --api-key uses a PrusaLink API key instead of the password, and --password-stdin reads the secret from a pipe.

prusactl api masks API keys and tokens in responses (Connect's printer record carries the PrusaLink and Connect keys), so its output is safe to paste or hand to an agent. --raw shows them.

Limits

  • It has no hands. It can't clear the build plate, swap a spool, or fix a clog. The tool descriptions tell the agent to check the printer (and the camera, if any) before starting a print or moving anything. Tools that start a job refuse a busy printer. After a finished or stopped print, everything that starts a job or moves toward the plate (start_print, upload_file with print, run_gcode, and send_command HOME, MOVE, MOVE_Z, MESH_BED_LEVELING, or START_PRINT) also needs plate_clear: true, since the last part may still be there. Marking the printer ready is the same confirmation. api_request is raw access and skips these checks.
  • run_gcode runs as a tiny print job. So it only works while the printer is idle, and it shows up in the printer's history.
  • Files uploaded through Prusa Connect stay in your Connect storage, which has a quota. list_connect_files shows them; delete them in the Connect web app under Files. (Files on the printer itself have delete_printer_files.)
  • Connect's API is unofficial. Prusa doesn't publish it; prusactl uses the same endpoints as connect.prusa3d.com, so a change on Prusa's side can break the Connect route. The direct route uses Prusa's documented PrusaLink API. If either changes, prusactl says so instead of misbehaving: "Prusa Connect answered in a way prusactl 0.1.3 doesn't recognize: …", naming the request and what was unexpected. Updating prusactl usually fixes it; if the newest version doesn't, report the message as an issue.

Configuration

VariablePurpose
PRUSACTL_HOST, PRUSACTL_USER, PRUSACTL_AUTHOverride the saved printer address, username, or digest/api-key
PRUSACTL_PASSWORD, PRUSACTL_API_KEYSupply the printer secret instead of the keychain
PRUSACTL_KEYRING=fileKeep credentials in secrets.json (mode 0600) instead of the OS keychain
PRUSACTL_CONFIGAlternate config file (default: prusactl/config.json in the OS config dir)
PRUSA_CONNECT_URL, PRUSA_ACCOUNT_URLConnect and Prusa Account origins
PRUSA_CLIENT_ID, PRUSA_REDIRECT_URIThe OAuth client (default: the Connect web app's)

Development

sh
go test ./...go vet ./...

Releases are cut by pushing a vX.Y.Z tag. CI builds the binaries, updates the Homebrew tap, attaches the MCP bundle, and publishes to the MCP Registry. See CHANGELOG.md.

License

MIT.

prusactl is an independent project. It is not affiliated with or endorsed by Prusa Research. Prusa and Prusa Connect are trademarks of Prusa Research a.s.

来源:README.md,提交 259ce86

工具

0
工具元数据尚未被收录。

版本历史

1
  1. v0.1.4最新Sep 29, 2026