io.github.EigenCharlie/pdf-toolkit-mcp
Unofficial PDF toolkit (merge/split/compress/OCR/convert/watermark/protect/...) via iLoveAPI.
Ask AI about io.github.EigenCharlie/pdf-toolkit-mcp
Powered by Claude Β· Grounded in docs
I know everything about io.github.EigenCharlie/pdf-toolkit-mcp. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
pdf-toolkit-mcp
18 PDF operations for Claude Code, Claude Desktop, and any MCP client β via iLoveAPI.
Install Β· Tools Β· Recipes Β· Architecture Β· Security Β· FAQ
Disclaimer.
pdf-toolkit-mcpis an independent, community-built open-source client. It is not affiliated with, endorsed, sponsored, or certified by iLovePDF SL. The project talks to the public iLoveAPI REST service using your project credentials β nothing is proxied, resold, or relicensed. "iLovePDF" and "iLoveAPI" are trademarks of iLovePDF SL; this project does not claim ownership of those marks.
π Table of contents
- Why pdf-toolkit-mcp
- Quick tour
- Install
- Tool catalog
- Workflow recipes
- Architecture
- Configuration reference
- Security model
- Development
- Testing & CI
- Releasing
- Roadmap
- FAQ
- Contributing
- License & trademarks
- Credits
π― Why pdf-toolkit-mcp
| Manual iLoveAPI | Raw @ilovepdf/ilovepdf-nodejs | pdf-toolkit-mcp | |
|---|---|---|---|
| Callable from Claude Code / Claude Desktop / any MCP client | β | β | β |
| JWT signing + 5-step lifecycle handled for you | β | β | β |
| Validated Zod schemas (no bad inputs reach the API) | β | β | β |
| Path sandboxing against traversal | β | β | β |
Structured error codes (RATE_LIMITED, PLAN_LIMIT, β¦) | β | partial | β |
| Progress notifications during long OCR tasks | β | β | β |
| Bundled Claude Code skill with multi-step pipelines | β | β | β |
Zero-setup install via npx -y | β | β | β |
Free for personal use. iLoveAPI's free tier grants ~2,500 credits / month; this MCP itself is MIT-licensed and costs nothing.
π Quick tour
After installation, just talk to Claude. The model figures out which tools to call:
You: Merge invoice-jan.pdf and invoice-feb.pdf into Q1.pdf, then compress it hard
and lock it with the password "2026q1".
Claude (planning):
1. merge_pdf β invoice-jan.pdf + invoice-feb.pdf β Q1.pdf
2. compress_pdf β Q1.pdf β Q1-compressed.pdf (level: extreme)
3. protect_pdf β Q1-compressed.pdf β Q1-compressed-protected.pdf
Claude (result):
β
Created ~/docs/Q1-compressed-protected.pdf (312 KB, password-protected).
π¦ Install
Prerequisites
- Node.js β₯ 18 (LTS recommended).
- iLoveAPI project keys β free tier at developer.ilovepdf.com. Takes ~2 minutes:
- Sign up β create a project β copy
Project public keyandProject secret key. - Export them (or drop them into your client's MCP config β examples below).
- Sign up β create a project β copy
Option A β Claude Code (CLI one-liner)
export ILOVEAPI_PROJECT_PUBLIC_KEY="project_public_xxx"
export ILOVEAPI_PROJECT_SECRET_KEY="secret_key_xxx"
claude mcp add pdf-toolkit -- npx -y pdf-toolkit-mcp
Restart Claude Code and all 18 tools appear in the picker. Verify with /mcp β you should see pdf-toolkit: connected (18 tools).
Option B β Claude Code Plugin (includes the pdf-workflow skill)
/plugin marketplace add EigenCharlie/pdf-toolkit-mcp
/plugin install pdf-toolkit@EigenCharlie/pdf-toolkit-mcp
The plugin auto-configures the MCP server and installs a skill that teaches Claude five canonical multi-step PDF pipelines (see Workflow recipes).
Option C β Claude Desktop (claude_desktop_config.json)
Click to expand
Edit claude_desktop_config.json (%APPDATA%\Claude\ on Windows, ~/Library/Application Support/Claude/ on macOS):
{
"mcpServers": {
"pdf-toolkit": {
"command": "npx",
"args": ["-y", "pdf-toolkit-mcp"],
"env": {
"ILOVEAPI_PROJECT_PUBLIC_KEY": "project_public_xxx",
"ILOVEAPI_PROJECT_SECRET_KEY": "secret_key_xxx"
}
}
}
}
Restart Claude Desktop β the π icon should show pdf-toolkit connected.
Option D β any MCP client via stdio
ILOVEAPI_PROJECT_PUBLIC_KEY=β¦ ILOVEAPI_PROJECT_SECRET_KEY=β¦ npx -y pdf-toolkit-mcp
The server speaks the standard MCP JSON-RPC 2.0 framing over stdio. Wire it into Cursor, Windsurf, mcphub, mcp-inspector, or anything else that speaks MCP.
Option E β Claude Desktop .mcpb bundle (drag-and-drop)
Grab pdf-toolkit-mcp-<version>.mcpb from the latest GitHub Release and drag it into Claude Desktop β Settings β Extensions. Claude will prompt for your iLoveAPI keys via the user_config section of the bundled manifest. No npx, no Node, no terminal.
Bundles ship unsigned (no publisher certificate yet). macOS Gatekeeper / Windows SmartScreen may warn on first install; verify the SHA-256 in the release notes before accepting.
Option F β MCP Registry (auto-discovered by compatible clients)
The server is indexed on the official MCP Registry under io.github.EigenCharlie/pdf-toolkit-mcp. Clients that browse the registry (Claude Desktop extension pane, VS Code MCP picker, mcphub, etc.) can install it without any manual config β they'll point at the npm package and prompt for the two iLoveAPI env vars automatically.
π§° Tool catalog
All 18 tools are exposed with strict Zod schemas, additionalProperties: false, and return both a text summary and a file:// resource URI so the client can surface the output.
π Organize
| Tool | What it does | Key inputs |
|---|---|---|
merge_pdf | Combine β₯ 2 PDFs in order | input_files[], output_path? |
split_pdf | Split by page ranges ("1-3,5-7") or fixed chunk size | input_file, ranges?, fixed_range? |
extract_pdf_pages | Keep a specific subset of pages | input_file, pages ("1,3,5-9") |
π Convert β from PDF
| Tool | Output | Notes |
|---|---|---|
pdf_to_word | .docx | Scanned PDFs β run ocr_pdf first for best results |
pdf_to_excel | .xlsx | Works best on tabular source PDFs |
pdf_to_powerpoint | .pptx | One slide per PDF page |
pdf_to_jpg | .zip of .jpg | mode: "pages" renders pages; "extract" pulls embedded images |
π Convert β to PDF
| Tool | Accepts | Notes |
|---|---|---|
office_to_pdf | .doc, .docx, .xls, .xlsx, .ppt, .pptx | Server-side rendering |
html_to_pdf | .html, .htm | Local HTML only; external assets may not resolve |
image_to_pdf | .jpg, .jpeg, .png | One image per page, preserves order |
βοΈ Edit
| Tool | What it does | Key inputs |
|---|---|---|
rotate_pdf | Rotate pages 90 / 180 / 270Β° clockwise | rotation, pages? (default: all) |
add_page_numbers | Stamp numbered footer/header | starting_number, vertical_position, horizontal_position |
add_watermark | Text or image watermark | mode: "text" + text, OR mode: "image" + image_file |
π Security
| Tool | What it does | Key inputs |
|---|---|---|
unlock_pdf | Remove known password | input_file, password |
protect_pdf | Add password | input_file, password |
π©Ή Repair / OCR
| Tool | What it does | Notes |
|---|---|---|
repair_pdf | Attempt structural repair on damaged PDFs | Useful before further processing |
ocr_pdf | Run OCR to make scans searchable | languages[] (e.g. ["eng"], ["spa"], ["eng","spa"]). β± Can exceed 60s on image-heavy PDFs |
All tools accept absolute or CWD-relative paths for
input_file(s)and an optionaloutput_path(file or directory). Defaults place the result next to the first input with a timestamped name.
π³ Workflow recipes
The bundled pdf-workflow skill (skills/pdf-workflow/SKILL.md) teaches Claude five canonical multi-step pipelines. You can also run these manually β just describe the end state and Claude chains the tools for you.
1. Assemble β merge + compress + (optional) protect
merge_pdf([a.pdf, b.pdf, c.pdf])
β compress_pdf(level="recommended")
β protect_pdf(password="β¦")
2. Convert & secure β Office doc to locked PDF
office_to_pdf(report.docx)
β add_watermark(mode="text", text="CONFIDENTIAL", opacity=30)
β protect_pdf(password="β¦")
3. Extract & OCR β pull pages out of a scan and make them editable
extract_pdf_pages(scan.pdf, pages="3-9")
β ocr_pdf(languages=["eng"])
β pdf_to_word
4. Prep for email β shrink + lock
compress_pdf(big.pdf, level="extreme")
β protect_pdf(password="β¦")
5. Scan cleanup β repair + OCR + number
repair_pdf(scan_broken.pdf)
β ocr_pdf(languages=["eng"])
β add_page_numbers(position="bottom-center")
π Architecture
ββββββββββββββββββββββββββββββ stdio ββββββββββββββββββββββββββββ
β Claude Code / Desktop ββββββββββββββΆβ pdf-toolkit-mcp server β
β (or any MCP client) β JSON-RPC β (this repo) β
ββββββββββββββββββββββββββββββ ββββββββββββββ¬ββββββββββββββ
β
βΌ
ββββββββββββββββββββββββ
β @ilovepdf/ β
β ilovepdf-nodejs β
β (JWT + HTTP) β
ββββββββββββ¬ββββββββββββ
β
βΌ HTTPS
ββββββββββββββββββββββββ
β iLoveAPI servers β
β api.ilovepdf.com β
ββββββββββββββββββββββββ
iLoveAPI 5-phase lifecycle (orchestrated in src/api/tasks.ts)
[ 10% ] start β POST /v1/start/{tool} (server assignment + task id)
[ 40% ] upload β POST /v1/upload (one call per file, progress scales)
[ 50% ] process β POST /v1/process (run the tool with params)
[ 90% ] download β GET /v1/download/{task} (bytes β Buffer)
[100% ] done β write to disk, emit file:// resource URI
The server emits MCP notifications/progress at each boundary so your client can render a live progress bar for slow operations (OCR, large merges).
Project layout
pdf-toolkit-mcp/
βββ .claude-plugin/
β βββ plugin.json # Plugin manifest
β βββ .mcp.json # MCP server config (npx -y pdf-toolkit-mcp)
βββ skills/
β βββ pdf-workflow/
β βββ SKILL.md # 5-recipe skill for multi-step pipelines
βββ src/
β βββ index.ts # #!/usr/bin/env node shebang
β βββ server.ts # MCP stdio bootstrap
β βββ api/
β β βββ client.ts # iLoveAPI client singleton (CJS interop via createRequire)
β β βββ tasks.ts # 5-phase lifecycle orchestrator
β β βββ errors.ts # HTTP β structured PdfToolkitError mapping
β β βββ types.ts # Types + error class
β βββ tools/ # 18 tools, one file per concern
β β βββ _shared.ts # Zod fragments + writeOutputAndReport helper
β β βββ merge.ts split.ts compress.ts
β β βββ convertFromPdf.ts convertToPdf.ts
β β βββ pageOps.ts security.ts watermark.ts
β β βββ repair.ts ocr.ts
β β βββ index.ts # allTools[] barrel
β βββ util/
β βββ paths.ts # resolveInputs/resolveOutput + sandbox enforcement
β βββ progress.ts # Progress adapter
β βββ logger.ts # stderr-only logger (stdio-safe)
βββ tests/
β βββ unit/ # client, paths, errors, tools.merge (25 tests)
β βββ integration/ # smoke.test.ts β gated on iLoveAPI creds
βββ scripts/
β βββ inspector.sh # npm run inspect β MCP Inspector UI
βββ .github/workflows/
βββ ci.yml # ubuntu+windows Γ node 18/20/22
βββ publish.yml # Publishes to npm on v* tags with --provenance
βοΈ Configuration reference
Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
ILOVEAPI_PROJECT_PUBLIC_KEY | β | β | Project public key from developer.ilovepdf.com |
ILOVEAPI_PROJECT_SECRET_KEY | β | β | Project secret key. Never logged. Used for local JWT signing. |
ILOVEAPI_SANDBOX_ROOT | β | β | Absolute path. When set, all input/output paths must resolve inside this directory β traversal attempts throw PATH_TRAVERSAL. |
PDF_TOOLKIT_DEBUG | β | β | Set to 1 to emit verbose stderr logs (request shape, phase timings). Secrets never logged. |
Structured error codes
Every failure surfaces a PdfToolkitError with a stable machine-readable code:
| Code | Trigger | What to tell the user |
|---|---|---|
MISSING_CREDENTIALS | Env vars not set | Point them at developer.ilovepdf.com |
INVALID_INPUT | HTTP 400 / Zod parse failure | Fix the arguments |
AUTH_FAILED | HTTP 401 | Regenerate the project keys |
PLAN_LIMIT | HTTP 402 | Free tier exhausted or tool not in plan |
NOT_FOUND | HTTP 404 | Input file or task missing |
RATE_LIMITED | HTTP 429 | Back off and retry |
TASK_LIMIT | SDK TaskLimit error | Too many concurrent tasks |
PATH_TRAVERSAL | Path escapes ILOVEAPI_SANDBOX_ROOT | Reject the request |
API_ERROR | Unmapped iLoveAPI error | Check data.http_status + data.iloveapi_code |
π Security model
pdf-toolkit-mcp is designed to be safe to install on a developer machine:
- Stdio only. The server never opens a network socket; it only makes outbound HTTPS calls to
api.ilovepdf.comvia the official SDK. - No
console.log. JSON-RPC over stdio would corrupt on any stray stdout write, so every log line goes throughprocess.stderr. - Secrets never persisted. Credentials live in env vars for the lifetime of the process and are never written to disk, log files, or tool responses.
- JWT generated locally. The
@ilovepdf/ilovepdf-nodejsSDK self-signs JWTs with your secret key β no secret leaves the machine. - Path sandbox (opt-in). Set
ILOVEAPI_SANDBOX_ROOTto constrain the server to a single directory tree; any path resolving outside throws before the API is ever called. - Extension whitelists per tool.
html_to_pdfrejects.exe;image_to_pdfonly accepts common raster formats, etc. - MIT licensed, audit-friendly. ~2k lines of TypeScript. No obfuscation, no minification, no postinstall scripts.
π©βπ» Development
git clone https://github.com/EigenCharlie/pdf-toolkit-mcp.git
cd pdf-toolkit-mcp
npm install
Common tasks
| Command | What it does |
|---|---|
npm run build | Compile TypeScript β dist/ |
npm run dev | Watch-mode build |
npm run typecheck | tsc --noEmit β fast error surface |
npm run lint | ESLint on src/ + tests/ |
npm test | Vitest unit suite (no network) |
npm run test:integration | Real iLoveAPI calls (requires creds) |
npm run inspect | Launch MCP Inspector against the local build |
Debugging inside Claude Code
- Build locally:
npm run build. - Register the local dist instead of npm:
claude mcp remove pdf-toolkit # if previously registered claude mcp add pdf-toolkit -- node "$(pwd)/dist/index.js" - Set
PDF_TOOLKIT_DEBUG=1in your shell before launching Claude Code for verbose stderr. - Stderr is visible with
claude mcp logs pdf-toolkit.
β Testing & CI
- Unit tests β 25 tests across
client,paths,errors, andtools.merge. Fully mocked, no network. Run withnpm test. - Integration smoke test β
tests/integration/smoke.test.tsspins up two minimal valid PDFs and exercises a realmerge_pdfend-to-end. Gated onILOVEAPI_*_KEYenv vars; automatically skipped in PR CI for security. - CI matrix β .github/workflows/ci.yml runs
lint β typecheck β build β teston:- OS:
ubuntu-latest,windows-latest - Node:
18,20,22
- OS:
π’ Releasing
Publishing is automated on tag push:
npm version patch # or minor / major
git push --follow-tags
The publish workflow then:
- Re-runs lint + typecheck + build + tests.
- Publishes to npm with
--access public --provenance(supply-chain attestation). - Creates a GitHub Release with auto-generated notes.
Repo secret required: NPM_TOKEN (npm automation token).
πΊ Roadmap
- v0.1 β 18 PDF tools, stdio transport, plugin + skill, CI, npm publish
- v0.1.1 β MCPB bundle (
.mcpb) for Claude Desktop, marketplace manifest, MCP Registry submission (mcpName) - v0.2 β Submit the Claude plugin to
anthropics/claude-plugins-official, publish an image-tools companion pack - v0.3 β 8 image tools (resize, convert, compress, crop, rotate, watermark, upscale, remove background)
- v0.4 β Signature tools (signing flows require paid tier β gated behind env flag)
- v1.0 β Optional Streamable-HTTP transport for hosted/multi-user setups
Have a feature request? Open an issue.
π FAQ
Is this legal / safe / allowed by iLovePDF? Yes. It's a thin open-source client that uses your credentials β nothing is resold, relicensed, or proxied. The iLoveAPI Terms of Service explicitly permit open-source libraries using user-provided keys (several community SDKs have existed for years). This project does not ship any keys, does not use "iLovePDF"/"iLoveAPI" in its package name, and carries the required disclaimer.
Does it cost money? iLoveAPI offers ~2,500 credits per month free (enough for thousands of small ops). Heavier workloads need a paid iLoveAPI plan. This MCP itself is MIT and free forever.
Does it work offline? No. iLoveAPI is cloud-only, so every tool call requires internet access.
Can I pin a specific version?
Yes: claude mcp add pdf-toolkit -- npx -y pdf-toolkit-mcp@0.1.0.
Can I self-host?
Yes. Clone the repo, npm run build, and point your client at node ./dist/index.js. The server is entirely stateless.
What happens if iLoveAPI is down?
The tool returns a PdfToolkitError with code: "API_ERROR" and data.http_status. Claude can retry with exponential backoff on your behalf.
Can I use this without Claude? Yes β any MCP-compatible client works: Cursor, Windsurf, Zed, MCP Inspector, custom clients. The server is 100% spec-compliant.
π€ Contributing
Contributions welcome! Small checklist before opening a PR:
npm run lint && npm run typecheck && npm testβ all green.- New tools follow the pattern in src/tools/merge.ts (Zod schema β
runTaskβwriteOutputAndReport). - Add at least one unit test.
- Update the Tool catalog in this README if you add/rename a tool.
Bug reports are even more welcome β include the tool name, the arguments, and (if safe to share) the stderr output.
π License & trademarks
Released under the MIT License Β© 2026 Carlos.
"iLovePDF" and "iLoveAPI" are trademarks of iLovePDF SL. This project is an independent, community-built client and is not affiliated with, endorsed by, sponsored by, or certified by iLovePDF SL. The package name intentionally avoids both marks.
π Credits
- iLovePDF / iLoveAPI β the cloud PDF processing API that powers every tool call.
- Anthropic β for Claude, Claude Code, and the Model Context Protocol specification.
@modelcontextprotocol/sdk, Zod, Vitest, ESLint β the toolchain this project stands on.- Every contributor who reports issues, suggests tools, and sends pull requests. π
