thermal-mcp
Print beautiful HTML & Markdown on a $30 thermal receipt printer, straight from your AI agent.
README
thermal-mcp ๐งพ
Print beautiful HTML & Markdown on a $30 thermal receipt printer, straight from your AI agent.
thermal-mcp is an MCP server that turns any 58mm ESC/POS thermal printer into a typographic output device for LLM agents. The agent hands over Markdown or HTML; the server renders it in headless Chromium (2ร supersampled), converts it to 1-bit with quality dithering, encodes ESC/POS, and ships it to the printer over USB, Bluetooth serial, or CUPS โ wired preferred, automatically.
agent โโMCPโโโบ render (Chromium @2x) โโโบ 1-bit (Atkinson/Jarvis/Bayer + CLAHE)
โโโบ ESC/POS (heat-tuned, blank-line elision) โโโบ USB / BT / CUPS
Why it's nice
- Markdown in, ticket out โ GFM plus syntax-highlighted code (monochrome scheme),
mermaiddiagrams, LaTeX math (KaTeX), task lists, tables, remote images. Three type-size tiers. - Full custom HTML when the agent wants layout control: real Chromium, so flexbox/grid/SVG/emoji/web fonts all work.
- Offline font library โ Geist Sans/Mono, Inter, JetBrains Mono, Space Grotesk, Lora, Playfair Display, Caveat, Noto Sans SC, plus Font Awesome icons, all bundled and loaded via
file://. - Print quality obsessed โ supersampled rendering, CLAHE + unsharp photo pipeline, three dither algorithms, ESC/POS heat/density tuning (
ESC 7,DC2 #), blank-line elision, paced Bluetooth writes. Calibrated on real hardware. - Exact previews โ
preview_*tools return the true 1-bit image that will print, so agents iterate without wasting paper. <img data-qr="...">becomes a scannable QR code, generated server-side.
Tools
| tool | what it does |
|---|---|
print_markdown { markdown, size?, feed_lines? } |
quick path: markdown โ house-styled ticket |
preview_markdown { markdown, size? } |
exact 1-bit preview, no paper |
print_html { html, mode?, algorithm?, feed_lines? } |
full custom design |
preview_html { html, mode?, algorithm? } |
exact 1-bit preview |
printer_status {} |
transport + printer state |
design_guide {} |
returns the full design guide (fonts, layout, house style) โ client-agnostic, works in Claude Desktop |
mode: auto (detect photos, keep text sharp) / text / photo ยท algorithm: atkinson / jarvis / bayer ยท size: large 24px / medium 19px / small 14px.
Setup
git clone https://github.com/EthanPany/thermal-mcp && cd thermal-mcp
npm install
npx puppeteer browsers install chrome
npm run smoke # renders out/smoke.png without a printer
Register with Claude Code:
claude mcp add --scope user thermal --env THERMAL_TRANSPORT=auto \
-- "$(which node)" /absolute/path/to/thermal-mcp/node_modules/tsx/dist/cli.mjs \
/absolute/path/to/thermal-mcp/src/index.ts
Claude Desktop (claude_desktop_config.json). Use absolute paths โ GUI
apps launch with a minimal PATH and won't find npx/tsx on their own:
"thermal": {
"command": "/absolute/path/to/node",
"args": [
"/absolute/path/to/thermal-mcp/node_modules/tsx/dist/cli.mjs",
"/absolute/path/to/thermal-mcp/src/index.ts"
],
"env": { "THERMAL_TRANSPORT": "auto" }
}
Design guidance. In Claude Code, optionally install the skill so it auto-loads:
ln -s /absolute/path/to/thermal-mcp/skills/thermal-print ~/.claude/skills/thermal-print
In Claude Desktop (or any other MCP client) the skill mechanism isn't
available, but the same guidance is served over MCP by the design_guide
tool โ the agent calls it before designing. No extra setup.
Printer configuration
THERMAL_TRANSPORT=auto (default) probes in order: USB (any printer-class device) โ Bluetooth SPP serial (THERMAL_DEVICE, default /dev/cu.MPT-II) โ dry-run (writes PNG + ESC/POS bytes to out/). Or force usb / serial / lp-raw / lp-image / file.
Darkness: by default the server sends only ESC @ and uses the printer's
firmware-default darkness โ clean, no bleed. Hardware heat/density commands are
opt-in because some clone firmwares (incl. the MPT-II tested here) misparse
ESC 7 and leak a parameter byte as a stray glyph. Set these only if your
firmware honors them and you need to push darker:
| env | meaning | default |
|---|---|---|
THERMAL_HEAT_TIME |
ESC 7 n2 โ heat pulse ร10ยตs (darker); enables ESC 7 | unset |
THERMAL_HEAT_DOTS |
ESC 7 n1 โ dots per strobe = 8ร(n+1) | 3 (if ESC 7 on) |
THERMAL_HEAT_INTERVAL |
ESC 7 n3 โ recovery ร10ยตs (fixes fading) | 60 (if ESC 7 on) |
THERMAL_DENSITY |
DC2 # density 0โ31; enables DC2 # | unset |
THERMAL_BREAK |
DC2 # per-line break time 0โ7 | 4 (if DC2 # on) |
THERMAL_THIN |
software stroke-thinning 0โ2 (0.3โ0.6 lightens fat Latin text; >0.7 breaks small/CJK text) | 0 (off) |
THERMAL_MAX_PX |
max ticket height in px; taller content is truncated with a warning (roll-saver) | 12000 (~1.5m) |
THERMAL_DITHER |
default photo algorithm | atkinson |
THERMAL_CHUNK / THERMAL_PACE_MS |
Bluetooth pacing | 256 / 30 |
Tested on a Sunydog 58mm (USB 6868:0200, Bluetooth "MPT-II") on macOS. Any printer speaking GS v 0 raster should work.
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.