Skip to main content
Glama
labelprint

labelprint

by permitzip

labelprint

Local MCP server and CLI that print PNG labels to a nearby thermal label printer.

It runs on the machine that can see the printer. It does not call manufacturer cloud APIs, does not scrape template catalogs, and is not named after any printer brand.

PNG or title/body/QR  →  1-bit bitmap  →  local serial / RFCOMM  →  paper

Install

pip install git+https://github.com/permitzip/labelprint-mcp

Optional QR rendering:

pip install "labelprint[qr] @ git+https://github.com/permitzip/labelprint-mcp"

On macOS, Bluetooth printing needs Xcode Command Line Tools so the small IOBluetooth helper can compile on first use (swiftc).

Related MCP server: niimbot-mcp

Configure

Copy examples/config.toml to ~/.config/labelprint/config.toml (or ./labelprint.toml).

[printer]
transport = "auto"
address = "AA:BB:CC:DD:EE:FF"
density = 4
max_width_px = 384

[media]
width_mm = 50
height_mm = 30
dpi = 203

Environment variables use the LABELPRINT_ prefix (LABELPRINT_ADDRESS, LABELPRINT_WIDTH_MM, …).

Roll size is local. The printer can report a chip barcode; this tool will not look that code up on the internet. Put width_mm / height_mm in config, pass --width-mm / --height-mm, or add a [[media.barcode]] row that you measured yourself.

CLI

labelprint doctor
labelprint ports
labelprint status
labelprint render --title "BOARDS" --body "Is this a controller?" --out preview.png
labelprint print --image preview.png --yes
labelprint print --title "ITEM" --qr "https://example.com/i/123" --yes
labelprint mcp

print refuses to run without --yes. That flag consumes labels.

MCP

The server is stdio-only. Point Cursor or Claude Desktop at the machine with the printer:

{
  "mcpServers": {
    "labelprint": {
      "command": "labelprint-mcp"
    }
  }
}

A full example is in examples/mcp.json.

Tool

What it does

labelprint_doctor

Config and transport check (no print)

labelprint_list_ports

Serial nodes on this machine

labelprint_status

Identity, power, on-device chip fields

labelprint_render

Preview PNG

labelprint_print

Print. Requires confirm: true.

A hosted agent (ChatGPT, a cloud Hours worker, Docker on a laptop) cannot open this printer. Run this MCP locally, or later on a Pi that sits next to the printer.

Transports

Name

When

rfcomm

macOS Bluetooth via IOBluetooth RFCOMM channel 1

bluetooth

Linux AF_BLUETOOTH RFCOMM

serial

USB or a working /dev/cu.* / COM port

auto

macOS + address → rfcomm; Linux + address → bluetooth; otherwise serial

On some Macs the Bluetooth serial node opens and then never exchanges protocol bytes after reconnect. Prefer rfcomm there.

Compatible hardware

The first adapter is protocol3: 203 dpi, ~384 px printhead, firmware that needs a 7-byte print-start and a 6-byte page-size. That matches several common Bluetooth label printers (device type 4096 is one of them).

This is an unofficial local driver. It is not affiliated with, endorsed by, or supported by any printer manufacturer. Packet framing is derived from niimprint (MIT). The print task was completed from device traces and community protocol notes. See NOTICE.

Library

from pathlib import Path
from labelprint.config import load_settings
from labelprint.printer import print_paths, render_to_path

settings = load_settings()
render_to_path(settings, Path("preview.png"), title="BOARDS", body="Controller?")
print_paths(settings, [Path("preview.png")])

License

MIT. See LICENSE and NOTICE.

Available Tools

5 tools
labelprint_doctorA

Check local config, serial ports, and which transport this machine would use.

Does not open the printer. Use this first when setup is unclear.

Inputs: no named parameters. Returns: result

labelprint_list_portsA

List serial device nodes visible on this machine.

Inputs: no named parameters. Returns: result

labelprint_printA

Print a PNG, or render title/body/QR and print that.

Consumes physical labels. confirm must be true. Preview with labelprint_render first.

Inputs: qr, body, title, copies, +5 more. Returns: result

labelprint_renderA

Render a preview PNG (title, body, and/or QR). Does not print.

Inputs: qr, body, title, out_path, +2 more. Returns: result

labelprint_statusB

Open the configured local printer and return identity, power, and on-device media chip data.

Media size is not fetched from the internet. If a barcode is present, match it against the local config table or pass width_mm/height_mm when printing.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct role: doctor performs setup diagnostics without opening the printer, list_ports only enumerates serial nodes, status opens the printer for identity/media, render previews, and print consumes labels. The doctor/list_ports boundary is explicitly clarified by the descriptions.

    Naming Consistency4/5

    All tools use the same labelprint_ prefix and snake_case, making them predictable and grouped. Minor inconsistency: doctor and status are noun-like diagnostics while render/print/list_ports are action verbs.

    Tool Count5/5

    Five tools is well-scoped for a label-printing server: three diagnostic tools, one preview tool, and one print tool. Each earns its place without redundancy.

    Completeness4/5

    The surface covers diagnostics, preview, and printing, which are the core lifecycle operations. Minor gaps include no explicit configuration-setting or job-management tool, though doctor covers config inspection.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables printing text, QR codes, and images directly to NIIMBOT B1 BLE label printers without vendor apps or cloud, with orientation control, fit validation, and local preview tools.
      -
    • A
      license
      A
      quality
      C
      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
      C
      maintenance
      Enables Mac users to discover and select a Bluetooth thermal printer, preview Chinese text, image, and mixed layouts as PNGs, inspect device and job status, and send a prepared job only after local confirmation.
      MIT