Purpose
pdf-toolkit-mcp is a writable PDF toolkit for any MCP client. It provides 22 tools covering PDF reading, creation, rendering, conversion, and secure handling. Unlike most read-only MCP PDF servers, it can also write: create documents from Markdown or structured data, fill and flatten forms, adjust page structure, and apply AES-256 encryption, all without a native build toolchain.
Main capabilities
- Create PDFs from Markdown: Convert Markdown to a multi-page PDF in a single call, supporting CommonMark and GFM, including headings, bold and italic, tables, ordered and unordered lists, fenced code, and blockquotes, rendered with @react-pdf/renderer. Table column widths adapt to content and follow alignment, nested lists are indented, and long code lines wrap automatically.
- Generate documents from structured data: Generate documents using the invoice, report, and letter templates. The invoice template's optional currency accepts ISO codes or symbols; WinAnsi-safe symbols ($ € £ ¥) render as glyphs, and codes Helvetica cannot draw (such as INR, KRW, TRY) fall back to ISO code labels.
- Read scanned and image-only PDFs (vision): pdf_render_pages rasterizes pages into images for clients with vision capabilities to read. Inline mode returns images (up to 5 pages, with DPI automatically limited to protect the context window); image files can also be written to disk (default 150 DPI, first 50 pages, PNG).
- PDF to Markdown: pdf_to_markdown reconstructs reading order based on text position, clusters up to two content columns (plus full-width header and footer bands), infers headings based on font size, and detects lists. By default it returns the first 10 pages.
- Search and compare: pdf_search returns matches with their page numbers and context snippets, defaulting to literal, case-insensitive substring matching, and can be set with caseSensitive: true. pdf_compare reports page-by-page text differences (added and removed), and sets identical: true when the text matches.
- Form-preserving merge,split, delete, and flatten: Preserve AcroForm fields when merging, splitting, reordering, and deleting pages. Names that conflict across inputs are namespaced by source, and each tool returns { preserved, renamed, dropped }, where renamed is a list of { from, to } pairs. These tools and pdf_flatten also return a flattened boolean.
- Encryption: Use AES-256 via qpdf instead of legacy RC4. User (open) and owner (edit) passwords can be set separately; when the owner password is omitted, the user password is used by default.
- QR codes and barcodes: pdf_embed_qr_code supports QR Code, Code128, DataMatrix, EAN-13, PDF417, and Aztec. Position and size are configurable, the symbol aspect ratio is preserved, placement accounts for rotation, and off-page placement is rejected rather than cropped.
How to use
This tool requires no configuration file, API key, Docker, or compiler, and can run offline. Run it locally via the npx command; it requires Node.js 20 or higher (Node 22 or 24 LTS recommended). It can be added to claude_desktop_config.json, .cursor/mcp.json (project) or ~/.cursor/mcp.json (global), VS Code's .vscode/mcp.json (note that VS Code uses "servers" rather than "mcpServers", and requires the GitHub Copilot extension's Agent mode), and ~/.codeium/windsurf/mcp_config.json. Once connected, state your needs in natural language, and the client will select tools and fill in parameters.
The server includes five MCP prompts for authoring multi-step workflows for clients. pdf-toolkit://templates is a JSON resource that lists the templates available to pdf_create_from_template and the fields each template accepts.
Use cases
- Create a PDF from a Markdown report
- Generate an invoice for Riverbend Outfitters (for example, 10 hours of consulting at $150 per hour)
- Convert Merge january.pdf and february.pdf into q1-combined.pdf
- Convert PDF to Markdown for summarization
- Render scanned PDF for reading
- Search for 'termination' in contract.pdf
- Compare draft-v1.pdf and draft-v2.pdf
- Fill in 'John Doe' in the Name field of application.pdf
- Add a CONFIDENTIAL watermark to draft.pdf
- Encrypt financials.pdf with the AES-256 password 'budget2026'
- Embed a QR code pointing to a website URL on the cover page
- Reorder the pages of report.pdf to 3,1,2
Limitations
- Merge, split, reorder, delete: Preserve form fields; conflicting names are namespaced and reported under renamed. Abnormal forms that cannot be safely rebuilt are reported under dropped rather than causing the operation to fail.
- Text extraction: Returns PDF stream order, not visual reading order. When reading order is needed, use pdf_to_markdown; the raw pdf_extract_text may interleave multi-column layouts.
- PDF to Markdown: Reconstructs up to two content columns (plus full-width header and footer bands); pages with three or more columns fall back to single-column reading order. Best suited for clean digital PDFs. Table content is output as positioned text in reading order and is not reconstructed into Markdown tables.
- Markdown to PDF: Supports CommonMark and GFM (headings, bold italic, links, lists, tables, fenced code, block quotes, and horizontal rules). Does not support raw HTML, task list checkbox states, footnotes, or code syntax highlighting.
- Compare: Text differences only; visual or layout changes that do not alter text will not be detected.
- Image embedding: JPEG and PNG only. Off-page placement is rejected with an encoding error rather than silently cropped.
- Fonts: Built-in fonts are Latin only (WinAnsi). For non-Latin scripts such as Arabic, CJK, or Devanagari, pass a .ttf or .otf file to pdf_fill_form or pdf_create via fontPath. Markdown and template PDFs use Helvetica by default.
- Error and output semantics: Validation and loading failures throw a PdfError with a stable code, displayed as Error [CODE]: message (such as FILE_NOT_FOUND, NOT_A_PDF, PAGE_OUT_OF_RANGE, ENCRYPTED_PDF, RESOURCE_LIMIT). Write tools create a file at outputPath and return the path and size; outputPath can overwrite an existing file. Responses are capped at 25,000 characters, and object payloads return a valid { truncated, note, preview } envelope to avoid breaking JSON.parse.
- Engine design: Each engine is pure WASM or JavaScript, so npx can run on Windows, macOS, and Linux with Node 20 and above, without node-gyp, canvas bindings, or prebuilt binaries.