Skip to main content
Glama
brotherkeeper-mcp

brotherkeeper-mcp

by jkrauska

BrotherKeeper

Print text labels on Brother label printers over USB from the command line, Python, or any MCP-capable agent. It doesn't need Brother's app or driver.

Tested on the PT-P710BT (P-touch Cube Plus) and PT-2730 tape printers, and the QL-570 paper-label printer (DK rolls, continuous or die-cut). Several printers can be attached at once. To add another model, see docs/ADDING_A_PRINTER.md.

  • Detects the loaded tape or label roll (width, type, colors, die-cut size) from the printer itself.

  • On die-cut labels the size is fixed, so text is rotated whenever that gives bigger text (e.g. along the 62 mm side of a 62×29 mm label).

  • Sizes the text to fill the tape height, and cuts the label to fit the text. You can also give a fixed length.

  • Supports multiple lines (\n), several copies, alignment, and any TrueType font.

Probably also works on the PT-P700 / PT-P750W / PT-E550W (same raster protocol), but those are untested.

Install

brew install libusb
uv sync

Related MCP server: ptouch-mcp

Make shortcuts

make label "Hello World"           # print (or TEXT="..."; extra flags via FLAGS="-n 3")
make label-set A1 A2 A3            # several labels in ONE job (one lead-in, not three)
make label-set "Shelf A, Shelf B"  # multi-word labels: separate with commas
make preview "Hello World"         # write preview.png, don't print
make status                        # attached printers and their tapes
make label "Hi" PRINTER=24mm       # pick a printer (model, serial or tape width)
make calibrate PRINTER=ql          # calibration rulers/target (for adding printers)
make run-mcp                       # MCP server on stdio
make run-keepalive                 # keep the printer awake (foreground)
make install-keepalive             # ...or as a launchd agent (uninstall-keepalive to remove)

Command line

uv run label "Hello World"                 # fit the text
uv run label "Garage\nScrews M4"           # two lines
uv run label "Bin 7" --length 40 -n 3      # three 40 mm labels
uv run label --list                        # attached printers and their tapes
uv run label "Hi" -P 2730                  # pick a printer: model, serial or tape width
uv run label "Hi" -P 24mm                  # ...e.g. whichever has 24 mm tape loaded
uv run label "Test" --dry-run --preview out.png
echo "from stdin" | uv run label -

MCP server (for agents)

brotherkeeper-mcp is a stdio MCP server that provides these tools:

tool

what it does

list_printers

every attached printer with its loaded tape and errors

printer_status

one printer's loaded tape, printable height, errors

preview_label

lay out text for the current tape and return a PNG preview, without printing

print_label

print it (text, copies, length_mm, font_size, font, align)

print_label_set

print several labels in one job (less tape waste); texts, cut, chain, uniform, dry_run

This repo has a .mcp.json, so Claude Code picks it up automatically when it runs in this folder. To use it from anywhere, add it to Claude Code at user scope:

claude mcp add --scope user brotherkeeper -- uv --directory /path/to/BrotherKeeper run brotherkeeper-mcp

Several printers

With more than one printer attached, choose one with -P/--printer (CLI), PRINTER= (make), the printer argument (MCP), or set BROTHERKEEPER_PRINTER as a default. You can choose by model name (p710bt, 2730), by serial number, or by loaded tape width (9mm, 24mm). If you don't choose and more than one printer is attached, the tool lists them and asks you to pick.

Keeping the printer awake

The PT-P710BT switches itself completely off after it's idle for a while (1 hour on USB power, 10 minutes on battery). Once it's off, you can't wake it over USB or Bluetooth. label --keepalive sends a status request to every attached printer, and that should restart the idle timer. contrib/com.brotherkeeper.keepalive.plist runs it every 20 minutes:

make install-keepalive     # installs the launchd agent pointing at this checkout
make uninstall-keepalive   # removes it

Notes

  • Tape waste: the cutter sits roughly 25 mm past the print head. Each job starts where the last cut was, so that ~25 mm has already gone past the head and comes out blank. Two ways to reduce it:

    • Print several labels in one job (label a b c, make label-set, MCP print_label_set). You pay the ~25 mm once per job instead of once per label.

    • --chain: the printer doesn't feed out the last label, so the next job carries on right after it with no blank lead-in. The catch is that the last label stays inside the printer until you print again.

  • Minimum length and margins: the printer won't cut a label shorter than about 25 mm. It pads short labels at the end, and it adds its own blank margins (about 2.6 mm at the front and 1.7 mm at the back). The layout accounts for all of this, so text is centered on the actual cut label. These values were measured on one PT-P710BT (the PT-2730's are below). If yours differ, set BROTHERKEEPER_LEAD_MM, BROTHERKEEPER_TRAIL_MM or BROTHERKEEPER_MIN_LENGTH_MM.

  • QL-570: 300 dpi, a 720-dot head, and DK roll sizes taken from brother_ql's label table. If its status shows no media, reseat the roll. Margins on continuous rolls aren't measured yet (about 3 mm is assumed).

  • PT-2730: it uses an older command set: ESC i R 1 for raster mode, uncompressed lines, and only the auto-cut (ESC i M) and margin (ESC i d) settings. Without auto-cut it wouldn't cut between labels. It ignores --chain and doesn't report tape colors. Its minimum label length is about 23.3 mm, with margins of about 1.1 mm at the front and 2.2 mm at the back.

  • Protocol: Brother "Raster Command Reference" for PT-E550W/P750W/P710BT, and ptouch-print for the older models.

License

MIT

Available Tools

5 tools
list_printersA

List every attached Brother label printer with its model, serial, loaded tape (width, type, colors), printable height and errors. Use this to pick a printer (e.g. by tape width) when several are attached.

Inputs: no named parameters. Returns: result

preview_labelA

Lay out a label for the currently loaded tape WITHOUT printing it and return a preview image plus layout details. Use "\n" in text for multiple lines. Text is auto-sized to fill the tape height; the label length fits the text unless length_mm is given.

Inputs: text (required), font, align, printer, +2 more.

printer_statusA

Get one label printer's state: loaded tape (width, type, colors), printable height, and any errors (no media, cover open, ...). printer: model, serial or tape width ("24mm") when several are attached. Fails if the printer is off or unplugged.

Inputs: printer.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool targets a distinct action/resource: list all printers, inspect one printer, preview layout, print one label, or print a batch. The descriptions explicitly distinguish print_label from print_label_set and clarify when to prefer batching. Preview versus print is also clearly separated.

    Naming Consistency4/5

    Most names follow a consistent snake_case verb_noun pattern (list_printers, preview_label, print_label, print_label_set). printer_status is the lone noun-first outlier, but it remains readable and unambiguous.

    Tool Count5/5

    Five tools is well-scoped for a label-printing server, covering discovery, status, preview, and both single and batch printing. Every tool earns its place without redundancy.

    Completeness4/5

    The surface covers the core lifecycle: list printers, check status, preview layout, print a label, and print a set. Minor gaps exist around feed/advance or job-cancel operations, especially since the chain option references needing to feed the printer afterward.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables printing PNG labels to a nearby thermal label printer over local serial or Bluetooth, with tools for rendering previews, checking printer status, and printing with confirmation.
      5
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables printing labels on Brother P-touch tape printers via MCP, allowing natural language requests to create, preview, and print labels.
      MIT
    • A
      license
      A
      quality
      Not graded
      maintenance
      Enables AI assistants to design, preview, and print labels on a Bluetooth label printer, manage templates and saved labels, check printer status, scan for devices, and query fonts.
      10
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI clients to build and validate ZPL II label specifications from JSON (text, 27 barcode symbologies, boxes, CJK via built-in TrueType fonts), send them over TCP raw 9100 or Windows spooler/USB, query printer status via Link-OS SGD or legacy ~HI/~HS, batch-print labels from .xlsx rosters, and reconstruct printable ZPL from a photo of an existing label. Includes a preview transport for rendering without hardware.
      2
      MIT