EU-hosted HTML-to-PDF rendering for agents and MCP clients. Temporary document processing.
A Model Context Protocol (MCP) server that gives MCP clients direct access to the PaperSprocket API. It exposes exactly two tools:
| Tool | Description |
|---|---|
render_html_to_pdf(html, page?) | Render HTML to a PDF through the PaperSprocket API. Returns the PDF as an application/pdf MCP resource (base64 blob), a local file path when the server can write one, and render metadata (render_id, page_count, charged_cents, balance_cents). Billed to the configured account. |
check_balance(account_id) | Read the prepaid balance of the configured PaperSprocket account. Returns account_id, balance_cents, currency, and page_price_cents. |
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.
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.
.env) — it is never a caller-supplied tool
argument, and is never embedded in source, examples, or this document.npx -y papersprocket-mcp
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).
git clone https://github.com/inde-x/papersprocket-mcp.git
cd papersprocket-mcp
npm ci
cp .env.example .env # then set PAPERSPROCKET_API_KEY (see Configuration)
The server loads <serverdir>/.env at startup (it does not override
already-set environment variables). .env is gitignored.
| Variable | Required | Default | Purpose |
|---|---|---|---|
PAPERSPROCKET_API_KEY | yes | — | Your PaperSprocket API key. Secret/config state — never a tool argument. |
PAPERSPROCKET_BASE_URL | no | https://papersprocket.com/api | API base URL. Fixed/config state. |
PAPERSPROCKET_MCP_OUTPUT_DIR | no | ./output | Directory where rendered PDFs are also written (best-effort) for filesystem-local clients. |
Example .env (replace the placeholder — never commit a real key):
PAPERSPROCKET_API_KEY=psk_your_api_key_here
# PAPERSPROCKET_BASE_URL=https://papersprocket.com/api
# PAPERSPROCKET_MCP_OUTPUT_DIR=./output
node server.js # MCP over stdio
node server.js --list-tools # print tool schemas, then exit
Point your MCP client at a stdio server:
# primary — published npm distribution:
Command: npx
Arguments: -y papersprocket-mcp
# or a local source checkout:
Command: node
Arguments: /path/to/papersprocket-mcp/server.js
PAPERSPROCKET_API_KEY is provided via the server .env or environment —
never in the client configuration.
npx @modelcontextprotocol/inspector node /path/to/papersprocket-mcp/server.js
List tools → confirm exactly two: render_html_to_pdf and check_balance.
render_html_to_pdf{
"html": { "type": "string", "description": "HTML to render (non-empty)." },
"page": {
"properties": {
"size": { "enum": ["A4", "Letter"] },
"orientation": { "enum": ["portrait", "landscape"] },
"margin_mm": { "top|right|bottom|left": { "type": "number", "minimum": 0, "maximum": 50 } },
"print_background": { "type": "boolean" }
}
}
}
html — required, non-empty string.page — optional. Defaults mirror the service's closed v1 schema: size
A4, orientation portrait, margin_mm 10 on all sides,
print_background true. 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/pdf blob (base64) with a file:// (or urn:)
URI.check_balance{ "account_id": { "type": "string" } }
account_id — required, non-empty string.Result: { account_id, balance_cents, currency, page_price_cents }
(text block).
(Idempotency-Key, request hash), so a
true replay returns the original result without a second debit.PAPERSPROCKET_API_KEY is read from .env / environment — it is not a
field in any tool input schema.PAPERSPROCKET_BASE_URL is fixed/config state, not an agent-controlled
argument.Authorization HTTP header. No other
credentials exist.output/ are your own content; the directory is
gitignored.Create a PaperSprocket account to get your API key and prepaid credit:
MIT — see LICENSE.
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
npx -y papersprocket-mcpMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-inde-x-papersprocket": {
"command": "npx",
"args": [
"-y",
"papersprocket-mcp"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referencePaperSprocket works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.