MCP server for ESC/POS printing over USB
MCPOSprint - MCP Server for ESC/POS Printing over USB
Hi! This escalated quickly and became a whole thing. Full disclosure, AI helped me write a lot of this code, but I've tested it pretty throughly on a mac to confirm it works.
This is a uv based MCP that lets you connect an MCP client to a usb connected ESC/POS printer. It has baked in tools for printing your tasks from notion with QR codes, and a template to print out markdown tasklists, as well as a generic print image tool you can use to print arbitrary images. I've only tested it with an EPSON_TM_T20III-17, so YMMV with other ESC/POS printers.
🚀 Installation
MCPOSprint runs directly via uvx.
Prerequisites - Install these first
- Python 3.10+
- UV package manager: Install from astral.sh/uv
- Thermal printer : ESC/POS compatible USB printer
- Notion API Token (optional): If you want to print tasks from Notion. You can see how to generate a token in Notion's docs
- libusb for USB printer access
- macOS:
brew install libusb - Ubuntu/Debian:
sudo apt install libusb-1.0-0-dev
- macOS:
Getting Started
Install UV (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | shConfigure Your MCP Client with MCPOSprint (see configuration section below)
🎯 MCP Client Setup
Minimal Configuration (Recommended)
You can add this to the mcp config file of whatever client you use
For most users, just configure your Notion credentials if you want them:
{
"mcpServers": {
"mcposprint": {
"command": "uvx",
"args": ["mcposprint"],
"env": {
"PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",
"NOTION_API_KEY": "your_notion_api_key_here",
"TASKS_DATABASE_ID": "your_database_id_here"
}
}
}
}
Default settings used:
- OUTPUT_DIR:
./images(saved relative to Claude Desktop's working directory) - PRINTER_NAME:
EPSON_TM_T20III-17 - CARD_WIDTH/HEIGHT:
580pixels (optimized for 58mm thermal printers)
Full Configuration (Advanced)
If you need to override defaults:
{
"mcpServers": {
"mcposprint": {
"command": "uvx",
"args": ["mcposprint"],
"env": {
"PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",
"OUTPUT_DIR": "./my-custom-images",
"PRINTER_NAME": "YOUR_PRINTER_NAME",
"CARD_WIDTH": "580",
"CARD_HEIGHT": "580",
"NOTION_API_KEY": "your_notion_api_key_here",
"TASKS_DATABASE_ID": "your_database_id_here",
"DEBUG": "false"
}
}
}
}
Configuration Notes:
- PATH: Adjust for your system (macOS Homebrew path shown)
- OUTPUT_DIR: Where images are saved (relative to Claude Desktop's working directory)
- PRINTER_NAME: Use your actual thermal printer name
- Notion credentials: Optional - only needed for Notion integration
Available Environment Variables
| Variable | Default | Description |
|---|---|---|
OUTPUT_DIR |
./images |
Where generated card images are saved |
PRINTER_NAME |
EPSON_TM_T20III-17 |
Your thermal printer name |
CARD_WIDTH |
580 |
Card width in pixels |
CARD_HEIGHT |
580 |
Card height in pixels |
NOTION_API_KEY |
(none) | Your Notion integration API key |
TASKS_DATABASE_ID |
(none) | Your Notion tasks database ID |
DEBUG |
false |
Enable debug logging |
Output Directory
Generated card images are saved to the OUTPUT_DIR (default: ./images) relative to Claude Desktop's working directory. The directory is created automatically if it doesn't exist.
Notion Setup
- Create a Notion integration at https://www.notion.so/my-integrations
- Copy the API key to your
.envfile - Share your tasks database with the integration
- Copy the database ID to your
.envfile
Database should have these properties:
- Name or Task (title)
- Due Date (date)
- Priority (select: High, Medium, Low)
- Status (status: Not Started, In Progress, Done)
- Description (rich text, optional)
Usage with MCP Clients
Once connected, you can use these tools in your MCP client:
- Generate cards from markdown: Use
process_static_cardstool - Fetch Notion tasks: Use
process_notion_taskstool (with progress tracking) - Print existing images: Use
print_onlytool - Test printer: Use
test_printer_connectiontool - Run diagnostics: Use
run_diagnosticstool - Get printer specs: Access
image://thermal-card-sizeresource
Markdown Format
## Morning Routine
- *Get dressed
- Brush teeth
- Make coffee
- Check calendar
## Work Tasks
- *Review emails
- Update project status
- *Prepare for 2pm meeting
- Submit timesheet
- Use
## Titlefor card headers - Use
- Taskfor regular tasks - U
Tools (5)
process_static_cardsGenerate and print cards from markdown inputprocess_notion_tasksFetch tasks from Notion and print them with QR codesprint_onlyPrint existing images to the thermal printertest_printer_connectionVerify the connection to the thermal printerrun_diagnosticsRun diagnostic checks on the printer setupEnvironment Variables
OUTPUT_DIRWhere generated card images are savedPRINTER_NAMEYour thermal printer nameCARD_WIDTHCard width in pixelsCARD_HEIGHTCard height in pixelsNOTION_API_KEYYour Notion integration API keyTASKS_DATABASE_IDYour Notion tasks database IDDEBUGEnable debug loggingConfiguration
{
"mcpServers": {
"mcposprint": {
"command": "uvx",
"args": ["mcposprint"],
"env": {
"PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",
"NOTION_API_KEY": "your_notion_api_key_here",
"TASKS_DATABASE_ID": "your_database_id_here"
}
}
}
}