Pdf Toolkit Mcp

by AryanBV

390 downloads
Not rated
GitHub

About

MCP server for PDF manipulation — create PDFs from Markdown with tables and formatting, fill forms, merge, split, encrypt, add QR codes. 16 tools, zero external binaries, TypeScript-native. Install: npx -y @aryanbv/pdf-toolkit-mcp

Details

Author
AryanBV
Downloads
390
Categories
Developer Tools, Other, File Management

- Create PDFs from Markdown with tables, lists, and page numbers
- Merge, split, rotate, and reorder pages
- Fill form fields (text, checkbox, dropdown, radio)
- Add watermarks, page numbers, and embed images
- Password-protect PDFs with RC4 128‑bit encryption
- Embed QR codes and barcodes (Code128, DataMatrix, EAN‑13, PDF417, Aztec)

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Pdf Toolkit Mcp
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install via npx -y @aryanbv/pdf-toolkit-mcp and add the server to your MCP client configuration (Claude Desktop, Claude Code, Cursor, VS Code, Windsurf). No config files or setup steps are needed.

pdf_extract_text

Extract text content from a PDF file. Returns first 10 pages by default to avoid exceeding LLM context limits. Use the 'pages' parameter for specific pages.

pdf_get_metadata

Get metadata from a PDF file including title, author, subject, page count, creation/modification dates, and producer information.

pdf_get_form_fields

List all form fields in a PDF with their names, types, current values, and required status. Returns hasForm: false for PDFs without forms.

pdf_to_markdown

Convert a PDF to clean, reading-order Markdown for LLM consumption: reconstructs up to 2 content columns (plus full-width title/footer bands), infers headings from font size, and detects bullet/numbered lists. Pages with 3 or more columns fall back to single-column reading order. Tables are emitted as plain reading-order text, NOT reconstructed as Markdown tables. Best on clean, digital (text-based) PDFs; degrades on scanned/image-only PDFs (use pdf_render_pages for those) and very complex layouts. Returns the first 10 pages by default.

pdf_search

Search text across a PDF and return matches with a short surrounding snippet and the page number. The query is matched as a literal substring (case-insensitive by default). Searches all pages unless a range is given.

pdf_merge

Merge multiple PDF files into one. AcroForm fields are preserved; fields whose names collide across inputs are auto-renamed (namespaced by source). Set flatten:true to bake field values into static content.

pdf_split

Extract specific pages from a PDF into a new file. AcroForm fields on the extracted pages are preserved; fields on omitted pages are dropped. Set flatten:true to bake field values into static content.

pdf_rotate_pages

Rotate pages in a PDF by 90, 180, or 270 degrees. Rotation is additive to any existing rotation. Rotates all pages if no page range is specified.

pdf_encrypt

Encrypt a PDF with AES-256 password protection. Requires a user password to open. Owner password controls editing permissions (defaults to the user password).

pdf_compare

Compare two PDFs page by page (by absolute page index) and report text differences. Returns identical:true when text matches. Diffs content-stream-order text (not visual reading order), so it is best for same-layout documents; reflowed or multi-column PDFs produce noisy diffs. Inserting/deleting a page shifts all later pages and reports them as changed. Large diffs are trimmed (truncated:true) to fit the response limit.

pdf_add_page_numbers

Add page numbers to a PDF. Supports configurable position, format, starting number, and font size.

pdf_embed_qr_code

Embed a QR code or barcode into a specific page of a PDF at given coordinates. Supports qrcode, code128, datamatrix, ean13, pdf417, and azteccode.

pdf_reorder_pages

Reorder pages in a PDF. Specify the new page order as a comma-separated string (e.g. '3,1,2'). Duplicates are allowed. AcroForm fields are preserved. Set flatten:true to bake field values into static content.

pdf_delete_pages

Delete specific pages from a PDF, keeping the rest in their original order. AcroForm fields on the remaining pages are preserved. Set flatten:true to bake field values into static content. Cannot delete every page.

pdf_create

Create a new PDF from text content with automatic line wrapping and page overflow. Supports A4, Letter, and Legal page sizes. Provide fontPath for non-Latin text (Arabic, CJK, etc.).

pdf_fill_form

Fill form fields in a PDF. Supports text, checkbox, dropdown, radio, and list-box (multi-select) fields. Provide fontPath for non-Latin text (Arabic, CJK, etc.).

pdf_add_watermark

Add a text watermark to PDF pages. Watermark is centered and rotated diagonally by default. Applies to all pages if no page range is specified.

pdf_embed_image

Embed a PNG or JPEG image into a specific page of a PDF. Supports custom positioning and optional scaling with aspect ratio preservation.

pdf_create_from_markdown

Create a rich, high-fidelity PDF from Markdown (CommonMark + GFM). Supports headings, bold/italic, links, ordered/bullet lists, tables, fenced code blocks, blockquotes, and horizontal rules.

pdf_create_from_template

Create a polished PDF from a named template (invoice, report, or letter). Pass structured data matching the template's fields; data is validated against the template's schema.

pdf_flatten

Flatten a PDF's form fields, baking their current values into the page content and removing interactivity. Form-less PDFs are copied unchanged.

pdf_render_pages

Render PDF pages to images so a vision-capable client can read scanned or image-only PDFs. Writes PNG/JPEG files and returns their paths; set inline:true to return image blocks the model can see directly.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "pdf toolkit mcp": {
            "pdf-toolkit": {
                "command": "npx",
                "args": [
                    "-y",
                    "@aryanbv/pdf-toolkit-mcp"
                ]
            }
        }
    }
}

McpServers

{
    "pdf-toolkit": {
        "command": "npx",
        "args": [
            "-y",
            "@aryanbv/pdf-toolkit-mcp"
        ]
    }
}

Create PDFs from Markdown, fill forms, merge, split, rotate, watermark, encrypt, extract text, and add QR codes. 16 tools, TypeScript-native.

💼 Available for freelance MCP/AI integration work — DM@aryansalian03or viaaryanbv.com

A write-capable PDF toolkit for any MCP client. It provides 22 tools for reading, creating, rendering, transforming, and securing PDFs. That includes rendering pages to images so vision models can read scanned documents, building PDFs from Markdown or structured data, AES-256 encryption, and merge and split operations that keep form fields intact. There are no native dependencies, so it runs locally from a singlenpxcommand.

It needs no config files, API keys, Docker, or compiler, and it works offline.

Most PDF servers for MCP only read. This one also writes: it creates documents from Markdown or structured data, fills and flattens forms, rearranges page structure, and applies AES-256 encryption, all without a native build toolchain.

- It reads scans.pdf_render_pagesrasterizes pages to images, so a vision-capable model can read scanned or image-only PDFs that have no text layer.
- Merge, split, reorder, and delete preserve AcroForm fields rather than dropping them. Names that collide between inputs are namespaced per source, and every call reports what it preserved, renamed, or dropped.
- Encryption is AES-256 through qpdf, not the legacy RC4 scheme.
- Every engine is WASM or plain JavaScript, sonpxworks on Node 20 and later across Windows, macOS, and Linux with no node-gyp, canvas binding, or prebuilt binary.
- Errors carry stable codes, stack traces stay internal, off-page placements are rejected instead of silently clipped, and large responses are truncated without breaking JSON.

{ "mcpServers": { "pdf-toolkit": { "command": "npx", "args": ["-y", "@aryanbv/pdf-toolkit-mcp"] } } }
claude mcp add pdf-toolkit -- npx -y @aryanbv/pdf-toolkit-mcp

Add to.cursor/mcp.json(project) or~/.cursor/mcp.json(global):

{ "mcpServers": { "pdf-toolkit": { "command": "npx", "args": ["-y", "@aryanbv/pdf-toolkit-mcp"] } } }

VS Code uses"servers", not"mcpServers". Copying another client's config will fail silently. This also requires the GitHub Copilot extension with Agent mode.

{ "servers": { "pdf-toolkit": { "command": "npx", "args": ["-y", "@aryanbv/pdf-toolkit-mcp"] } } }

Add to~/.codeium/windsurf/mcp_config.json:

{ "mcpServers": { "pdf-toolkit": { "command": "npx", "args": ["-y", "@aryanbv/pdf-toolkit-mcp"] } } }

Once connected, ask for what you want in plain language and the client selects the tool and fills in the arguments. The JSON blocks below show the arguments each tool accepts, for reference.

Turn Markdown into a multi-page PDF in a single call. It supports CommonMark and GFM: headings, bold and italic, tables, ordered and bullet lists, fenced code, and blockquotes, rendered with@react-pdf/renderer.

"Create a PDF from this Markdown report."

{ "markdown": "# Quarterly Report\n\nRevenue grew 23% YoY.\n\n| Region | Q1 2025 | Q1 2026 |\n|--------|---------|--------|\n| Americas | $1.2M | $1.5M |\n| EMEA | $800K | $960K |\n\n## Key Wins\n\n1. 12 new enterprise contracts\n2. Churn down to 3.1%", "outputPath": "/path/to/report.pdf", "pageSize": "Letter" }

Tables size their columns to content and honor alignment, nested lists indent, and long code lines wrap. Add page numbers afterward withpdf_add_page_numbers.

Generate documents from structured data using theinvoice,report, andlettertemplates.

"Create an invoice for Riverbend Outfitters."

{ "templateName": "invoice", "data": { "companyName": "Northpoint Design", "clientName": "Riverbend Outfitters", "invoiceNumber": "2026-0042", "invoiceDate": "2026-04-01", "items": [ { "description": "Website redesign", "quantity": 40, "unitPrice": 150 }, { "description": "Annual hosting", "quantity": 1, "unitPrice": 299 } ], "taxRate": 18, "currency": "USD", "paymentTerms": "Net 30" }, "outputPath": "/path/to/invoice.pdf" }

Theinvoicetemplate's optionalcurrencyaccepts an ISO code or a symbol. WinAnsi-safe symbols ($ € £ ¥) render as glyphs; a code that Helvetica cannot draw, such asINR,KRW, orTRY, falls back to its ISO code label (INR 20.00), so any currency works without error. Thepdf-toolkit://templatesresource lists every template and the fields it accepts.

Read scanned and image-only PDFs (vision)

Many PDFs are scans with no text layer.pdf_render_pagesrasterizes pages so a vision-capable client can read them.

Inline mode returns pages as images the model reads directly (up to 5 pages; DPI is auto-capped to protect the context window):

{ "filePath": "/path/to/scanned.pdf", "inline": true }

Or write image files to disk (default 150 DPI, first 50 pages, PNG):

{ "filePath": "/path/to/scanned.pdf", "pages": "1-3", "dpi": 200, "format": "jpeg", "outputDir": "/path/to/output" }

"Convert report.pdf to Markdown so I can summarize it."

pdf_to_markdownreconstructs reading order from text positions. It clusters up to two content columns (plus full-width title and footer bands), infers headings from font size, and detects lists. It works best on clean digital PDFs; usepdf_render_pagesfor scans. Returns the first 10 pages by default.

{ "filePath": "/path/to/report.pdf", "pages": "1-5" }

"Find every mention of 'indemnification' in contract.pdf."

{ "filePath": "/path/to/contract.pdf", "query": "indemnification", "caseSensitive": false }

Each match comes back with its page number and a surrounding snippet. Matching is a literal, case-insensitive substring by default; setcaseSensitive: truefor exact case. Regex search is intentionally left out, because an attacker-supplied pattern can trigger catastrophic backtracking (ReDoS) that single-threaded JavaScript cannot reliably interrupt. Safe regex is planned for a later release.

"What changed between v1.pdf and v2.pdf?"

{ "filePathA": "/path/to/v1.pdf", "filePathB": "/path/to/v2.pdf" }

It reports a page-by-page text diff (addedandremoved) and setsidentical: truewhen the text matches. The diff is text only, so purely visual changes are not detected.

Form-preserving merge, split, delete, and flatten

Merging, splitting, reordering, and deleting pages preserve AcroForm fields. Names that collide across inputs are namespaced per source, and each tool returns{ preserved, renamed, dropped }, whererenamedis a list of{ from, to }pairs (address a renamed field by itstoname afterward). These tools andpdf_flattenalso return aflattenedboolean.

"Merge these three forms and flatten the result."

{ "filePaths": ["/path/a.pdf", "/path/b.pdf", "/path/c.pdf"], "outputPath": "/path/merged.pdf", "flatten": true }

"Remove pages 2 and 5 from report.pdf."

{ "filePath": "/path/report.pdf", "pages": "2,5", "outputPath": "/path/trimmed.pdf" }

Usepdf_flattenon its own to bake an existing form's values into static content. The output path must differ from the input.

"Encrypt report.pdf with the password 'secure123'."

Encryption is AES-256. Set separate user (open) and owner (edit) passwords for granular access; the owner password defaults to the user password when omitted.

{ "filePath": "/path/report.pdf", "outputPath": "/path/report-encrypted.pdf", "userPassword": "secure123", "ownerPassword": "admin456" }

"Add a QR code linking to our website on page 1."

pdf_embed_qr_codesupports QR Code, Code128, DataMatrix, EAN-13, PDF417, and Aztec. Position and size are configurable, the symbology's aspect ratio is preserved, placement is rotation-aware, and off-page placements are rejected instead of clipped.

The server ships five MCP prompts that script multi-step workflows for the client:

pdf-toolkit://templatesis a JSON resource that lists the templates available topdf_create_from_templateand the fields each one accepts.

- "Create a PDF from this Markdown report"
- "Generate an invoice for Riverbend Outfitters, 10 hours of consulting at $150/hr"
- "Merge january.pdf and february.pdf into q1-combined.pdf"
- "Convert this PDF to Markdown so I can summarize it"
- "Render this scanned PDF so you can read it"
- "Search contract.pdf for 'termination'"
- "Compare draft-v1.pdf and draft-v2.pdf"
- "Fill the Name field with 'John Doe' in application.pdf"
- "Add a CONFIDENTIAL watermark to draft.pdf"
- "Encrypt financials.pdf with the AES-256 password 'budget2026'"
- "Embed a QR code with our URL on the cover page"
- "Reorder pages as 3,1,2 in report.pdf"

- Coded errors.Validation and load failures throw aPdfErrorwith a stable code, surfaced asError [CODE]: message(for exampleFILE_NOT_FOUND,NOT_A_PDF,PAGE_OUT_OF_RANGE,ENCRYPTED_PDF,RESOURCE_LIMIT). Clients can branch on the code instead of parsing message text, and stack traces are never leaked.
- Write-tool output.Write tools create a file atoutputPathand return that path plus its size as text, since MCP has no file-content type.outputPathcan name an existing file and will overwrite it, so choose a path that does not collide with something you want to keep.
- JSON-safe truncation.Responses are capped at 25,000 characters. Object payloads return a valid{ truncated, note, preview }envelope rather than a string cut mid-token, so a client'sJSON.parsenever breaks.

- Merge, split, reorder, delete.Form fields are preserved, and colliding names are namespaced and reported inrenamedas{ from, to }pairs. Unusual forms that cannot be safely reconstructed are reported underdroppedrather than failing the operation.
- Text extraction.Returns PDF stream order, not visual reading order. Usepdf_to_markdownwhen reading order matters; rawpdf_extract_textcan interleave multi-column layouts.
- PDF to Markdown.Reconstructs up to two content columns (plus full-width title and footer bands); pages with three or more columns fall back to single-column reading order. It works best on clean digital PDFs. Tabular content is emitted as positioned text in reading order, not rebuilt as Markdown tables.
- Markdown to PDF.Supports CommonMark and GFM (headings, bold and italic, links, lists, tables, fenced code, blockquotes, and horizontal rules). Raw HTML, task-list checkbox state, footnotes, and code syntax highlighting are not supported.
- Compare.Text-only diff; visual or layout changes that do not alter text are not detected.
- Image embedding.JPEG and PNG only. Off-page placements are rejected with a coded error instead of being silently clipped.
- Fonts.Built-in fonts are Latin-only (WinAnsi). For non-Latin scripts such as Arabic, CJK, or Devanagari, pass a.ttfor.otffile throughfontPathtopdf_fill_formorpdf_create. Markdown and template PDFs use Helvetica by default.

A multi-engine design. Every engine is pure WASM or JavaScript:

- Node.js 20 or later. Node 18 and the 20.x line are end-of-life, so Node 22 or 24 LTS is recommended.

npm install # install dependencies npm run build # compile TypeScript npm test # run the vitest suite (160 tests) npm run test:cov # tests with coverage npm run lint # ESLint npm run format # Prettier npm run inspect # MCP Inspector (requires Node >= 22.7.5)

SeeCLAUDE.mdfor architecture and contribution notes.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Converts LaTeX source code into professionally formatted PDF documents.

Convert Markdown documents to PDF files with syntax highlighting, custom styling, and optional watermarking.

Parses PDF files from a URL into structured formats like JSON and Markdown.

Local-first PDF engine for AI agents. Zero-dep TypeScript, PDF/A, signatures, 800+ pages/sec.

Validate, convert & visualize YAML, and edit saved diagrams, from your AI editor.

Universal document generation and conversion MCP. Generate PDF/DOCX/XLSX from templates+JSON (invoices, contracts, reports), batch generation, 100+ format conversions.

A server for reading and converting documents between PDF, DOCX, and Markdown formats using marker-pdf and pandoc.

Convert, compress, merge and OCR PDFs and 100+ file formats from any AI agent — 126 tools via the GuruPDF API.

Convert PDF bank statements to checked Excel, CSV, or JSON with balance validation.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.