PolyDoc

tech.polydoc由 polydoc.tech 发布v0.1.10更新于 Nov 4, 2026

HTML/URL to PDF, screenshots, e-invoices. PDF/A and PDF/UA output with optional veraPDF verify.

已验证STDIO仅桌面商业与电商媒体与设计

概览

AI 生成的概览

PolyDoc 通过 PolyDoc API 把 HTML、网址或模板转换为 PDF、截图和欧盟合规电子发票,并把文件保存到本地。

可以做什么
  • 把 HTML、网址或已保存模板转换为 PDF,可设置版式、页边距、页面格式、书签和标记化输出
  • 把 HTML、网址或模板渲染为 PNG、JPEG 或 WebP 截图,可控制视口和像素比
  • 根据结构化发票数据生成 Factur-X 或 ZUGFeRD 混合 PDF/A-3 电子发票
  • 以 PDF/A 和 PDF/UA-1 合规为目标,并可用 veraPDF 校验结果
  • 支持本地下载、云存储上传或 webhook 交付,并可检查已配置的 API 密钥
适用场景
适合需要从网页或 HTML 生成文档与图片、产出归档或无障碍合规 PDF、或生成欧盟电子发票的场景,无需自行搭建渲染流程。
运行要求
通过 npx 以 stdio 在本地运行,需要 Node.js 20.15 或更高版本。必须提供来自 PolyDoc 控制台的 POLYDOC_API_KEY。可选变量 POLYDOC_BASE_URL、POLYDOC_OUTPUT_DIR 和 POLYDOC_SANDBOX 分别调整接口地址、下载目录和沙箱默认值。需要能访问 PolyDoc API 的网络。
安装前请注意
API 密钥是付费服务凭据,通过环境变量传入;除非开启沙箱模式,转换会消耗生产配额,而沙箱输出带水印且有限流。用于转换的内容(包括发票数据)会发送到 PolyDoc API,webhook 或云存储交付会把结果发送到你指定的第三方地址。文件会写入所配置的输出目录。

安装

在 SourceWeft 中

  1. 打开 控制台中的 PolyDoc,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

polydoc-mcp

An MCP server for PolyDoc, a REST API that converts HTML or URLs to PDF, captures screenshots, and generates EU-compliant e-invoices (Factur-X / ZUGFeRD hybrid PDF/A-3). It lets MCP clients (Claude Desktop, Claude Code, Cursor, and others) drive PolyDoc directly.

PDF output can target PDF/A (archival) and PDF/UA-1 (accessible, ISO 14289-1). Both are best-effort by default; set verify on either to validate the result with veraPDF and fail the request instead of returning a non-conforming file.

Tools

  • polydoc_html_to_pdf - HTML, URL, or saved template to PDF (layout, margins, page format, page ranges, bookmarks, tagged PDFs, PDF/A and PDF/UA conformance).
  • polydoc_screenshot - HTML, URL, or template to PNG / JPEG / WebP, with viewport and device-pixel-ratio control. Returns an inline image preview when small enough.
  • polydoc_generate_einvoice - Factur-X or ZUGFeRD hybrid PDF/A-3 from structured invoice data, profiles basic, en16931 and extended.
  • polydoc_test_credentials - verify the configured API key with a minimal sandbox render (never draws production quota).

Content can come from a URL, an inline HTML string, or a saved template (with Liquid templateData). Downloads are written to a local directory and the file path is returned; you can also deliver to your cloud storage (presigned URL) or a webhook.

Installation

Requires Node.js >= 20.15. Published to npm, so clients can run it with npx:

npx -y polydoc-mcp

The server is configured entirely through environment variables (see below).

Configuration

VariableRequiredDefaultDescription
POLYDOC_API_KEYyes-API key from dashboard.polydoc.tech.
POLYDOC_SANDBOXnofalseDefault sandbox mode (watermarked, rate-limited). A tool call can override per request.
POLYDOC_BASE_URLnohttps://api.polydoc.techOverride for self-hosted or staging.
POLYDOC_OUTPUT_DIRnoOS temp dir + /polydocWhere downloads are written. Output never escapes this folder.

Client setup

Claude Desktop

Add to claude_desktop_config.json (Settings > Developer > Edit Config):

json
{  "mcpServers": {    "polydoc": {      "command": "npx",      "args": ["-y", "polydoc-mcp"],      "env": {        "POLYDOC_API_KEY": "your-key",        "POLYDOC_OUTPUT_DIR": "/Users/you/Documents/polydoc"      }    }  }}

Claude Code

claude mcp add polydoc -e POLYDOC_API_KEY=your-key -- npx -y polydoc-mcp

Cursor

Add to ~/.cursor/mcp.json (or a project .cursor/mcp.json) using the same mcpServers block shown for Claude Desktop.

Output and delivery

  • Download (default): the file is written under POLYDOC_OUTPUT_DIR and the absolute path is returned with metadata (size, conversion id, credits). Screenshots also return an inline image block. Pass returnBase64: true to also receive the bytes as base64 (heavy; for clients without a filesystem).
  • Cloud storage: set delivery: "cloudStorage" and presignedUrl. The upload URL is returned.
  • Webhook: set delivery: "webhook" and a webhook object ({ url, async?, method?, headers? }).

PDF/A and PDF/UA

polydoc_html_to_pdf takes two conformance targets inside pdfOptions:

json
{  "pdfOptions": {    "pdfa": { "level": "3b", "verify": true },    "pdfua": { "verify": true }  }}

pdfa.level is 1b, 2b, or 3b. Setting pdfua forces a tagged render, so you do not need tagged as well.

Without verify, output is best-effort: it targets the standard but the request still succeeds if the toolchain cannot satisfy every machine-checkable rule. With verify: true, veraPDF validates the result and a non-conforming file fails with 422 instead of being returned. Use it when a downstream system will reject a bad file anyway.

Anything not in a tool's schema?

Every conversion tool has an advanced object that is deep-merged into the request body, so any API capability not surfaced as a typed field (for example pdf.watermark, pdf.encryption, render, request) is still reachable. See the field reference at docs.polydoc.tech.

Examples

Worked tool inputs for each angle live in examples/: a branded PDF from a template, a URL screenshot, and a ZUGFeRD / EN 16931 e-invoice.

Development

  • yarn install
  • yarn build - compile to dist/
  • yarn lint
  • yarn test - unit tests (request builder, output jail, tool handlers) and an in-memory MCP round-trip
  • POLYDOC_API_KEY=your-key yarn test:integration - live smoke tests against the sandbox
  • yarn scrub:check - check for em-dashes in source and docs

Run the built server directly for a quick check:

POLYDOC_API_KEY=your-key node dist/index.js

License

MIT

来源:README.md,提交 c2f3c8a

工具

4

polydoc_html_to_pdf

PolyDoc: HTML/URL to PDF

Convert a web page, inline HTML, or a saved PolyDoc template to a PDF. Provide exactly one source: url, html, or templateId (with optional templateData). By default the PDF is written to the configured output directory and the file path is returned. Note: HTML that loads scripts from a CDN can hang the renderer; prefer self-contained HTML.

输入参数tagurlhtmlsandboxtimeoutwebhookadvanceddeliveryfilenamepdfOptionstemplateIdpresignedUrl另有 2 个

polydoc_screenshot

PolyDoc: Capture Screenshot

Capture a screenshot of a web page, inline HTML, or a saved PolyDoc template. Provide exactly one source: url, html, or templateId. Returns PNG/JPEG/WebP written to the configured output directory, plus an inline image preview when small enough to display.

输入参数tagurlhtmlsandboxtimeoutwebhookadvanceddeliveryfilenametemplateIdpresignedUrlreturnBase64另有 2 个

polydoc_generate_einvoice

PolyDoc: Generate E-Invoice

Generate an EU electronic invoice as a hybrid PDF/A-3 (ZUGFeRD or Factur-X): a human-readable PDF with embedded structured invoice XML. Provide the visible document via one source (html, templateId, or url) and the structured data via the invoice object. For EN 16931 (profile en16931), include a dueDate or paymentTerms (rule BR-CO-25), a seller taxId when a line uses VAT category S, a taxSummary, and totals where totalNetAmount + totalTaxAmount = totalGrossAmount.

输入参数tagurlhtmlverifyinvoice必填profilesandboxtimeoutwebhookadvanceddeliveryfilename另有 5 个

polydoc_test_credentials

PolyDoc: Test Credentials

Verify the configured PolyDoc API key by running a minimal sandbox render. Reports whether the key is accepted; never draws production quota.

无需输入参数。

版本历史

6
  1. v0.1.10最新Nov 3, 2026
  2. v0.1.9Oct 30, 2026
  3. v0.1.8Sep 24, 2026
  4. v0.1.7Sep 20, 2026
  5. v0.1.6Sep 18, 2026
  6. v0.1.4Sep 16, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分