print-blocks
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
print-blocks
print-blocks is a small TypeScript service that prints structured documents to ESC/POS thermal printers.
It has an API endpoint /print that accepts a JSON payload describing a document as an array of blocks, renders them to ESC/POS bytes with react-thermal-printer, and submits the resulting bytes to a CUPS printer with lp.
The service has no UI. It exposes:
POST /printfor authenticated print jobs.GET /healthzfor unauthenticated liveness checks.GET /openapi.jsonfor generated OpenAPI JSON.GET /docsfor an interactive Scalar API reference whenEXPOSE_DOCS=true.GET /llms.txtfor LLM-friendly Markdown API documentation whenEXPOSE_LLMS_TXT=true.ALL /mcpfor authenticated MCP clients whenEXPOSE_MCP=true.
Requirements
Node.js 24 and pnpm 10 for local development.
CUPS configured on the host.
A CUPS printer queue that accepts raw/native ESC/POS data.
The CUPS client command
lpavailable wherever the app runs.
The production container installs cups-client, so lp is available inside the image.
Related MCP server: print-mcp
Configuration
Copy the example environment file and edit it:
cp .env.example .envNote:
Documentation endpoints are disabled by default. Set
EXPOSE_DOCS=trueto enable/docsandEXPOSE_LLMS_TXT=trueto enable/llms.txt.The MCP endpoint is disabled by default. Set
EXPOSE_MCP=trueand provide a separateMCP_TOKENwith at least 32 characters to enable/mcp.PRINTER_WIDTHconfigures the printer text width in characters and defaults to48.PRINTER_DOT_WIDTHconfigures the raster width used for image-like blocks and defaults to576dots. Set it explicitly when your printer mode uses a different raster width, such as384dots.Image blocks accept base64-encoded data through the
dataproperty. Supported image formats are JPEG, PNG, WebP, and SVG. Remote image URLs are disabled by default. SetALLOW_REMOTE_IMAGE_URLS=trueto allow image blocks to use an HTTPSurlinstead. Remote image fetching is intentionally strict: only HTTPS URLs with public domain hostnames are accepted, direct IP addresses and credentials are rejected, redirects are not followed, downloaded bytes are limited byMAX_REMOTE_IMAGE_BYTES, fetches time out afterREMOTE_IMAGE_TIMEOUT_MS, and decoded image input is limited byMAX_IMAGE_INPUT_PIXELS. These restrictions are in place to prevent abuse and security issues, but enabling remote image URLs is only recommended in trusted environments.
Development
Install dependencies:
pnpm installRun the dev server:
pnpm devSVG-backed block previews are available in development at:
http://localhost:3000/previewRun checks:
pnpm typecheck
pnpm lint
pnpm format:check
pnpm test
pnpm buildAPI
POST /print
Headers:
Content-Type: application/json
Authorization: Bearer <API_TOKEN>Body:
{
"blocks": [
{
"type": "text",
"content": "Hello from print-blocks",
"align": "center",
"bold": true
}
]
}Success response:
{
"ok": true
}GET /healthz
Returns:
{
"ok": true
}GET /openapi.json
Returns the OpenAPI specification for the API.
GET /docs
Returns an interactive API reference backed by Scalar and /openapi.json. This endpoint is only registered when EXPOSE_DOCS=true.
GET /llms.txt
Returns Markdown API documentation generated from the OpenAPI specification. This endpoint is only registered when EXPOSE_LLMS_TXT=true.
ALL /mcp
Serves a stateless MCP server over streamable HTTP. This endpoint is only registered when EXPOSE_MCP=true and requires Authorization: Bearer <MCP_TOKEN>.
Available tools:
get_inforeturns printer settings, service limits, supported blocks, and templates.printrenders print instructions and submits them to the configured printer.list_templateslists examplary print templates that can be used as starting points or inspiration for print requests.get_templatereturns Markdown instructions and the template's JSON structure for a given template id.
Manual smoke test
After the app is running:
curl -X POST "http://localhost:3000/print" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
--data '{"blocks":[{"type":"text","content":"Hello from print-blocks","align":"center"}]}'This server cannot be deployed
Maintenance
Related MCP Connectors
Thermal label MCP server: render, validate, debug and convert ZPL, EPL, TSPL and CPCL labels.
Typeset PDFs from templates (invoices, CVs, certificates, invitations), one or many at once.
Render HTML, URLs, and templates to PDF. AI drafts templates and fixes them from logs.
Design, publish and render PDF templates with Typst. Full template lifecycle over MCP.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to print documents, manage print queues, and control printers on macOS/Linux systems via the CUPS printing system. Supports printing PDFs, text files, and other formats with options like duplex printing, landscape orientation, and multiple copies.619 npm13MIT
- FlicenseNot gradedqualityCmaintenanceEnables generating print-ready PDFs from Markdown and submitting them to CUPS printers. Supports local, Tailscale, and Cloudflare Tunnel access.-
- AlicenseAqualityCmaintenanceEnables 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.51MIT
- AlicenseNot gradedqualityBmaintenanceLets an AI assistant discover the printers installed on a computer and send them PDFs, images, text, Markdown, or HTML with control over copies, page ranges, paper size, orientation, duplex, and color, then track or cancel the resulting jobs. It can run locally over stdio or be exposed remotely through a Cloudflare tunnel with password authentication.54 npm1MIT