FlowTruxFlowTrux/Docs
Docsmcp

PDF Generator MCP Server

Generate PDF documents from markdown, structured reports, and data tables

The PDF MCP server generates PDF documents and stores them in S3 (the same bucket used by the Files server). It supports three generation modes: markdown text, structured reports with sections, and data tables.

How It Works

  1. An Agent or Action node calls a PDF tool with content (markdown, JSON sections, or table data).
  2. The server generates a PDF using PDFKit.
  3. The PDF is uploaded to S3 under the workspace path: org_{id}/workspace_{id}/pdf/filename.pdf.
  4. A presigned download URL (valid for 1 hour) is returned.

Setup

The PDF server uses the same platform S3 storage as the Files server. No additional configuration is needed.

  1. Go to Settings > MCP Servers > Add Server.
  2. Select PDF Generator.
  3. Click Save.
  4. Assign to a workspace in Settings > Workspaces > Edit.

Tools

generate_pdf

Generate a PDF from markdown or plain text. Supports headings (#, ##, ###), unordered lists (-, *), ordered lists (1.), horizontal rules (---), and paragraphs.

ParameterTypeRequiredDescription
contentstringYesMarkdown or plain text content
titlestringNoDocument title (displayed at top of first page)
filenamestringNoOutput file name (default: document.pdf)
pathstringNoSubfolder path in S3 (default: pdf)
page_sizestringNoA4, Letter, A3, or Legal (default: A4)
orientationstringNoportrait or landscape (default: portrait)
header_textstringNoText shown in the header of every page
footer_textstringNoFooter text (default: Page X of Y)

Returns the S3 key, file size, and a presigned download URL.

generate_pdf_report

Generate a structured PDF report from an array of typed sections. Best for reports that mix headings, paragraphs, lists, tables, and separators.

ParameterTypeRequiredDescription
titlestringNoReport title
sectionsarrayYesArray of section objects (see below)
filenamestringNoOutput file name (default: report.pdf)
pathstringNoSubfolder path in S3 (default: pdf)
page_sizestringNoA4, Letter, A3, or Legal (default: A4)
orientationstringNoportrait or landscape (default: portrait)
header_textstringNoHeader text on every page
footer_textstringNoFooter text (default: Page X of Y)

Section types:

TypeFieldsDescription
headingtext, level (1-3)Section heading
paragraphtextBody text
listitems[], ordered?Bulleted or numbered list
tableheaders[], rows[][]Data table with headers
separator(none)Horizontal line

Example sections array:

[
  { "type": "heading", "level": 1, "text": "Monthly Report" },
  { "type": "paragraph", "text": "Summary of activities for March 2026." },
  { "type": "table", "headers": ["Metric", "Value"], "rows": [["Revenue", "$12,000"], ["Users", "340"]] },
  { "type": "separator" },
  { "type": "heading", "level": 2, "text": "Action Items" },
  { "type": "list", "items": ["Review Q1 targets", "Update forecasts", "Schedule review meeting"], "ordered": true }
]

generate_pdf_table

Generate a PDF containing a single data table. A quick way to export tabular data as a downloadable PDF.

ParameterTypeRequiredDescription
titlestringNoTable title
headersstring[]YesColumn header names
rowsstring[][]YesData rows (arrays of cell values)
filenamestringNoOutput file name (default: table.pdf)
pathstringNoSubfolder path in S3 (default: pdf)
orientationstringNoportrait or landscape (default: auto -- landscape for 5+ columns)

generate_pdf_html

Render raw HTML + CSS into a PDF via headless Chromium (Puppeteer). Use this when you need full styling - branded reports, email-style layouts, complex tables, custom fonts, two-column designs. Heavier than the three pdfkit-based tools above (cold start ~1-2 s, then sub-second per page); prefer those for plain markdown / structured-section docs.

ParameterTypeRequiredDescription
htmlstringYesFull HTML document or fragment. External resources are loaded with networkidle0 - embed inline <style> for the fastest renders.
filenamestringNoOutput file name (default: document.pdf)
pathstringNoSubfolder path in S3 (default: pdf)
page_sizestringNoA4, Letter, A3, Legal, Tabloid (default: A4)
orientationstringNoportrait or landscape (default: portrait)
margin_top / margin_bottom / margin_left / margin_rightstringNoCSS units like 20mm, 1in, 0 (defaults: 20mm vertical, 15mm horizontal)
header_templatestringNoHTML for the per-page header. Supports Chromium classes: <span class="title">, <span class="date">, <span class="pageNumber">, <span class="totalPages">.
footer_templatestringNoHTML for the per-page footer (same template-class support).
print_backgroundbooleanNoRender CSS backgrounds and images (default: true)

Example body for an AI-generated invoice:

<!doctype html>
<html><head><style>
  body { font-family: 'Helvetica Neue', sans-serif; color: #222; margin: 0; }
  h1   { font-size: 22pt; border-bottom: 2px solid #0a66c2; padding-bottom: 6pt; }
  table { width: 100%; border-collapse: collapse; margin-top: 12pt; }
  th, td { border: 1px solid #ddd; padding: 6pt 8pt; text-align: left; }
  th    { background: #f5f7fa; }
</style></head><body>
  <h1>Invoice INV-2026-0042</h1>
  <p>Acme Inc. - due 2026-05-15</p>
  <table>
    <tr><th>Item</th><th>Qty</th><th>Price</th></tr>
    <tr><td>Pro plan</td><td>3</td><td>$87.00</td></tr>
  </table>
</body></html>

Example Workflows

Generate a report from processed data

  1. Trigger -- Cron (weekly)
  2. Action -- HTTP request to fetch metrics from an API
  3. Agent -- Analyze metrics and format as structured sections (JSON)
  4. Action -- MCP tool pdf:generate_pdf_report with title and sections
  5. Action -- MCP tool slack:send_message with the download URL

Export query results as PDF table

  1. Trigger -- Webhook with query parameters
  2. Action -- HTTP request to fetch data
  3. Action -- MCP tool pdf:generate_pdf_table with headers and rows
  4. Action -- Return download URL via webhook response

AI-generated document

  1. Trigger -- Manual with topic input
  2. Agent -- Write a document in markdown format on the given topic
  3. Action -- MCP tool pdf:generate_pdf with the markdown content
  4. Agent -- Send download link via Telegram or email