
PrintGo
io.github.Nishkalkashyapv0.2.0更新於 Oct 6, 2026
Print PDFs, images, text, Markdown and HTML to your local printers, and track or cancel the jobs.
概覽
讓助理列出本機印表機,列印 PDF、圖片、文字、Markdown 或 HTML,並查詢或取消列印工作。
- 功能
- PrintGo 提供七個工具:listPrinters、getPrinterCapabilities、checkPrinterStatus、sendPrintCommand、printMarkup、getPrintJobStatus 和 cancelPrintJob。助理可以從公開的 HTTPS 連結列印 PDF、PNG、JPEG 或純文字檔案,或用無頭 Chrome 渲染 Markdown 和 HTML,並可設定份數、頁面範圍、紙張大小、方向、單雙面、彩色或黑白以及符合頁面。它也能查看印表機狀態與工作狀態,並取消自己送出的工作。
- 適用情境
- 適合讓助理把文件送到你自己電腦上連接的印表機,例如列印發票、票券、標籤或渲染後的 Markdown 和 HTML。可用於透過 stdio 啟動的本機 MCP 用戶端,也可用於經 Cloudflare 通道存取的遠端用戶端。
- 執行需求
- 需要 macOS、Linux 或 Windows 上的 Node.js 22.12 或更新版本,以及作業系統已辨識的印表機(macOS 和 Linux 使用 CUPS;Windows 使用 PowerShell 和 SumatraPDF)。列印 Markdown 和 HTML 需要 Chrome 或 Chromium。通道模式需要 cloudflared(可能會被下載),並要求 MCP 用戶端支援 Streamable HTTP;stdio 模式兩者都不需要。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 PrintGo,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
PrintGo-MCP
PrintGo lets an AI assistant print to the printers on your computer. It's an MCP server: once your MCP client is connected to it, the assistant can list your printers, send them PDFs, images, text, Markdown, or HTML, and check on the jobs afterwards.
PrintGo runs on the computer the printer is connected to and puts itself behind a Cloudflare tunnel, so your assistant can reach it from anywhere: a cloud agent, another laptop, or the same machine.
What you need
- Node.js 22.12 or newer.
- macOS, Linux, or Windows, with a printer your operating system already knows
about. PrintGo doesn't install drivers; it talks to the print system you
already have:
- macOS and Linux use CUPS (the
lp,lpstat,lpoptions, andcancelcommands). - Windows uses PowerShell and SumatraPDF.
PrintGo turns everything into a PDF before printing, so SumatraPDF is
needed for every job, not just PDFs. It should be on your
PATH, or you can point to it with--sumatra-pdf <path>.
- macOS and Linux use CUPS (the
- Chrome or Chromium, but only if you want to print Markdown or HTML. If you
don't have either,
printgo install-browserwill download one. To use a specific browser, pass--chrome <path>or setPRINTGO_CHROME_PATH.
Getting started
Install the CLI:
Then start it:
This starts PrintGo in the background along with a Cloudflare tunnel, then
prints an MCP URL and a password. Add that URL to your MCP client and send the
password as an Authorization: Bearer <password> header. Your client needs
to support MCP's Streamable HTTP transport; the older SSE transport isn't
supported.
The password is generated the first time you run start and reused after
that. Treat it like a key to your printer: anyone who has it can print, and
can cancel jobs PrintGo has submitted. Traffic goes through Cloudflare.
PrintGo needs cloudflared for the tunnel. If it can't find one, it asks
before downloading the official release from GitHub. Pass --yes to skip the
question (you'll need this when there's no terminal to answer it), or
--no-download to fail instead. If cloudflared lives somewhere unusual,
pass --cloudflared <path>.
If you'd rather not install globally, npx printgo <command> works too. The
package also installs a printgo-mcp command, which is the same thing under
another name.
Managing the server
restart reuses the settings from your last start. If something goes wrong,
the background server's log is at ~/.printgo/daemon.log.
By default you get a Cloudflare Quick Tunnel, which needs no Cloudflare account, but its URL changes every time PrintGo starts. If you have a domain on Cloudflare, you can give PrintGo a stable address instead:
If cloudflared isn't logged in to your Cloudflare account yet, this opens a
browser so you can log in. PrintGo then creates a tunnel in your account (or
reuses one it made before) and adds a DNS record for that hostname. It won't
overwrite a DNS record that already exists.
Custom domain settings are saved, so later start and restart calls reuse
them. Pass --quick to use a Quick Tunnel for a particular run. You can also
connect a tunnel you already have, or use a token from the Cloudflare
dashboard; printgo start --help lists all the options. Add --json to
start, stop, status, or restart if you're calling them from a script.
Local only, without a tunnel
If your MCP client runs on the same computer as the printer, you can skip the tunnel and let the client launch PrintGo directly over stdio:
You don't run printgo start in this mode. The client starts PrintGo when it
needs it and shuts it down when it's done, and there's no password or
Cloudflare involved.
What the assistant can do
PrintGo gives the assistant seven tools:
When printing, the assistant can choose the number of copies (up to 100), page ranges, paper size, orientation, single- or double-sided, color or black and white, and whether to fit the content to the page.
A few things worth knowing:
- Files come from URLs, not your disk. The assistant passes a public HTTPS link and PrintGo downloads it. Signed links work. Local file paths and private network addresses are refused, including through redirects, so a prompt can't trick PrintGo into printing something off your machine or your local network. Downloads are capped at 10 MiB.
- Link to the file itself.
sendPrintCommandwants a direct download, not a web page that displays the file. To print HTML, useprintMarkup. - Markdown and HTML can be passed inline (up to 32 KiB) or by URL (up to 1 MiB). PrintGo renders them in headless Chrome with scripts disabled. Images and stylesheets they link to must also be public HTTPS URLs.
- Word, Excel, and other Office files aren't supported. Convert them to PDF
first. PrintGo works out whether a URL is text from its file extension or the
server's content type; if it can't tell, set
assetType: 'text'. - Retries won't print twice. Every print request carries an
idempotencyKey. If the assistant retries with the same key and arguments, PrintGo returns the original job instead of printing again. Reusing a key with different arguments is an error. A new key means a new print. - Job status only reflects the print queue. Printers don't report whether
paper actually came out. On macOS and Linux,
completedmeans the job left the queue, which also happens when a job fails or is cancelled outside PrintGo. On Windows, a job that has left the queue shows asunknown.
Where PrintGo keeps its state
PrintGo keeps everything in ~/.printgo: the remote password, tunnel settings,
job history, idempotency keys, logs, and any cloudflared or Chrome it
downloaded. You can point it somewhere else with --state-dir, the
PRINTGO_HOME environment variable, or the stateDir option in the SDK.
If you run more than one PrintGo server at a time, for example the background server and a stdio one, give each its own directory so they don't step on each other's job history.
Using it as a library
The same package can be used from your own Node code:
Talking to a PrintGo server
connectPrinter gives you a typed client, so you can call the tools as
ordinary functions:
The URL must be HTTPS, except for localhost during development.
To talk to a local server over stdio instead, pass
{ transport: new StdioClientTransport({ command, args }) }, importing
StdioClientTransport from @modelcontextprotocol/client/stdio. The client
opens and closes the transport for you.
Running the server yourself
To serve over stdio from your own process:
If you want more control, there are two lower-level options:
createPrinterMcpServer(options?)returns an MCP server that isn't connected to anything yet, so you can attach your own transport.createPrinterHttpServer({ password, ...options })returns an HTTP server withlisten(),close(), andsetPublicURL(). It serves MCP at/mcp, only listens on127.0.0.1, and requires a password of at least 32 characters. If you put it behind your own proxy, callsetPublicURL()with the public address; requests for any other hostname are rejected.
Neither one starts a tunnel. Both accept stateDir, adapter,
assetDownloader, sumatraPdfPath, and browserExecutablePath. If you
supply your own assetDownloader, you're taking over PrintGo's URL, size, and
timeout checks, so make sure yours does the same.
Managing the tunnel from code
The hosting commands live in a separate entry point:
configureCloudflare and ensureCloudflared are exported from there as well.
Working on PrintGo
From a clone of this repo:
npm test builds first. The tests use fake printers and a fake cloudflared,
so they won't print anything or touch Cloudflare. The Markdown and HTML
rendering tests need a local Chrome or Chromium and are skipped if there isn't
one; set REQUIRE_CHROMIUM_TESTS=1 to make that a failure instead.
npm run smoke:tunnel starts a real Quick Tunnel and checks that an
authenticated MCP client can reach PrintGo through it, without printing
anything. It needs cloudflared installed, or run
npm run smoke:tunnel -- --yes to let it download one.
Before publishing, npm pack --dry-run shows what will go into the package.
License
MIT. The bundled Noto Sans font is under the SIL Open Font License.
來源:README.md,提交 008cc5b
工具
0版本歷史
1- v0.2.0最新Oct 6, 2026


