# docgen-mcp-server [Health: Active]

**Category:** 🏢 Workplace & Productivity  
**Repository:** https://github.com/cyanheads/docgen-mcp-server  
**GitHub Stars:** 3  
**npm Downloads (last month):** 1085  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/docgen-mcp-server

## Description
Render HTML/markdown to PDF, export rows to xlsx, and fill AcroForm PDFs.

## Tools
Capabilities this server exposes over MCP:

- **docgen_render_pdf** — Render content to a downloadable PDF document. Provide exactly one source: { html } (raw HTML you compose — the recommended path), { markdown } (converted to HTML then rendered), or { template, data } (a {{key}} template filled from a data object, server-owned layout). Control page size, orientation, margins, header/footer, and page numbers via pageOptions. Returns a delivery envelope with a documentId, resource URI, pageCount, byte size, and inline base64 when small enough. The lightweight engine renders structured layout (headings, paragraphs, lists, tables) but not arbitrary CSS. The degraded flag discloses dropped styling or character replacement with ? on any text surface, including headers and footers; smart-punctuation transliteration alone does not set it.
- **docgen_export_spreadsheet** — Render one or more named worksheets of row objects to a downloadable .xlsx workbook. Each sheet is a name plus an array of row objects (property → scalar), with an optional column spec controlling header label, value type, width, and number/date format. An empty rows array yields a header-only sheet; provide at least one sheet. Returns a delivery envelope with a documentId, resource URI, sheetCount, byte size, and inline base64 when small enough. The natural export stage for tabular data pulled from another server — reshape its rows into sheets[] and render.
- **docgen_fill_form** — Fill the AcroForm fields of a supplied PDF and optionally flatten it. Provide the source PDF as exactly one of { base64 } or { url } (a public https URL serving application/pdf; base64 avoids any fetch), plus a fields map of AcroForm field name → value. Obtain exact case-sensitive names and choice options with docgen_list_form_fields. Signatures and buttons are discovery only. Names with no AcroForm counterpart come back in unmatchedFields[] rather than failing — correct them and re-render. Set flatten to bake the values in so the result is no longer editable. Returns a delivery envelope with a documentId, resource URI, pageCount, and inline base64 when small enough.
- **docgen_list_form_fields** — List the AcroForm fields in a PDF before calling docgen_fill_form. Provide exactly one sourcePdf.base64 or sourcePdf.url; URL sources must be public https serving application/pdf. Returns exact case-sensitive names (including nested names), canonical field types, required flags and options on dropdown, optionList and radioGroup fields. Signature and button entries are discovery only; docgen_fill_form does not sign PDFs or invoke buttons. Does not change the PDF or store a document.
- **docgen_get_document** — Re-fetch a previously rendered document by the id a docgen render/export/fill tool returned. Returns the same delivery envelope (metadata plus resource URI, and inline base64 when small enough). Use it to recover a document whose inline copy was dropped (over the inline size limit) while it is still within its TTL. The documentId is obtainable ONLY from an earlier docgen_render_pdf, docgen_export_spreadsheet, or docgen_fill_form result — it is not guessable, and an expired or unknown id returns document_expired.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `bunx` (confidence: high):

```json
"mcpServers": {
  "docgen-mcp-server": {
    "command": "bunx",
    "args": ["@cyanheads/docgen-mcp-server@latest"]
  }
}
```

## Documentation

## What docgen-mcp-server does

docgen-mcp-server provides five MCP tools for creating and retrieving generated documents. `docgen_render_pdf` turns one of three inputs into a PDF: raw HTML, Markdown, or a `{{key}}` template paired with a data object. Page size, orientation, margins, headers, footers, and page numbering can be controlled through page options.

`docgen_export_spreadsheet` builds an `.xlsx` workbook from one or more named sheets. Each sheet contains row objects, while an optional column definition controls labels, scalar types, widths, and number or date formats. Empty row arrays are supported for header-only sheets.

The form workflow is split into discovery and mutation. `docgen_list_form_fields` reports exact field names, types, required status, choices, and selected metadata. `docgen_fill_form` then applies values to an AcroForm PDF supplied as base64 or a public HTTPS URL. It can flatten the result so the filled values are no longer editable.

## How it works

Generated files are returned in a shared delivery envelope. It includes a document ID, resource URI, size information, and document-specific counts such as PDF pages or workbook sheets. Small files may also include inline base64; larger files can be read through the `docgen://document/{documentId}` resource or fetched again with `docgen_get_document` while the stored document remains within its TTL.

PDF rendering uses a bundled lightweight stack based on `pdf-lib` and `marked`. It handles structured content such as headings, paragraphs, lists, and tables, but does not aim to support arbitrary CSS. A degraded result identifies dropped styling or character replacement. Form fetching checks HTTPS destinations and redirect hops against private, loopback, and link-local addresses.

Form field names are case-sensitive in their canonical form, including nested paths. The fill tool reports unmatched names, resolved aliases, invalid values, and dropdowns made editable by custom text. Signatures and buttons can be discovered but are not signed or invoked.

## Setup and configuration

The server supports both STDIO and Streamable HTTP transports. It can be installed from the npm package or run from the published Docker image. The underlying MCP framework supports configurable authentication modes including none, JWT, and OAuth, plus storage backends such as in-memory storage, the filesystem, Supabase, and Cloudflare KV/R2/D1.

Document storage is tenant-scoped and expiring, so an ID is usable only by the tenant that created it and only until its retention period ends. Render size and execution time are bounded, producing typed errors instead of allowing an oversized or stalled operation to continue indefinitely.

## Tools and capabilities

- Render HTML, Markdown, or interpolated template data as PDF.
- Export scalar row objects to named XLSX worksheets.
- Inspect AcroForm fields before assigning values.
- Fill forms from base64 data or public PDF URLs and optionally flatten them.
- Re-fetch stored output through a document ID or MCP resource URI.
- Return structured metadata and human-readable delivery details on both output surfaces.

_Full upstream README: https://allmcps.com/mcp/docgen-mcp-server/readme_

