TimeVerse Printer Control MCP Server - multi-transport printer control for AI agents
Project description
TimeVerse Printer MCP Server
English | 中文
A comprehensive Model Context Protocol (MCP) server for printer control, supporting multiple communication protocols and page description languages. Lets AI agents discover printers, print documents, query status, and manage print queues.
Features
7 Transport Methods
| Transport | Port/Interface | Protocol | Use Case |
|---|---|---|---|
| Win32 Spooler | System API | pywin32 | Windows default (primary) |
| IPP | 631 | pyipp | Modern network printers, AirPrint |
| Raw Socket | 9100 | socket | HP JetDirect, fast direct print |
| LPD/LPR | 515 | socket | Legacy/Unix printers |
| USB | USB | pyusb | Thermal printers, label printers |
| Serial | RS-232 | pyserial | Old thermal/label printers |
| CUPS | System API | pycups | Linux/macOS |
6 Page Description Languages
PDF, PCL 5/6, ESC/POS (receipts), ZPL (labels), Plain Text, Images (PNG/JPEG/BMP)
18 MCP Tools
- Discovery (3):
list_printers,discover_printers,get_printer_info - Printing (6):
print_file,print_text,print_image,print_raw,print_escpos,print_zpl - Status (2):
get_printer_status,get_printer_capabilities - Queue (5):
get_print_jobs,cancel_print_job,cancel_all_jobs,pause_printer,resume_printer - Management (2):
get_default_printer,set_default_printer
Installation
Prerequisites
- Python 3.12+
- Windows (recommended for full Win32 Spooler support) or Linux/macOS (CUPS)
Install
# Clone or copy the project
cd timeverse-printer-mcp
# Create a virtual environment
python -m venv .venv
# Activate it
# Windows:
.venv\Scripts\activate
# Linux/macOS:
source .venv/bin/activate
# Install the package
pip install -e .
Optional: USB Driver (Windows)
For USB printer support on Windows, install Zadig and replace the printer's driver with libusbK or WinUSB.
MCP Client Configuration
Add this to your MCP client config (e.g. Claude Desktop, WorkBuddy):
{
"mcpServers": {
"timeverse-printer": {
"command": "python",
"args": ["-m", "timeverse_printer_mcp.server"],
"env": {
"TIMEVERSE_PRINTER_MCP_LOG_LEVEL": "info"
}
}
}
}
Environment Variables
| Variable | Default | Description |
|---|---|---|
TIMEVERSE_PRINTER_MCP_SCAN_SUBNET |
(none) | SNMP scan subnet, e.g. 192.168.1.0/24 |
TIMEVERSE_PRINTER_MCP_SCAN_TIMEOUT |
5000 |
Discovery scan timeout (ms) |
TIMEVERSE_PRINTER_MCP_SNMP_COMMUNITY |
public |
SNMP community string |
TIMEVERSE_PRINTER_MCP_DEFAULT_TRANSPORT |
auto |
Default transport method |
TIMEVERSE_PRINTER_MCP_LOG_LEVEL |
warning |
Log level: debug, info, warning, error |
Usage Examples
List Installed Printers
Tool: list_printers(include_network=true)
Discover Network Printers
Tool: discover_printers(method="all", subnet="192.168.1.0/24", timeout=5000)
Print a PDF File
Tool: print_file(
file_path="C:/Documents/report.pdf",
printer="HP LaserJet Pro M404",
copies=2,
duplex="long-edge",
color="monochrome"
)
Print a Receipt (ESC/POS)
Tool: print_escpos(
printer="192.168.1.100:9100",
commands=[
{"type": "init"},
{"type": "align", "params": {"alignment": "center"}},
{"type": "bold", "params": {"enable": true}},
{"type": "font_size", "params": {"width": 2, "height": 2}},
{"type": "text", "value": "My Store"},
{"type": "feed", "params": {"lines": 1}},
{"type": "align", "params": {"alignment": "left"}},
{"type": "text", "value": "Item 1 ......... $10.00"},
{"type": "text", "value": "Item 2 ......... $5.50"},
{"type": "feed", "params": {"lines": 1}},
{"type": "align", "params": {"alignment": "center"}},
{"type": "qrcode", "value": "https://example.com", "params": {"size": 6}},
{"type": "cut", "params": {"mode": "full"}}
]
)
Print a Label (ZPL)
Tool: print_zpl(
printer="192.168.1.200:9100",
zpl="^XA^FO20,20^A0N,50,50^FDHello World^FS^FO20,80^BCN,100,Y,N,N^FD12345678^FS^XZ",
labels=3
)
Query Printer Status
Tool: get_printer_status(printer="HP LaserJet Pro M404", method="auto")
Manage Print Queue
Tool: get_print_jobs(printer="HP LaserJet Pro M404")
Tool: cancel_print_job(printer="HP LaserJet Pro M404", job_id=42)
Tool: cancel_all_jobs(printer="HP LaserJet Pro M404")
Tool: pause_printer(printer="HP LaserJet Pro M404")
Tool: resume_printer(printer="HP LaserJet Pro M404")
Printer Identifier Formats
The printer parameter accepts multiple formats:
| Format | Example | Resolved Transport |
|---|---|---|
| System printer name | HP LaserJet Pro M404 |
Win32 Spooler / CUPS |
| IP address | 192.168.1.50 |
Auto (IPP or Raw) |
| IP:port | 192.168.1.50:9100 |
Raw Socket |
| IPP URL | ipp://192.168.1.50/ipp/print |
IPP |
| USB VID:PID | usb:04b8:0202 |
USB |
| Serial port | COM3 or /dev/ttyUSB0 |
Serial |
Architecture
MCP Tool Layer (18 tools)
|
Transport Router (auto-selects best transport)
|
Transport Layer (Win32 Spooler / IPP / Raw / LPD / USB / Serial / CUPS)
|
Document Layer (PDF / Image / Text / ESC/POS / ZPL / PCL)
|
Discovery Layer (mDNS / SNMP / Win32 Enum / USB Scan)
Dependencies
Core
mcp— Official MCP Python SDK (FastMCP)pywin32— Win32 Print Spooler API (Windows only)pyipp— IPP clientpyusb— USB communicationpyserial— Serial port communicationpysnmp— SNMP status querieszeroconf— mDNS/Bonjour discoverypycups— CUPS API (Linux/macOS only)
Document Processing
pypdf— PDF readingreportlab— PDF generationPillow— Image processingpython-escpos— ESC/POS command library
Project Structure
timeverse-printer-mcp/
├── src/timeverse_printer_mcp/
│ ├── server.py # MCP server entry point
│ ├── tools/ # 18 MCP tools
│ │ ├── discovery.py # list_printers, discover_printers, get_printer_info
│ │ ├── printing.py # print_file, print_text, print_image, print_raw, print_escpos, print_zpl
│ │ ├── status.py # get_printer_status, get_printer_capabilities
│ │ ├── queue.py # get_print_jobs, cancel_print_job, cancel_all_jobs, pause_printer, resume_printer
│ │ └── management.py # get_default_printer, set_default_printer
│ ├── transports/ # 7 transport implementations + router
│ │ ├── base.py # Abstract transport base class
│ │ ├── router.py # Transport auto-router
│ │ ├── win32_spooler.py # Windows Print Spooler (pywin32)
│ │ ├── ipp_transport.py # IPP (pyipp)
│ │ ├── raw_socket.py # Raw Socket (port 9100)
│ │ ├── lpd.py # LPD/LPR (port 515)
│ │ ├── usb_transport.py # USB (pyusb)
│ │ ├── serial_transport.py# Serial (pyserial)
│ │ ├── cups_transport.py # CUPS (pycups, Linux/macOS)
│ │ └── snmp_status.py # SNMP status query (pysnmp)
│ ├── documents/ # Document handlers
│ │ ├── pdf_handler.py # PDF processing
│ │ ├── image_handler.py # Image processing
│ │ ├── text_handler.py # Text formatting
│ │ ├── escpos_builder.py # ESC/POS command builder
│ │ ├── zpl_builder.py # ZPL command builder
│ │ └── pcl_builder.py # PCL command builder
│ ├── discovery/ # Printer discovery
│ │ ├── mdns_discovery.py # mDNS/Bonjour discovery
│ │ ├── snmp_scan.py # SNMP subnet scanner
│ │ ├── win32_enum.py # Windows printer enumeration
│ │ └── usb_scan.py # USB device scanner
│ └── utils/ # Shared utilities
│ ├── types.py # Data models (PrinterTarget, PrintResult, etc.)
│ ├── errors.py # Error handling
│ ├── logger.py # Logging
│ └── platform.py # Platform detection
├── tests/
├── pyproject.toml
└── README.md
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timeverse_printer_mcp-1.0.1.tar.gz.
File metadata
- Download URL: timeverse_printer_mcp-1.0.1.tar.gz
- Upload date:
- Size: 40.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba541ee3dddb023f736774c338328e10ec36188dc58eea496357370a686cf84c
|
|
| MD5 |
010299b640dc4476d7127a3f85d71e99
|
|
| BLAKE2b-256 |
92dc0cfe11af2dc17eab1929bcfe71faa41668dc3fa3de31e0b5a283d97b428f
|
Provenance
The following attestation bundles were made for timeverse_printer_mcp-1.0.1.tar.gz:
Publisher:
publish.yml on elimyliu/timeverse-printer-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
timeverse_printer_mcp-1.0.1.tar.gz -
Subject digest:
ba541ee3dddb023f736774c338328e10ec36188dc58eea496357370a686cf84c - Sigstore transparency entry: 2225807653
- Sigstore integration time:
-
Permalink:
elimyliu/timeverse-printer-mcp@03afe2a1c1bee8b8b859adb3b987482ac4228c22 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/elimyliu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@03afe2a1c1bee8b8b859adb3b987482ac4228c22 -
Trigger Event:
push
-
Statement type:
File details
Details for the file timeverse_printer_mcp-1.0.1-py3-none-any.whl.
File metadata
- Download URL: timeverse_printer_mcp-1.0.1-py3-none-any.whl
- Upload date:
- Size: 52.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c37f425d3bc3c8908f8c13b4ad43a62448c1d10b11f9e3eb4d73e4b7ce2925e8
|
|
| MD5 |
a19215d6741e2b962f30676ac0ab325e
|
|
| BLAKE2b-256 |
9c415aae881fede4b2f80acb8b7c5a5c2e781bde1ad3e6bdca4addf5af9e8a9c
|
Provenance
The following attestation bundles were made for timeverse_printer_mcp-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on elimyliu/timeverse-printer-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
timeverse_printer_mcp-1.0.1-py3-none-any.whl -
Subject digest:
c37f425d3bc3c8908f8c13b4ad43a62448c1d10b11f9e3eb4d73e4b7ce2925e8 - Sigstore transparency entry: 2225808315
- Sigstore integration time:
-
Permalink:
elimyliu/timeverse-printer-mcp@03afe2a1c1bee8b8b859adb3b987482ac4228c22 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/elimyliu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@03afe2a1c1bee8b8b859adb3b987482ac4228c22 -
Trigger Event:
push
-
Statement type: