
Pdf Toolkit Mcp
io.github.AryanBV由 GitHub 帳號 AryanBV 發布v0.3.1更新於 Oct 24, 2026
Write-capable PDF toolkit MCP: 22 tools to read, create, render, encrypt, merge & fill PDFs.
概覽
在本機執行的 PDF 工具 MCP 伺服器,提供 22 個工具,讓助理讀取、建立、算繪、合併、填寫與加密 PDF 檔案。
- 可以做什麼
- 讀取與檢查 PDF:擷取文字、中繼資料、表單欄位,搜尋、比較兩個檔案、轉換為 Markdown,並將頁面算繪成圖片供視覺模型讀取掃描檔。建立 PDF:從純文字、Markdown 或內建的發票、報告、信函範本產生,並填寫表單欄位。調整文件:合併、拆分、刪除、重排與旋轉頁面並保留表單欄位,扁平化表單,加入頁碼、浮水印、圖片、QR 碼或條碼。以 AES-256 的使用者密碼與擁有者密碼加密檔案。內建引導提示可編排建立發票、填寫表單、讀取掃描檔等多步驟流程。
- 適用情境
- 適合助理需要在本機處理 PDF 的情境:摘要報告、讀取掃描合約、產生發票或報告、填寫表單,或準備合併與加密的文件。也適合希望離線使用、不依賴雲端 PDF 服務的桌面環境。
- 執行需求
- 透過 npx 以 stdio 在本機執行 npm 套件。需要 Node.js 20 或更新版本(建議 22 或 24 LTS)。不需 API 金鑰、設定檔、Docker 或編譯器,可離線使用。僅限桌面用戶端;VS Code 需要啟用 Agent 模式的 GitHub Copilot 擴充功能。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Pdf Toolkit Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
PDF Toolkit MCP
💼 Available for freelance MCP/AI integration work — DM @aryansalian03 or via aryanbv.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 single npx command.
[npm version] [license] [node] [tools] [tests]
It needs no config files, API keys, Docker, or compiler, and it works offline.
Overview
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.
A few things worth knowing:
- 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, so
npxworks 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.
Client setup
Claude Desktop
Add to claude_desktop_config.json:
Claude Code
Cursor
Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):
VS Code (GitHub Copilot)
VS Code uses "servers", not "mcpServers". Copying another client's config will fail silently. This also requires the GitHub Copilot extension with Agent mode.
Add to .vscode/mcp.json:
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
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.
Tools
Create PDFs from Markdown
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."
pdf_create_from_markdown arguments:
Tables size their columns to content and honor alignment, nested lists indent, and long code lines wrap. Add page numbers afterward with pdf_add_page_numbers.
Templates
Generate documents from structured data using the invoice, report, and letter templates.
"Create an invoice for Riverbend Outfitters."
pdf_create_from_template arguments:
The invoice template's optional currency accepts an ISO code or a symbol. WinAnsi-safe symbols ($ € £ ¥) render as glyphs; a code that Helvetica cannot draw, such as INR, KRW, or TRY, falls back to its ISO code label (INR 20.00), so any currency works without error. The pdf-toolkit://templates resource 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_pages rasterizes pages so a vision-capable client can read them.
"Read this scanned contract."
Inline mode returns pages as images the model reads directly (up to 5 pages; DPI is auto-capped to protect the context window):
Or write image files to disk (default 150 DPI, first 50 pages, PNG):
Convert a PDF to Markdown
"Convert report.pdf to Markdown so I can summarize it."
pdf_to_markdown reconstructs 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; use pdf_render_pages for scans. Returns the first 10 pages by default.
Search and compare
"Find every mention of 'indemnification' in contract.pdf."
pdf_search arguments:
Each match comes back with its page number and a surrounding snippet. Matching is a literal, case-insensitive substring by default; set caseSensitive: true for 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?"
pdf_compare arguments:
It reports a page-by-page text diff (added and removed) and sets identical: true when 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 }, where renamed is a list of { from, to } pairs (address a renamed field by its to name afterward). These tools and pdf_flatten also return a flattened boolean.
"Merge these three forms and flatten the result."
pdf_merge arguments:
"Remove pages 2 and 5 from report.pdf."
pdf_delete_pages arguments:
Use pdf_flatten on its own to bake an existing form's values into static content. The output path must differ from the input.
Encryption
"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.
pdf_encrypt arguments:
QR codes and barcodes
"Add a QR code linking to our website on page 1."
pdf_embed_qr_code supports 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.
Guided prompts
The server ships five MCP prompts that script multi-step workflows for the client:
Resources
pdf-toolkit://templates is a JSON resource that lists the templates available to pdf_create_from_template and the fields each one accepts.
Try it in plain language
- "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"
Errors and output semantics
- Coded errors. Validation and load failures throw a
PdfErrorwith 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 at
outputPathand 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.
Known limitations
- Merge, split, reorder, delete. Form fields are preserved, and colliding names are namespaced and reported in
renamedas{ 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. Use
pdf_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.
Tech stack
A multi-engine design. Every engine is pure WASM or JavaScript:
Requirements
- Node.js 20 or later. Node 18 and the 20.x line are end-of-life, so Node 22 or 24 LTS is recommended.
Development
See CLAUDE.md for architecture and contribution notes.
License
來源:README.md,提交 2d4840b
工具
0版本歷史
1- v0.3.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分