Skip to main content
Glama
pdf-writer-mcp

pdf-writer-mcp

by shuji-bonji

pdf-writer-mcp

CI npm version License: MIT

日本語

MCP server that creates PDFs from text, Markdown, or tabular data and edits existing ones (metadata and page operations). Built on normativepdf — a clause-driven PDF library in which every behaviour is tied to an ISO 32000 clause — with CJK font embedding via harfbuzz subsetting.

Part of the PDF family alongside pdf-reader-mcp (structure analysis) and pdf-verify-mcp (authenticity verification). Where pdf-reader-mcp tells you what is in a PDF and pdf-verify-mcp tells you whether it is genuine, pdf-writer-mcp is the one that writes it.

Tools

IMPORTANT

All file paths must be absolute (since v0.7.0). Relative paths and paths containing .. are rejected — a relative path would resolve against the MCP host's working directory, which is not the directory you think it is. This applies to inputPath, inputPaths, outputPath, outputDir, fontPath and attachmentPath. Input PDFs larger than 100 MB are also rejected.

Creation

Tool

Purpose

create_text_pdf

Plain text — honours \n, blank lines separate paragraphs, long lines wrap

create_markdown_pdf

Markdown — headings, paragraphs, bullet/ordered lists, code blocks, quotes, rules, tables

create_table_pdf

Ruled tables — automatic column widths, cell wrapping, headers repeated across page breaks

Shared options: outputPath, returnBase64, fontPath, fontSize, pageSize (A4/A3/A5/LETTER/LEGAL), margin, title, drawTitle, author, onMissingGlyph, tagged, lang, pdfVersion.

PDF 2.0 output (v0.16.0)

Pass pdfVersion: "2.0" to write an ISO 32000-2 file. The default stays "1.7", and its bytes are unchanged.

The version is not only a header. ISO 32000-2 attaches two obligations to it, and both are met:

  • trailer /ID becomes Required (Table 15). Both elements are equal on a first write (R-14.4-6), and the value stays deterministic under SOURCE_DATE_EPOCH.

  • the Info dictionary keeps only CreationDate and ModDate (§14.3.3); the title, author and producer move to the XMP metadata stream, where PDF 2.0 says document metadata belongs.

{ "text": "Body.", "title": "Report", "pdfVersion": "2.0" }

With tagged: true, a 2.0 file declares PDF/UA-2 (ISO 14289-2) instead of PDF/UA-1, which allows only PDF 1.0 to 1.7 (ISO 14289-1 §6.1). See PDF/UA-2 below. Up to v0.26.x the combination was refused.

Tagged PDF / PDF/UA (v0.5.0)

Pass tagged: true to produce an accessible, tagged PDF conforming to PDF/UA-1 (ISO 14289). Output is verified compliant by veraPDF (--flavour ua1, 106/106 rules).

{ "markdown": "# Title\n\nBody.", "title": "Report", "tagged": true, "lang": "en" }

Markdown maps onto the structure tree: headings → H1–H6, lists → L/LI/LBody, tables → Table/TR/TH/TD (headers get /Scope), quotes → BlockQuote, code → Code. Rules, borders and code backgrounds become artifacts. Under PDF/UA-1, heading levels are normalised so they start at H1 and never skip — a Markdown # → ### jump becomes H1 → H2 in the structure, while visual sizes stay as authored (PDF/UA-2 keeps the level as written; see below).

PDF/UA mandates a document title, so tagged: true requires title. The title is always written to the metadata (dc:title) and, by default, also drawn as the first H1. When the Markdown already starts with its own # … heading, pass drawTitle: false: the title then stays in the metadata only, and the first body heading becomes H1 (## → ### becomes H1 → H2). Output stays PDF/UA-1 compliant (veraPDF 106/106). lang (BCP 47) is inferred from the text when omitted and reported via warnings — pass it explicitly when you know it, since a wrong /Lang makes screen readers mispronounce the text.

NOTE

Tagging is opt-in — default output is unchanged.

Machine validation (veraPDF) only sees whether things exist. It cannot judge whether reading order or alt text are appropriate — human review still matters.

PDF/UA-2 (v0.27.0)

Add pdfVersion: "2.0" to tagged: true and the file is written as PDF/UA-2 (ISO 14289-2:2024) on PDF 2.0. The default (1.7, PDF/UA-1) is unchanged.

{ "markdown": "# Title\n\nBody.", "title": "Report", "tagged": true, "pdfVersion": "2.0", "lang": "en" }

What differs from the PDF/UA-1 output, with the clause behind each:

PDF/UA-1 (1.7)

PDF/UA-2 (2.0)

XMP declaration (§5)

pdfuaid:part 1

pdfuaid:part 2 and pdfuaid:rev 2024

Namespaces (§8.2.4, §8.2.5.2)

none (the default PDF 1.7 namespace)

Document and every type the PDF 2.0 namespace has get /NS → http://iso.org/pdf2/ssn; BlockQuote and Code, which it lacks, stay in the PDF 1.7 namespace

Drawn title (§8.2.5.13)

first H1

Title (not a heading)

Markdown headings (§8.2.5.12)

normalised to start at H1 and never skip

the level as written (# → H1, ### → H3)

Nested lists

inside the parent item's LBody

directly in the parent L, right after the item (ISO 32000-2 §14.8.4.8.2)

Measured with veraPDF 1.30.0 (pdfua-2, 1,728 rules): the output of all three create tools, ensure_tagged on an untagged PDF 2.0 file, and ensure_pdfa(flavour: "pdfa-4") on a PDF/UA-2 file all pass, and the last one also passes PDF/A-4 (109/109).

Edits keep the declaration: when a tool rebuilds the XMP, pdfuaid:rev is carried with pdfuaid:part, and dc:title is kept when the Info dictionary has no Title (PDF 2.0 output does not put one there). add_bookmarks writes structure destinations on a PDF/UA-2 file, as §8.8 requires: a GoTo action whose SD names the structure element that starts on the target page, with D kept as the page destination for viewers that do not read SD. A page with no structure content keeps a page destination and is named in warnings.

Versions and declarations

An edit writes the PDF version of its input. Only an explicit conversion changes it: ensure_pdfa with flavour: "pdfa-4" / "pdfa-4f" (to PDF 2.0), and merge_pdfs with pdfVersion. Versions are never lowered.

  • Anything that would break a shall of the output's version, or of a standard the file declares, is refused with INVALID_ARGUMENT. The message names the input's version and declarations; next_actions gives a call that fits. Examples: merge_pdfs over PDF 2.0 and PDF 1.x inputs without pdfVersion, and ensure_pdfa(flavour: "pdfa-3b") on any PDF 2.0 input (PDF/A-3 needs a %PDF-1.n header).

  • A form that the output's version deprecates is written the way that version prescribes. On a PDF 2.0 input, set_metadata writes to XMP and adds no Info entries (ISO 32000-2 §14.3.3); on a PDF/UA-2 input it also moves the existing Info entries to XMP and removes them (ISO 14289-2 §6.2).

  • A mix the standard allows is written and reported. Structure elements that add_annotation and tag_form_fields add to a PDF/UA-2 file have no /NS, so they sit in the PDF 1.7 namespace (§8.2.4 allows it); warnings says so.

Every tool result carries output, read back from the written file:

{ "output": { "pdfVersion": "2.0", "declares": { "pdfua": 2, "pdfa": "4" } } }

declares.pdfua is pdfuaid:part; declares.pdfa joins pdfaid:part and pdfaid:conformance ("3b", "4", "4f"). A key is absent when nothing is declared. A declaration is only a claim — measure it with pdf-verify-mcp.

When a tool rewrites the XMP (set_metadata, ensure_pdfa), the values you did not pass are carried over as written: the other languages of dc:title, every name in dc:creator, and properties in namespaces this server does not know. Changing title replaces the x-default entry and names the other languages in warnings.

Editing — page operations

Tool

Purpose

merge_pdfs

Concatenate 2–50 PDFs in order; metadata inherited from the first file. Inputs that mix PDF 2.0 and PDF 1.x need pdfVersion: "2.0"

split_pdf

One output file per page range

extract_pages

Extract pages in the requested order (doubles as reordering)

delete_pages

Remove pages (deleting every page is rejected)

reorder_pages

Reorder by an explicit permutation of all pages

rotate_pages

Rotate clockwise (90/180/270), accumulating over existing rotation. Edits in place, so the warning below does not apply

WARNING

The five tools other than rotate_pages rebuild the document from its pages.

  • Carried over: attachments (/Names /EmbeddedFiles, /AF), /Lang, /ViewerPreferences, /OutputIntents

  • Not carried over: the tagged structure tree, XMP, and anything tied to page numbers or page references (bookmarks, page labels, named destinations)

  • Whatever is lost is reported in warnings — nothing disappears silently

Page specs use "1,3-5,8-" (1-based; -3 means up to page 3, 8- means page 8 to the end). Order is preserved and duplicates are removed.

Editing — adding to and repairing documents

Tool

Purpose

set_metadata

Update Info dictionary fields (title / author / subject / keywords / creator), preserving the rest. On documents carrying XMP, dc:title etc. are kept in sync (PDF/UA and PDF/A declarations preserved). tdmReservation (0 | 1) and tdmPolicy write the W3C TDMRep rights statement to XMP (tdm:reservation / tdm:policy, namespace http://www.w3.org/ns/tdmrep/); a document without XMP gets one, and a PDF/A document also gets the schema described in pdfaExtension:schemas, so veraPDF does not fail ISO 19005-2 6.6.2.3 on it (v0.22.0)

add_bookmarks

Set the outline (bookmarks); nestable via children, replaces any existing outline

add_annotation

Add a sticky note (text), highlight, or square annotation. On tagged PDFs the annotation is nested in an Annot element and stays PDF/UA conformant — pass alt to describe it. On PDF/UA-2, alt is also written as Contents (§8.9.4.2 requires them to match), and a different contents is refused

attach_file

Embed a file (/Names /EmbeddedFiles + catalog /AF + /AFRelationship) — the PDF/A-3 shape

stamp_page_numbers

Stamp page numbers ({n} / {total}, six positions, pages, startAt). Becomes an artifact on tagged PDFs, so conformance holds

fill_form

Fill AcroForm fields. Japanese values via an embedded font; can flatten in the same pass

flatten_form

Flatten a form into static content. Refuses tagged PDFs by default (breaks PDF/UA)

tag_form_fields

Repair the form inside a tagged PDF for PDF/UA-1 (nest widgets in Form, set /Tabs S, add /TU alternate names; pass labels for human-readable names). On PDF/UA-2, widgets also get /Contents (§8.10.2.3). Idempotent

ensure_tagged

Put an existing PDF into the PDF/UA-1 container → Scaffolding an untagged PDF

ensure_pdfa

Put an existing PDF into the PDF/A-3b / PDF/A-4 / PDF/A-4f container (flavour) → The archival container

add_watermark

Overlay a diagonal watermark ("社外秘" / "DRAFT"). Behind the body content by default; artifact on tagged PDFs

Shared options: outputPath, returnBase64, allowBreakingSignatures.

IMPORTANT

Editing signed PDFs: an ordinary save rewrites the whole file, so editing normally invalidates existing signatures. PDFs containing /ByteRange are rejected by default.

  • preserveSignatures: true — appends an ISO 32000 incremental update that keeps every signature valid (the original bytes are untouched). Supported by every editing tool that adds to a document: add_annotation, set_metadata, add_bookmarks, tag_form_fields, ensure_tagged, attach_file, stamp_page_numbers, add_watermark (on tagged PDFs the structure-tree changes ride the same increment)

  • allowBreakingSignatures: true — proceed destructively, invalidating signatures

  • Certified documents (DocMDP) are refused when the change type is not permitted by the certification level (§12.8.2.2)

Measured: stacked increments on a really-signed PDF keep pdf-verify-mcp reporting VALID, and incremental structure updates on tagged PDFs stay veraPDF COMPLIANT (106/106).

Scaffolding an untagged PDF (ensure_tagged)

ensure_tagged puts an existing PDF into the PDF/UA-1 container. On tagged input the structure tree is left untouched and only missing document-level requirements are repaired (MarkInfo, /Lang, DisplayDocTitle, XMP). On a document that never had a structure tree, a minimal scaffold is created — each page's content wrapped in a single P element, which makes the text reachable by assistive technology and passes veraPDF (measured: 106/106).

WARNING

This is a scaffold, not accessibility. A machine cannot infer meaning, so headings, lists, tables, reading order and figure alt text are not produced. The tool says so in its warnings. (Wrapping the content in Artifact would also pass veraPDF while hiding the body from screen readers — conformance theatre, deliberately not implemented.) Where you control the source, create_* with tagged: true produces real structure; ensure_tagged is for documents you were handed.

The archival container (ensure_pdfa)

ensure_pdfa is the archival (PDF/A-3b) counterpart of ensure_tagged. It adds only the document-level requirements:

  • trailer /ID (ISO 32000-1 §14.4)

  • an sRGB output intent (GTS_PDFA1; ICC profile generated and embedded)

  • the XMP pdfaid declaration (the creation date is inherited from Info /CreationDate)

WARNING

Content streams, fonts and the structure tree are untouched — so thisdoes not make a PDF conform. Write the declaration, then measure it: verify with pdf-verify-mcp's validate_conformance(flavour: "pdfa-3b"). Measured on the electronic-bookkeeping sample: veraPDF 146/146 COMPLIANT, PDF/UA-1 still 106/106, attachment preserved.

Since v0.17.0 the result also carries declarationRisks when the claim is already known to be false. The only risk reported today is FONT_NOT_EMBEDDED: PDF/A requires every font to be embedded and ensure_pdfa does not embed fonts, so a document drawn with the standard 14 faces fails validation regardless of how correct its document-level structure is. The declaration is still written — the verdict belongs to veraPDF — but the caller can now branch on the risk instead of parsing the warning text.

Since v0.24.0 the result carries previousDeclaration — the PDF/A the input already claimed, as { part, conformance }, or null — in place of wasDeclared (a boolean that did not say whether the earlier claim matched the requested flavour). This is a breaking change.

ensure_pdfa refuses pdfa-4 / pdfa-4f for an input that declares PDF/UA-1 (v0.24.0). PDF/A-4 sets the header to PDF 2.0, while PDF/UA-1 allows versions 1.0 to 1.7 (ISO 14289-1 §6.1), so the file would fail one of its two claims. The error is INVALID_ARGUMENT with next_actions pointing at flavour: "pdfa-3b", which keeps the 1.7 header.

Since v0.27.0 a PDF/UA-2 input is the other way round: pdfa-4 / pdfa-4f are accepted (both standards are built on PDF 2.0), and pdfa-3b is refused with next_actions pointing at flavour: "pdfa-4" — PDF/A-3 requires a PDF 1.x header (veraPDF rule ISO 19005-3:2012 6.1.2-1) and PDF/UA-2 requires 2.0.

PDF/A-4 (v0.16.0)

flavour: "pdfa-4" targets ISO 19005-4 instead. It is built on PDF 2.0, so on top of the three items above it rewrites the header to 2.0 and removes the Info dictionary — PDF/A-4 does not allow one unless the catalog has /PieceInfo, which is stricter than ISO 32000-2 §14.3.3. pdfaid:rev is written and pdfaid:conformance is not, because PDF/A-4 has no conformance level.

If the document carries attachments, use "pdfa-4f". Plain PDF/A-4 requires every embedded file to be PDF/A itself, so attaching a CSV or JSON — the electronic-bookkeeping case — makes it non-conformant. "pdfa-4f" is the variant for exactly that.

Measured with veraPDF 1.30.0: pdfa-4 109/109 COMPLIANT, and the same document with a CSV attached is 108/109 as pdfa-4 but 109/109 as pdfa-4f.

preserveSignatures is refused with a PDF/A-4 flavour unless the input is already PDF 2.0: an incremental update cannot rewrite byte 0 of the file, and doing so anyway would break the signature it was meant to preserve.

Related MCP server: MCP MD2PDF Server

Install

{
  "mcpServers": {
    "pdf-writer": {
      "command": "npx",
      "args": ["-y", "@shuji-bonji/pdf-writer-mcp@latest"],
      "env": {
        "PDF_WRITER_FONT": "/absolute/path/to/NotoSansJP-Regular.otf"
      }
    }
  }
}

PDF_WRITER_FONT lets every tool omit fontPath and still render CJK text.

TIP

Use @latest (or pin a version). npx -y <pkg> without a version keeps running whatever it cached the first time — -y only skips the install prompt, it does not check for updates. A bare specifier will happily run a months-old release. @latest makes npx check the registry on each start; pin @0.5.0 instead if you want reproducibility. To clear a stale cache: rm -rf ~/.npm/_npx.

Fonts

The standard PDF font (Helvetica) covers the 218 characters of WinAnsiEncoding (ISO 32000-1 Annex D.2): ASCII, Latin-1 letters and signs, and curly quotes, dashes, €, …, ™ and a few more. Text with any other character from U+0100 up (Japanese, ł, ✔, …) is refused with FONT_REQUIRED, and the error names the characters. To render such text, point fontPath or PDF_WRITER_FONT at an embeddable single-face font (.ttf / .otf).

  • Recommended source: Noto Sans JP (SubsetOTF/JP) — static, single-face, SIL OFL.

  • .ttc (TrueType Collection) is not supported — the file is detected and rejected. Extract a single face first:

    python3 -c "from fontTools.ttLib import TTCollection; \
      TTCollection('NotoSansCJK-Regular.ttc').fonts[0].save('NotoSansCJKjp-Regular.otf')"

Missing glyphs

Characters absent from the font (e.g. ✔ U+2714, which Noto Sans JP does not include) would otherwise be embedded as .notdef and render as silent blanks. onMissingGlyph controls this:

Value

Behaviour

error (default)

Fail, listing the offending characters as "✔" (U+2714)

replace

Substitute 〓 (or ? when the font lacks 〓, which is always the case for the standard font) and report via warnings

ignore

Render as blanks and report via warnings (the characters are not dropped silently)

Result

{
  "path": "/abs/out.pdf",     // when outputPath is given
  "base64": "JVBERi0xLj...",  // when returnBase64, or outputPath is omitted
  "pageCount": 3,
  "bytes": 91788,
  "font": "NotoSansJP-Regular.otf",
  "warnings": ["Replaced 1 unsupported character(s) with \"〓\": \"✔\" (U+2714)"]
}

Editing tools return the same shape without font; split_pdf returns { files: [...], count }.

Errors (v0.7.0)

Errors are structured, following the same contract as pdf-reader-mcp: a stable code for programs, plus next_actions an LLM agent can act on. Writer-specific guards are all expressed as retryable with an explicit flag:

{
  "error": "\"/in/signed.pdf\" appears to be digitally signed (/ByteRange found). …",
  "code": "SIGNED_PDF",
  "retryable": true,
  "next_actions": [
    {
      "action": "retry_with_allowBreakingSignatures",
      "reason": "Only if invalidating the signature is acceptable…",
      "example": { "allowBreakingSignatures": true }
    }
  ]
}

Codes: INVALID_ARGUMENT, DOC_NOT_FOUND, FONT_NOT_FOUND, INVALID_PDF, ENCRYPTED_PDF, UNSUPPORTED_PDF_FEATURE (XFA), FILE_TOO_LARGE, INTERNAL_ERROR, and the writer guards SIGNED_PDF (allowBreakingSignatures), TAGGED_PDF (allowBreakingTags), FONT_REQUIRED (fontPath), MISSING_GLYPH (onMissingGlyph).

Since v0.23.3 every error carries retryable, fixed per code (PDF family contract, pdf-agent-stack docs/specs/06 §2.3): true for INVALID_ARGUMENT, FONT_REQUIRED, FONT_NOT_FOUND, MISSING_GLYPH, SIGNED_PDF and TAGGED_PDF — changing an argument or a flag can make the same edit succeed — and false for the rest. error, hint and next_actions[].reason are English; the values of next_actions[].action and example do not change.

Deterministic output (v0.7.0)

Set the SOURCE_DATE_EPOCH environment variable (UNIX seconds, per the reproducible-builds.org convention) to pin CreationDate, ModificationDate and XMP timestamps. The same input then yields byte-identical output — useful for diffing, caching, and reproducible tests. Invalid values raise an error rather than being ignored.

Text extraction

Generated PDFs are selectable, copyable, searchable, and screen-reader accessible: a ToUnicode CMap (§9.10.3) is written even for embedded subset fonts. This is covered by regression tests (extract.test.ts, render.test.ts).

NOTE

Output from v0.13.x and earlier could make poppler-based viewers printMismatch between font type and embedded font file. That was a symptom of a real conformance defect (W-2: CFF fonts embedded via FontFile2), fixed in v0.14.0 — current output produces no such warning.

Development

npm install
npm run build      # emits dist/
npm test           # vitest
npm run typecheck  # tsc --noEmit

Font-dependent tests activate when TEST_FONT_PATH points at a CJK font:

TEST_FONT_PATH=/path/to/NotoSansJP-Regular.otf npm test

Known limitations

  • Inline styling: bold/italic affect size and glyph text only, not typeface — a single font is embedded per document.

  • .ttc fonts require extracting a single face (see above).

  • By default, title and the first body heading both become H1 (B-19). This satisfies PDF/UA 7.4.2 (start at H1, skip no levels) and passes veraPDF, but the heading is duplicated when the body repeats the title. Pass drawTitle: false to keep the title in the metadata only.

  • List /Lbl is not emitted (B-18). Bullets and numbers are baked into the body text. ISO 32000-2 §14.8.4.8.2 makes Lbl a NOTE (often include), not a requirement, so this conforms — but regenerating from a read-back duplicates the markers.

Resolved:

  • The subset name prefix (ABCDEF+) is applied as of v0.14.0 (W-3). The earlier limitation stating otherwise no longer holds.

  • Underscores in snake_case being dropped (B-17) was fixed on 2026-07-21 (ships in the next release). _ emphasis now requires a non-intraword position and code spans are protected first, so non-ASCII identifiers such as 日本語_変数名 survive too.

Roadmap

  • Editing Tier A wave 1 — metadata and page operations (v0.2.0)

  • Editing Tier A wave 2 — bookmarks and annotations (v0.4.0)

  • Tagged PDF / PDF/UA-1 — verified by veraPDF (v0.5.0)

  • Annotations nested in Annot tags on tagged output (v0.5.1)

  • Editing Tier B — file attachments, form filling/flattening, watermarks, page-number stamping (v0.6.0)

  • Code hygiene / family alignment — McpServer + Zod, structured errors, absolute-path enforcement, stdout guard, tool annotations, deterministic output (v0.7.0)

  • tag_form_fields — PDF/UA repair for forms in tagged PDFs, verified COMPLIANT by veraPDF (v0.8.0)

  • Tier C first milestone — signature-preserving incremental updates for add_annotation, verified by pdf-verify-mcp against a real CMS signature (v0.9.0)

  • Incremental updates extended to set_metadata / add_bookmarks, full trailer carry-over (§7.5.6), XMP kept in sync with Info (v0.10.0)

  • Incremental updates on tagged PDFs — generalised dirty tracking over the structure tree; tag_form_fields gains preserveSignatures (v0.11.0)

  • Incremental updates across every editing tool, and ensure_tagged — PDF/UA scaffold & repair (v0.12.0)

  • Page operations report and carry over document-level information; three shall violations found by re-auditing against ISO 32000-2 (v0.13.0)

  • Carrying the structure tree through page operations (which also unlocks MarkInfo, conformance-declaring XMP, /AcroForm and merging attachments across inputs)

  • Tier C remainder — edit_text (body text editing/reflow)

  • Publish-pipeline skill (write → read back with pdf-reader → gate with pdf-verify)

  • Images with alt text (Figure + /Alt)

  • Automatic face extraction from .ttc

  • Separate faces for headings and body (bold face embedding)

  • Image embedding, headers/footers

  • Tier C — signature-preserving incremental updates, body text editing, tag tree maintenance

  • PDF/A conversion

License

MIT © shuji-bonji

Available Tools

20 tools
add_annotationAdd AnnotationA

Add one annotation to a page: sticky note (text), highlight, or rectangle (square). Coordinates are in PDF space (origin bottom-left, pt). For signed PDFs, preserveSignatures: true appends an incremental update without invalidating existing signatures (in tagged documents the enclosure in an Annot structure element rides the same update, preserving PDF/UA conformance).

Inputs: page (required), rect (required), type (required), inputPath (required), +11 more.

add_bookmarksAdd Bookmarks (Outline)A
Idempotent

Set the bookmarks (outline) of a PDF. Existing bookmarks are replaced. Nest with children. For signed PDFs, preserveSignatures: true sets them while keeping the signatures intact.

Inputs: bookmarks (required), inputPath (required), outputPath, returnBase64, +2 more.

add_watermarkAdd WatermarkA
Idempotent

Overlay a diagonal watermark across the middle of each page ("社外秘" / "DRAFT" / "COPY", etc.). Drawn faintly behind the content by default. In tagged PDFs it is wrapped as an Artifact, preserving PDF/UA conformance. CJK watermarks need fontPath or the PDF_WRITER_FONT environment variable.

Inputs: text (required), inputPath (required), angle, color, +9 more.

attach_fileAttach File (Embedded File)A
Idempotent

Embed (attach) a file into a PDF. Registers it under /Names /EmbeddedFiles and the catalog /AF, with an AFRelationship. For PDF/A-3 (ISO 19005-3) and Japanese e-bookkeeping-law (電子帳簿保存法) workflows that bundle "a human-readable invoice PDF + machine-readable data (CSV/XML)" into one file.

Inputs: inputPath (required), attachmentPath (required), name, mimeType, +6 more.

create_markdown_pdfCreate PDF from MarkdownA
Idempotent

Create a PDF from Markdown. Supports headings, paragraphs, bullet/numbered lists, code blocks, quotes, horizontal rules and tables. Inline decoration markers are stripped and the text rendered plain (single font).

Inputs: markdown (required), lang, title, author, +9 more.

create_table_pdfCreate Table PDFA
Idempotent

Create a ruled table PDF from headers and row data. Column widths are computed from the content, cells wrap, and the header row is redrawn after page breaks.

Inputs: rows (required), headers (required), lang, title, +10 more.

create_text_pdfCreate PDF from Plain TextA
Idempotent

Create a PDF from plain text. Honours line breaks (\n) and treats blank lines as paragraph breaks. Long lines wrap automatically.

Inputs: text (required), lang, title, author, +9 more.

delete_pagesDelete PagesA
DestructiveIdempotent

Create a new PDF with the given pages removed. Deleting every page is an error. Pages are copied into a new document, so document-level information (tagged structure, XMP, attachments, AcroForm, bookmarks, etc.) is not carried over. Anything lost is reported in warnings; follow up on the output with attach_file / ensure_tagged / add_bookmarks / set_metadata as needed.

Inputs: pages (required), inputPath (required), outputPath, returnBase64, +1 more.

ensure_pdfaEnsure PDF/A (archival conformance scaffold)A
Idempotent

Put an existing PDF onto the PDF/A "vessel" (the PDF/A counterpart of ensure_tagged). Choose the flavour: "pdfa-3b" (default) / "pdfa-4" / "pdfa-4f". Supplies only the missing document-level requirements: the trailer /ID (ISO 32000-1 14.4), an sRGB OutputIntent (GTS_PDFA1; an ICC profile is generated and embedded), and XMP pdfaid. The -4 flavours additionally set the header to PDF 2.0 and delete the Info dictionary (-4 forbids Info unless the catalog has /PieceInfo — stricter than ISO 32000-2 14.3.3). Content, structure tree and fonts are never touched. Documents with attachments must use "pdfa-4f" — plain "pdfa-4" requires every attachment to be PDF/A itself, so bundling CSV or JSON (the Japanese e-bookkeeping-law pattern) would not conform. IMPORTANT: this is preparation for claiming PDF/A, not a guarantee of conformance. Violations such as unembedded fonts, encryption, JavaScript or LZW are not repaired. Writing pdfaid into XMP is the document claiming "I am PDF/A" — applied to a non-conforming document it produces a PDF that lies about itself (which is why a warning is always returned). Always confirm with pdf-verify-mcp's validate_conformance (flavour: the same value) — the verdict is veraPDF's, and since ISO 19005 clauses cannot be quoted, the strongest statement is "veraPDF judged it so". In the e-bookkeeping-law context, apply it after attaching machine-readable data with attach_file. For signed PDFs, preserveSignatures: true (approval signatures only; certification signatures are refused). However, the -4 flavours combined with preserveSignatures are refused unless the input is already PDF 2.0 (an incremental update cannot rewrite the file header, and rewriting it would break the signatures).

Inputs: inputPath (required), flavour, outputPath, returnBase64, +2 more.

ensure_taggedEnsure Tagged (PDF/UA scaffold & repair)A
Idempotent

Put an existing PDF onto the PDF/UA-1 "vessel". If it is already tagged, the structure tree is untouched and only missing document-level requirements are supplied (MarkInfo / Lang / DisplayDocTitle / XMP pdfuaid:part and dc:title). For untagged documents, a minimal structure tree (each page = one P element) is created so the content becomes reachable by assistive technology. IMPORTANT: machines cannot infer meaning — headings, tables, lists, reading order and figure alt text are NOT created. The new tree is a scaffold, not an accessible document; it needs human review. If you can build the structure right from the start, use the create tools' tagged: true. For signed PDFs, preserveSignatures: true (approval signatures only; certification signatures are refused).

Inputs: inputPath (required), lang, title, outputPath, +3 more.

extract_pagesExtract PagesA
Idempotent

Create a new PDF containing only the given pages. The given order is preserved, so extraction doubles as reordering. Pages are copied into a new document, so document-level information (tagged structure, XMP, attachments, AcroForm, bookmarks, etc.) is not carried over. Anything lost is reported in warnings; follow up on the output with attach_file / ensure_tagged / add_bookmarks / set_metadata as needed.

Inputs: pages (required), inputPath (required), outputPath, returnBase64, +1 more.

fill_formFill Form (AcroForm)A
Idempotent

Fill field values into an existing PDF's interactive form (AcroForm). If you do not know the field names, pass a nonexistent one — the error lists every field name and type. CJK values need fontPath or the PDF_WRITER_FONT environment variable. flatten: true makes the form non-interactive after filling, but on a tagged PDF that breaks PDF/UA conformance and additionally requires allowBreakingTags: true. XFA forms are not supported.

Inputs: fields (required), inputPath (required), flatten, fontPath, +4 more.

flatten_formFlatten FormA
DestructiveIdempotent

Flatten an existing PDF's interactive form (AcroForm), keeping the filled appearance while removing interactivity. Use it to freeze values before distribution. If existing values contain CJK text, set fontPath or PDF_WRITER_FONT in case appearances must be regenerated. On tagged PDFs, Widget annotations disappear and Form structure elements are left dangling, so it refuses by default (allowBreakingTags: true to force).

Inputs: inputPath (required), fontPath, outputPath, returnBase64, +2 more.

merge_pdfsMerge PDFsA
Idempotent

Merge multiple PDFs into one, in the given order. Document metadata is carried over from the first file. Pages are copied into a new document, so document-level information (tagged structure, XMP, attachments, AcroForm, bookmarks, etc.) is not carried over. Anything lost is reported in warnings; follow up on the output with attach_file / ensure_tagged / add_bookmarks / set_metadata as needed.

Inputs: inputPaths (required), outputPath, returnBase64, allowBreakingSignatures.

reorder_pagesReorder PagesA
Idempotent

Reorder pages. order must list every page exactly once, in the new order. Pages are copied into a new document, so document-level information (tagged structure, XMP, attachments, AcroForm, bookmarks, etc.) is not carried over. Anything lost is reported in warnings; follow up on the output with attach_file / ensure_tagged / add_bookmarks / set_metadata as needed.

Inputs: order (required), inputPath (required), outputPath, returnBase64, +1 more.

rotate_pagesRotate PagesB
Idempotent

Rotate pages clockwise (90/180/270 degrees). All pages when pages is omitted.

Inputs: rotation (required), inputPath (required), pages, outputPath, +2 more.

set_metadataSet PDF MetadataA
Idempotent

Update an existing PDF's metadata (the Info dictionary). Only the given fields change; the rest are preserved. At least one of title / author / subject / keywords / creator is required. In documents with XMP (/Metadata), dc:title etc. are synchronized to prevent divergence. For signed PDFs, preserveSignatures: true updates while keeping the signatures intact.

Inputs: inputPath (required), title, author, creator, +6 more.

split_pdfSplit PDFA
Idempotent

Split a PDF into multiple files by page range. Each element of ranges becomes one file, named "1.pdf", "2.pdf", and so on. Pages are copied into a new document, so document-level information (tagged structure, XMP, attachments, AcroForm, bookmarks, etc.) is not carried over. Anything lost is reported in warnings; follow up on the output with attach_file / ensure_tagged / add_bookmarks / set_metadata as needed.

Inputs: ranges (required), inputPath (required), outputDir (required), prefix, +1 more.

stamp_page_numbersStamp Page NumbersA
Idempotent

Stamp a page number on each page. In tagged PDFs the stamp is wrapped as an Artifact, preserving PDF/UA conformance. Formats containing CJK text need fontPath or the PDF_WRITER_FONT environment variable.

Inputs: inputPath (required), color, pages, format, +9 more.

tag_form_fieldsTag Form Fields (PDF/UA repair)A
Idempotent

Repair a tagged PDF's form to PDF/UA-1: enclose Widget annotations in Form structure elements (7.18.4-1), set /Tabs S on the affected pages (7.18.3-1), and give fields alternate names /TU (7.18.1-3). Pass human-readable names for screen readers via labels. Widgets already bound to the structure tree are skipped, so it is safe to run repeatedly. Untagged documents are out of scope (rebuild with the create tools' tagged: true, or run ensure_tagged first). For signed PDFs, preserveSignatures: true repairs while keeping the signatures intact (approval signatures only; certification signatures are refused).

Inputs: inputPath (required), labels, outputPath, returnBase64, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 20 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: creation tools differ by input format, page manipulation tools (split, extract, delete, reorder) are well-separated, and annotation tools (bookmarks, annotations, watermark, page numbers) are unambiguous. Even tightly related operations like fill_form vs flatten_form are clearly delineated.

    Naming Consistency5/5

    All 20 tool names follow a consistent verb_noun snake_case pattern (e.g., create_text_pdf, rotate_pages, set_metadata, ensure_pdfa). No camelCase or unpredictable verb forms appear, making the API highly predictable.

    Tool Count4/5

    At 20 tools, this exceeds the typical 3-15 sweet spot and edges into 'borderline heavy', but each tool fills a distinct need within the broad PDF manipulation domain. The count is justified by the wide feature set (creation, page ops, forms, accessibility, archiving), so it earns its place despite being slightly over the ideal range.

    Completeness4/5

    The tool surface covers creation, page manipulation, metadata, bookmarks, annotations, forms, tagging, PDF/A, and attachments, which is comprehensive for a PDF writer. Minor gaps exist (e.g., image insertion, digital signing, or text extraction), but these are generally outside the stated purpose and do not cause dead ends in typical workflows.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables PDF generation from HTML, text, and Markdown content with customizable formatting options. Provides secure cross-platform PDF creation tools that automatically save to user directories like Downloads, Documents, or Desktop.
      4
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides tools for converting Markdown content and files into professional PDF documents with full support for Mermaid diagrams and LaTeX rendering. It allows for high-quality output customization, including paper size, table of contents, and syntax highlighting styles.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables PDF file manipulation including merging, splitting, extracting pages, extracting text, excluding pages, and reordering pages.
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables PDF processing and analysis including text extraction, metadata retrieval, search, page manipulation, splitting/merging, conversion to images, and form handling.
      10
      MIT