
PaperSprocket
io.github.inde-xv1.0.0更新於 Oct 1, 2026
EU-hosted HTML-to-PDF rendering for agents and MCP clients. Temporary document processing.
概覽
透過託管的 PaperSprocket API 將 HTML 轉成 PDF,並查詢帳戶的預付餘額。
- 功能
- 只提供兩個工具。render_html_to_pdf 接收 HTML 字串與選用的頁面設定(A4 或 Letter、直向或橫向、頁邊距、是否列印背景),回傳 application/pdf 資源、可寫入時的本地檔案路徑,以及 render_id、page_count、charged_cents、balance_cents 等渲染中繼資料。check_balance 回傳所設定帳戶的 account_id、balance_cents、currency 與 page_price_cents。
- 適用情境
- 適合需要把產生的 HTML 或 CSS 轉成 PDF 文件的情境,例如發票、報表或格式化匯出,也適合在渲染前後查看預付餘額。它是精簡的渲染與餘額查詢服務,不是文件管理系統。
- 執行需求
- 需要 Node.js 20 或更新版本,以 stdio 方式在本機執行,可透過 npx papersprocket-mcp 或原始碼 checkout 啟動。需要 PaperSprocket 帳戶與 API 金鑰,透過環境變數 PAPERSPROCKET_API_KEY 或伺服器的 .env 檔提供。可選設定 PAPERSPROCKET_BASE_URL 與 PAPERSPROCKET_MCP_OUTPUT_DIR。需要連線至 PaperSprocket API 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 PaperSprocket,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
PaperSprocket MCP server
A Model Context Protocol (MCP) server that gives MCP clients direct access to the PaperSprocket API. It exposes exactly two tools:
This is a minimal native MCP server built directly on
@modelcontextprotocol/sdk. No top-up tools, no API-key-management tools —
just render and balance-check.
What is PaperSprocket?
PaperSprocket is a hosted API that turns HTML into PDFs. You send it HTML, it returns a well-formed PDF. There is no business-field schema to learn: you control the layout with your own HTML and CSS, PaperSprocket handles the PDF processing. See the official documentation.
Requirements
- Node.js >= 20
- A PaperSprocket API key. The server reads it from server-side config
only (environment or
.env) — it is never a caller-supplied tool argument, and is never embedded in source, examples, or this document.
Install
Run via npx (primary)
The package papersprocket-mcp is published to npm and registered in the
official MCP Registry under identity io.github.inde-x/papersprocket (active,
version 1.0.0). Point your MCP client at npx -y papersprocket-mcp and provide
PAPERSPROCKET_API_KEY in the client's environment (the server reads it
server-side only).
From source (optional / development)
Configuration
The server loads <serverdir>/.env at startup (it does not override
already-set environment variables). .env is gitignored.
Example .env (replace the placeholder — never commit a real key):
Run (stdio)
Connect an MCP client
Point your MCP client at a stdio server:
PAPERSPROCKET_API_KEY is provided via the server .env or environment —
never in the client configuration.
MCP Inspector
List tools → confirm exactly two: render_html_to_pdf and check_balance.
Tool schemas
render_html_to_pdf
html— required, non-empty string.page— optional. Defaults mirror the service's closed v1 schema:sizeA4,orientationportrait,margin_mm10on all sides,print_backgroundtrue. Unknown fields are rejected.
Result (two MCP content blocks):
text— metadata JSON:tool,format,render_id,page_count,charged_cents,balance_cents,bytes,file_path,idempotency_key.resource—application/pdfblob (base64) with afile://(orurn:) URI.
check_balance
account_id— required, non-empty string.
Result: { account_id, balance_cents, currency, page_price_cents }
(text block).
Idempotency
- A fresh random idempotency key is generated for each logical render.
- On a transient network failure the server retries up to 2× reusing the same key, so a retry of one logical render cannot double-charge.
- Server-side, PaperSprocket dedupes on
(Idempotency-Key, request hash), so a true replay returns the original result without a second debit.
Security / secret boundary
PAPERSPROCKET_API_KEYis read from.env/ environment — it is not a field in any tool input schema.PAPERSPROCKET_BASE_URLis fixed/config state, not an agent-controlled argument.- The key is sent only as the
AuthorizationHTTP header. No other credentials exist. - Rendered PDFs written to
output/are your own content; the directory is gitignored.
Pricing
- $10 initial prepaid credit
- $10 top-ups
- $0.02 / page
Getting a key
Create a PaperSprocket account to get your API key and prepaid credit:
- Onboarding: https://papersprocket.com/onboarding/?source=mcp
License
MIT — see LICENSE.
來源:README.md,提交 a021f7a
工具
0版本歷史
1- v1.0.0最新Oct 1, 2026

