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
- An Agent or Action node calls a PDF tool with content (markdown, JSON sections, or table data).
- The server generates a PDF using PDFKit.
- The PDF is uploaded to S3 under the workspace path:
org_{id}/workspace_{id}/pdf/filename.pdf. - 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.
- Go to Settings > MCP Servers > Add Server.
- Select PDF Generator.
- Click Save.
- 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | Yes | Markdown or plain text content |
title | string | No | Document title (displayed at top of first page) |
filename | string | No | Output file name (default: document.pdf) |
path | string | No | Subfolder path in S3 (default: pdf) |
page_size | string | No | A4, Letter, A3, or Legal (default: A4) |
orientation | string | No | portrait or landscape (default: portrait) |
header_text | string | No | Text shown in the header of every page |
footer_text | string | No | Footer 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | No | Report title |
sections | array | Yes | Array of section objects (see below) |
filename | string | No | Output file name (default: report.pdf) |
path | string | No | Subfolder path in S3 (default: pdf) |
page_size | string | No | A4, Letter, A3, or Legal (default: A4) |
orientation | string | No | portrait or landscape (default: portrait) |
header_text | string | No | Header text on every page |
footer_text | string | No | Footer text (default: Page X of Y) |
Section types:
| Type | Fields | Description |
|---|---|---|
heading | text, level (1-3) | Section heading |
paragraph | text | Body text |
list | items[], ordered? | Bulleted or numbered list |
table | headers[], 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | No | Table title |
headers | string[] | Yes | Column header names |
rows | string[][] | Yes | Data rows (arrays of cell values) |
filename | string | No | Output file name (default: table.pdf) |
path | string | No | Subfolder path in S3 (default: pdf) |
orientation | string | No | portrait 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
html | string | Yes | Full HTML document or fragment. External resources are loaded with networkidle0 - embed inline <style> for the fastest renders. |
filename | string | No | Output file name (default: document.pdf) |
path | string | No | Subfolder path in S3 (default: pdf) |
page_size | string | No | A4, Letter, A3, Legal, Tabloid (default: A4) |
orientation | string | No | portrait or landscape (default: portrait) |
margin_top / margin_bottom / margin_left / margin_right | string | No | CSS units like 20mm, 1in, 0 (defaults: 20mm vertical, 15mm horizontal) |
header_template | string | No | HTML for the per-page header. Supports Chromium classes: <span class="title">, <span class="date">, <span class="pageNumber">, <span class="totalPages">. |
footer_template | string | No | HTML for the per-page footer (same template-class support). |
print_background | boolean | No | Render 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
- Trigger -- Cron (weekly)
- Action -- HTTP request to fetch metrics from an API
- Agent -- Analyze metrics and format as structured sections (JSON)
- Action -- MCP tool
pdf:generate_pdf_reportwith title and sections - Action -- MCP tool
slack:send_messagewith the download URL
Export query results as PDF table
- Trigger -- Webhook with query parameters
- Action -- HTTP request to fetch data
- Action -- MCP tool
pdf:generate_pdf_tablewith headers and rows - Action -- Return download URL via webhook response
AI-generated document
- Trigger -- Manual with topic input
- Agent -- Write a document in markdown format on the given topic
- Action -- MCP tool
pdf:generate_pdfwith the markdown content - Agent -- Send download link via Telegram or email