localpdf-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
localpdf-mcp
Local, offline PDF engine for AI agents, exposed as an MCP server.
The agent decides, the document stays put: every tool runs in this process on your machine, makes no network requests at all, and returns metadata — paths, sizes, sha256, counts — instead of document bytes or document text.
Status: 0.1.4, published on npm as localpdf-mcp. Requires Node 22+. No hosted service and no phone-home:
nothing in this package calls localpdf.online or any other server.
Why this exists and where it stops: see get-started.md. The browser workspace that shares
the same approach is at https://localpdf.online/app.
Tools
Tool | What it does | Returns |
| page count, size, encryption flag, producer | metadata only |
| concatenate 2+ PDFs in order | out path, pages, sha256 |
| each requested page into its own file | file list with per-file sha256 |
| structural resave with object streams | before/after bytes + honest % |
| text layer → .txt on disk | per-page char counts; text only with |
| find a string, draw white patch + replacement | matches, bbox, page; |
| invisible text layer for scans (tesseract, local traineddata) | per-page lines/chars/confidence |
Page numbers are 1-based. The input file is never overwritten — out must differ.
Related MCP server: pdf-agent-toolkit-mcp
Install
Zero-install (npx fetches the package and its deps once):
npx -y localpdf-mcp # speaks MCP on stdio; nothing on stdout except protocolFrom a checkout, if you want to hack on it:
git clone https://github.com/ulinycoin/localpdf-mcp && cd localpdf-mcp
npm install
node src/server.mjsOCR is an optional extra: npm i tesseract.js @tesseract.js-data/eng @napi-rs/canvas
(plus @tesseract.js-data/rus for Russian). Without them the other six tools work and
pdf_ocr returns a clear "dependencies not installed" error.
Claude Code
claude mcp add localpdf -- npx -y localpdf-mcpClaude Desktop / Cursor / other JSON-config clients
{
"mcpServers": {
"localpdf": {
"command": "npx",
"args": ["-y", "localpdf-mcp"]
}
}
}Verify
node test/mcp-client.mjs # real MCP handshake: initialize, tools/list, tools/call
node test/smoke.mjs # 12 checks on real generated PDFsWhat "offline" is proven by, not promised
Two independent gates, both run in CI-able form:
# 1. every socket/DNS/fetch attempt throws (also inherited by the tesseract child process)
NODE_OPTIONS="--import ./test/deny-net.mjs" node test/smoke.mjs
# 2. the OS denies the network for the whole process tree
sandbox-exec -p '(version 1)(allow default)(deny network*)' node test/smoke.mjsBoth pass with OCR enabled. The things that would otherwise phone home are pinned locally:
pdfjs standard fonts →
node_modules/pdfjs-dist/standard_fonts/(standardFontDataUrl)tesseract traineddata → staged from
node_modules/@tesseract.js-data/*into~/.localpdf-mcp/tmp/tessdata(by default tesseract.js fetches from jsDelivr — seetesseract.js/src/worker-script/index.js)no analytics, no version check, no "usage reporting" of any kind
Privacy boundary — read this before quoting anything
This server keeps the engine and the files local. It cannot keep your agent local:
What the model reads is gone. If your agent opens the PDF and reasons about its contents, that text goes to the model provider's context and logs. Nothing in this package changes that.
Tool results are metadata on purpose. Returning document bytes in a tool result would ship the whole file into the model context — the classic MCP data leak. Tools return paths;
pdf_extract_textreturns text only with an explicitinline: true, and says so in the result.Local is not the same as unsynced. Scratch files live in
~/.localpdf-mcp/tmp(mode 0700) and are pruned after an hour, precisely because~/Desktopand~/Documentsmay be synced to iCloud Drive — a document leak with no HTTP request involved. PointLOCALPDF_MCP_WORKDIRsomewhere unsynced if you disagree.
So the honest claim is: the engine and the files stay on your machine; whatever your agent reads itself goes to its provider. "No leak at all" is only true when the model is local too (Ollama, LM Studio), not when it is a cloud agent.
Known limitations
pdf_replace_textis an overlay, not a content-stream edit: a white patch and new drawn text on top. The original text layer survives, so search and copy-paste return the old string as well as the new one. Fine for cosmetic fixes; not for redaction.Fonts are substituted with Helvetica → correct for Latin-1, wrong for Cyrillic/CJK.
pdf_compressdoes no image recompression. Text-only PDFs may not shrink at all, and already-optimised files can grow — the tool reports the real numbers instead of guessing.OCR languages installed offline:
eng,rus. Add more withnpm i @tesseract.js-data/<lang>and one line insrc/engine.mjs.Encrypted PDFs are reported by
pdf_inspectbut not decrypted.
Layout
src/server.mjs MCP surface (zod schemas, 7 tools)
src/engine.mjs tool implementations, pdf-lib + pdfjs + tesseract, zero network
src/workdir.mjs scratch dir (~/.localpdf-mcp/tmp), input/out collision guard
test/ smoke, MCP client, network-deny preload
get-started.md the playbook you hand to an agent (Vercel-style onboarding)Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
PDF and image tools for AI agents: compress, merge, split, OCR, sign. Runs locally, never uploads.
PDF tools for AI agents: validate, extract, merge, split, compress, OCR, sign and redact.
Merge, split, extract, rotate, reorder and stamp PDF pages from your AI chat, all offline.
Merge, split, extract, rotate, reorder and stamp PDF pages from your AI chat, all offline.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to perform 13 PDF operations (merge, split, compress, watermark, encrypt, and more) on local files via MCP.3-
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to perform comprehensive PDF operations locally, including compression, text extraction, PII redaction, page organization, splitting, merging, watermarking, creation, and form filling, all without cloud uploads.22 npm-
- AlicenseAqualityDmaintenanceEnables AI agents to inspect PDFs, merge or extract pages, and clean text entirely offline through the Model Context Protocol, with no uploads, API keys, or network calls.464 npmMIT
- AlicenseBqualityBmaintenanceEnables AI agents to perform local-first PDF processing entirely on-device, including OCR write-back to make scans searchable, unlocking and re-encrypting PDFs, splitting/merging/rotating pages, and compressing files, with no cloud calls or file uploads.251MIT