Files
Mortdecai 421c3c9660 feat: initial MCP server for printing markdown to Epson TM-m30
Single tool `print(markdown, title?, timestamp?, qr_urls?, cut?)`. Hand-rolled
line-by-line markdown parser translates headings/bold/code/lists/blockquotes/
HR/links to ESC/POS, then sends raw bytes via TCP to 192.168.0.184:9100.

Mirrors mcp-gemma4 layout (stdio server, single server.py, mcp package).
2026-05-25 16:51:17 -04:00

2.2 KiB

DECISIONS.md — mcp-pos-print Decision Log

Project-specific decisions. For global/cross-cutting decisions, see ~/bin/DECISIONS.md.

Format: YYYY-MM-DD: <decision> — <why>

Architecture

  • 2026-05-25: stdio MCP server, single file (server.py), mirrors mcp-gemma4 pattern — Seth already runs MCPs this way; no point inventing a new layout.
  • 2026-05-25: Single print tool taking markdown — Claude already speaks markdown fluently, no printer-specific schema to learn on the call side. Server owns the markdown→ESC/POS translation.
  • 2026-05-25: Hand-rolled line-by-line markdown parser, no markdown-it-py dependency — our subset (headings, bold, hr, lists, code blocks, links, blockquotes) is small enough that a dependency would be heavier than the parser.
  • 2026-05-25: Font B (57 cols) hard-coded — POS_PRINT.md mandates it for the TM-m30 80mm paper.

Implementation

  • 2026-05-25: qr_urls kwarg (list[str]) for QR codes at end of receipt — keeps the markdown body pure text and avoids inventing a custom QR syntax.
  • 2026-05-25: Env overrides POS_PRINTER_IP / POS_PRINTER_PORT / POS_PRINTER_TIMEOUT — match the conventions documented in ~/bin/POS_PRINT.md.

Deferred / Rejected

  • 2026-05-25: Rejected image printing (base64 PIL) — no use case proposed; can add a print_image tool later if it actually comes up. YAGNI.
  • 2026-05-25: Rejected separate print_qr / print_barcode / print_separator primitive tools — would force Claude to make many tool calls per receipt (chatty, printer drains between calls). One tool + markdown + optional qr_urls covers the case.
  • 2026-05-25: Rejected drawer-kick / buzzer / multi-receipt batching — no drawer attached, no buzzer attached, no multi-receipt workflow exists.
  • 2026-05-25: Rejected auto-QR for any link in markdown body — surprising behavior, would produce a wall of QR codes for documents with many links. Explicit qr_urls only.
  • 2026-05-25: Rejected truncation of large markdown input — Claude is the one deciding what to print; if it sends a long document, print it. Paper is cheap.