Skip to main content
Glama
Topsail

Topsail

by AidanZealley
README.md
# Topsail

An MCP server for Klipper 3D printers through Moonraker. One server controls several printers and keeps their state live over Moonraker's websocket. Your MCP client decides which actions need your approval.

## Set up Topsail

Install Node.js 24 or newer on the machine running your agent. The same machine needs to be able to reach Moonraker on your printer.

Register Topsail with your client:

**Codex**

```sh
codex mcp add topsail -- npx -y topsail
```

**Claude Code**

```sh
claude mcp add --transport stdio --scope user topsail -- npx -y topsail
```

**Another local MCP client**

Choose stdio and enter `npx` as the command, with `-y` and `topsail` as two arguments.

Open a session and ask the agent to add your printer. Give it a short ID and your printer's IP address or hostname. Topsail tries port `7125`. For a custom setup, give the full Moonraker URL. If your client supports MCP forms, Topsail can ask for missing details in a form. Otherwise, the agent asks in chat.

Your client starts Topsail when it connects. The printer list starts empty and is saved at `~/.config/topsail/printers.sqlite`. Sessions running under the same user account on the same machine share the list. Ask your agent to list your printers to see their saved Moonraker URLs and status.

Moonraker must allow requests from the machine running Topsail without credentials. If you used a previous version with a TOML file or `MOONRAKER_URL`, add those printers again through chat.

## Tools

| Tool | Marked destructive |
| --- | --- |
| `list_printers`, `printer_status`, `list_files`, `list_macros`, `webcam_snapshot` | no, read only |
| `add_printer`, `upload_gcode` | no |
| `pause_print`, `turn_off_heaters`, `emergency_stop` | no, so nothing delays them |
| `start_print`, `resume_print`, `cancel_print` | yes |
| `set_temperature`, `run_macro`, `restart_klipper` | yes |
| `remove_printer` | yes. It doesn't stop an active print. |

Tools that act on a printer take its ID in `printer`. You can omit it when only one printer is configured, except in `remove_printer`.

## Approval

Topsail never asks before an action. It marks each tool with MCP annotations, and your client decides what needs your approval. **A client that runs everything without asking can start a print or heat a printer unattended.** Check its settings before you connect a printer.

`list_macros` shows macros loaded by Klipper, with their descriptions and any parameters Topsail can identify. `run_macro` accepts a public macro name and optional `params` with uppercase keys and numeric or single-token string values. Klipper controls what the macro does, so only approve macros you trust.

## Print a file

`upload_gcode` takes the absolute path of a `.gcode` file on the machine running Topsail and stores it on the printer under a unique name. Pass the returned filename to `start_print`.

`upload_gcode` and `list_files` return what the slicer recorded about a file: material, temperatures, height and time. Those come from the file, so they help catch mistakes, not attacks.

Topsail doesn't check what the G-code does. Klipper enforces its configured temperature and travel limits, but a print runs whatever is in the file, so only print files you trust. Topsail can upload any `.gcode` file its user can read.

## Develop

```sh
npm install
npm test         # end-to-end against a fake Moonraker, on both protocol eras
npm run dev
```

## Release

Push a tag such as `v0.2.0`. The [Publish workflow](.github/workflows/publish.yml) tests it, publishes that version to npm and makes a GitHub release. A prerelease tag, such as `v0.2.0-rc.1`, goes to npm's `next`.

TDQS

A3.6/5.0

Scored across 17 tools

Disambiguation4/5

Each tool maps to a distinct action on a printer, file, or heater, and descriptions explicitly disambiguate the risky pairs (upload_gcode vs start_print, set_temperature 0 vs turn_off_heaters, restart_klipper vs emergency_stop). Minor residual overlap between list_printers and printer_status (both report connection/print state) and between turn_off_heaters and emergency_stop, but the descriptions resolve it.

Naming Consistency4/5

Nearly all tools follow a snake_case verb_noun pattern (add_printer, list_files, pause_print, run_macro). The exceptions are noun-first names like printer_status and webcam_snapshot, which break the pattern slightly but remain readable and unambiguous.

Tool Count4/5

17 tools is at the upper edge but each maps to a real operation in the printer-control domain (lifecycle, files, heaters, macros, recovery). Nothing appears redundant, though the set is large enough that grouping or trimming a couple of recovery tools could help.

Completeness4/5

Core workflows are covered: printer CRUD, print start/pause/resume/cancel, file listing and upload, temperature control, macros, and recovery (restart, emergency stop). Gaps exist for file deletion, axis homing/jogging, and bed-leveling or object-exclusion operations, but agents can still accomplish the main remote-management tasks.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues