MCP Connector

Automate PDF Operations with Claude AI

MCP server wrapping PDFtk and QPDF so Claude can merge, split, encrypt, optimize, and inspect PDFs from natural-language commands.

Works with claude

Maintainer of this project? Claim this page to edit the listing.


91
Spark score
out of 100
Updated Jul 2025
Version 1.0.0
Models

Add to Favorites

Why it matters

Leverage Claude AI to perform a wide range of PDF operations, including merging, splitting, encrypting, optimizing, and analyzing documents through natural language commands.

Outcomes

What it gets done

01

Merge, split, and extract pages from PDF files.

02

Secure PDFs with AES-256 encryption or password protection.

03

Optimize PDF files for web or email delivery.

04

Analyze and repair corrupted PDF documents.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-pdf-tools-mcp | bash

Capabilities

Tools your agent gets

merge_pdfs

Merge multiple PDFs into a single document

split_pdf

Split PDF into individual pages

extract_pages

Extract specific page ranges from a PDF

rotate_pages

Rotate pages by a specified number of degrees

encrypt_pdf

Apply AES-256 encryption to PDF

encrypt_pdf_basic

Add basic password protection to PDF

decrypt_pdf

Remove password protection from PDF

optimize_pdf

Compress PDF for web/email delivery

+7 tools

Overview

PDF Tools MCP Server

An MCP server wrapping PDFtk and QPDF that lets Claude merge, split, extract, rotate, encrypt, decrypt, optimize, repair, and inspect PDFs through natural-language commands, plus file-management and diagnostic tools. Use for conversational PDF manipulation, security, and inspection tasks. Requires PDFtk and QPDF installed as system binaries alongside the Python package - not a pure-Python connector, and not intended for PDF content generation or layout design.

What it does

A FastMCP-based server that wraps the PDFtk and QPDF command-line tools so an AI assistant like Claude can perform PDF operations from conversational requests instead of manual command-line or GUI work - merging, splitting, encrypting, optimizing, and analyzing PDFs through natural language.

Its tools span six categories. Core operations: merge_pdfs combines multiple PDFs, split_pdf breaks a document into individual pages, extract_pages pulls specific page ranges (including comma-separated ranges like 1-5,10,15-20), and rotate_pages rotates selected pages by degrees. Security and encryption: encrypt_pdf applies AES-256 encryption, encrypt_pdf_basic adds simpler password protection with an admin password, and decrypt_pdf removes password protection. Optimization and repair: optimize_pdf compresses a file for web or email delivery, repair_pdf fixes corrupted PDFs, and check_pdf_integrity validates PDF structure. Information and analysis: get_pdf_info returns detailed JSON metadata, update_pdf_metadata edits fields like title or author, inspect_pdf_structure performs internal structural analysis, and extract_pdf_attachments pulls embedded files out of a PDF. File management: download_pdf fetches a file from a URL, open_pdf_preview opens a file in the system viewer, get_file_info reports size and path details, configure_pdf_workspace sets the default working directory, and count_pdfs_in_directory lists PDFs in a folder. System management: get_server_status verifies PDFtk/QPDF are installed, list_default_directories shows the search paths used for filename resolution, and get_pdf_tools_help surfaces in-app documentation.

File paths can be absolute, relative, or filename-only, in which case the server searches a fixed default order: the PDF_WORKSPACE environment variable, ~/Documents/PDFs, ~/Downloads, ~/Desktop, then the current working directory.

git clone https://github.com/Sohaib-2/pdf-mcp-server.git
cd pdf-mcp-server
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

When to use - and when NOT to

Use this connector when you want to manipulate PDFs conversationally - merging reports, extracting excerpts, encrypting sensitive documents, compressing files for email, or auditing PDF structure - without leaving the AI assistant session. It depends on PDFtk and QPDF being installed as system binaries (via apt-get, brew, or a manual Windows download) in addition to the Python package, so it is not a pure-Python, dependency-free connector; environments that cannot install those CLI tools cannot use it. It is not suited for PDF content generation or complex layout editing - its scope is manipulation, security, optimization, and inspection of existing PDF files.

Capabilities

Internally the server is a thin FastMCP layer over two CLI wrappers: pdftk_tools.py wraps PDFtk-backed operations (merge, split, encryption), qpdf_tools.py wraps QPDF-backed operations (repair, integrity checking, structure inspection), and utils.py handles file utilities and the default-directory path resolution shared across every tool. Read-only tools (get_pdf_info, check_pdf_integrity, inspect_pdf_structure, list_default_directories, get_server_status) never modify the source file, while write tools (merge_pdfs, encrypt_pdf, update_pdf_metadata, and similar) always take an explicit output path rather than overwriting the input in place.

How to install

Requires Python 3.8+ plus the PDFtk and QPDF command-line tools installed separately (apt-get install pdftk qpdf on Ubuntu/Debian, brew install pdftk-java qpdf on macOS, or manual downloads on Windows). Install the Python side with a virtual environment and pip install -r requirements.txt, or minimally via pip install fastmcp requests pathlib. Register it with Claude Desktop by adding an mcpServers entry to claude_desktop_config.json pointing at the server's Python interpreter and server.py, then restart Claude Desktop.

Who it's for

Anyone who regularly merges, splits, encrypts, compresses, or inspects PDFs and wants to do it through natural-language requests to Claude instead of separate PDF tooling or manual PDFtk/QPDF commands.

Source README

PDF MCP Server

GitHub stars
GitHub issues
GitHub license
Python 3.8+

Transform PDF manipulation with AI-powered natural language commands through Claude integration

Comprehensive PDF toolkit that integrates seamlessly with Claude AI via MCP (Model Context Protocol). Perform complex PDF operations using simple conversational commands - merge, split, encrypt, optimize, and analyze PDFs effortlessly.

🚀 Quick Start

Clone & Setup

git clone https://github.com/Sohaib-2/pdf-mcp-server.git
cd pdf-mcp-server

Option 1: With Virtual Environment (Recommended)

python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS/Linux  
source .venv/bin/activate

pip install -r requirements.txt

Option 2: Without Virtual Environment

pip install fastmcp requests pathlib

Install PDF Tools

PDFtk:

# Ubuntu/Debian
sudo apt-get install pdftk
# macOS
brew install pdftk-java
# Windows: Download from https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

QPDF:

# Ubuntu/Debian
sudo apt-get install qpdf
# macOS
brew install qpdf
# Windows: Download from https://qpdf.sourceforge.io/

🔧 Claude Desktop Integration

  1. Locate Claude config file:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  2. Add PDF MCP Server:

With Virtual Environment:

{
  "mcpServers": {
    "pdf-tools": {
      "command": "C:\\path\\to\\pdf-mcp-server\\.venv\\Scripts\\python.exe",
      "args": ["C:\\path\\to\\pdf-mcp-server\\server.py"]
    }
  }
}

Without Virtual Environment:

{
  "mcpServers": {
    "pdf-tools": {
      "command": "python",
      "args": ["C:\\path\\to\\pdf-mcp-server\\server.py"]
    }
  }
}

macOS/Linux with venv:

{
  "mcpServers": {
    "pdf-tools": {
      "command": "/path/to/pdf-mcp-server/.venv/bin/python",
      "args": ["/path/to/pdf-mcp-server/server.py"]
    }
  }
}
  1. Restart Claude Desktop

  2. Start using natural language:

    • "Merge these 3 PDFs into one document"
    • "Encrypt my report with password protection"
    • "Extract pages 1-10 from this manual"

📚 Complete Tool Reference

Core Operations

Tool Description Example
merge_pdfs Combine multiple PDFs merge_pdfs(['doc1.pdf', 'doc2.pdf'], 'combined.pdf')
split_pdf Split into individual pages split_pdf('document.pdf', './pages/')
extract_pages Extract specific page ranges extract_pages('book.pdf', '1-5,10,15-20', 'excerpt.pdf')
rotate_pages Rotate pages by degrees rotate_pages('scan.pdf', '90', 'rotated.pdf', '1-3')

Security & Encryption

Tool Description Example
encrypt_pdf AES-256 encryption encrypt_pdf('file.pdf', 'secure.pdf', 'password123')
encrypt_pdf_basic Basic password protection encrypt_pdf_basic('doc.pdf', 'protected.pdf', 'pass', 'admin')
decrypt_pdf Remove password protection decrypt_pdf('locked.pdf', 'unlocked.pdf', 'password')

Optimization & Repair

Tool Description Example
optimize_pdf Compress for web/email optimize_pdf('large.pdf', 'small.pdf', 'high')
repair_pdf Fix corrupted PDFs repair_pdf('broken.pdf', 'fixed.pdf')
check_pdf_integrity Validate PDF structure check_pdf_integrity('suspicious.pdf')

Information & Analysis

Tool Description Example
get_pdf_info Detailed metadata (JSON) get_pdf_info('document.pdf')
update_pdf_metadata Modify title/author/etc update_pdf_metadata('file.pdf', 'updated.pdf', title='New Title')
inspect_pdf_structure Internal structure analysis inspect_pdf_structure('complex.pdf', detailed=True)
extract_pdf_attachments Extract embedded files extract_pdf_attachments('portfolio.pdf', './attachments/')

File Management

Tool Description Example
download_pdf Download from URL download_pdf('https://example.com/file.pdf', 'local.pdf')
open_pdf_preview Open with system viewer open_pdf_preview('report.pdf', browser=False)
get_file_info File size/path details get_file_info('document.pdf')
configure_pdf_workspace Set working directory configure_pdf_workspace('/path/to/workspace')
count_pdfs_in_directory List PDFs in folder count_pdfs_in_directory('./pdf_folder/')

System Management

Tool Description Purpose
get_server_status Check tool availability Verify PDFtk/QPDF installation
list_default_directories Show search paths Debug file resolution issues
get_pdf_tools_help Complete documentation In-app help reference

💬 Natural Language Examples

Document Management:

  • "Combine all my research papers into one bibliography"
  • "Split this 100-page manual into chapters"
  • "Extract the executive summary from pages 2-4"

Security Operations:

  • "Encrypt this contract with military-grade protection"
  • "Remove password from this locked document"
  • "Add owner permissions to prevent editing"

File Optimization:

  • "Optimize all PDFs in my downloads folder"
  • "Fix this corrupted presentation file"

Advanced Analysis:

  • "Show me detailed metadata about this academic paper"
  • "Analyze the internal structure for security audit"

🗂️ File Path Handling

Flexible path resolution:

  • Absolute: C:\Documents\file.pdf
  • Relative: ../pdfs/document.pdf
  • Filename only: report.pdf (searches default directories)

Default search order:

  1. PDF_WORKSPACE environment variable
  2. ~/Documents/PDFs
  3. ~/Downloads
  4. ~/Desktop
  5. Current working directory

⚙️ Configuration

Custom workspace:

configure_pdf_workspace('/path/to/your/pdfs')

Check installation:

get_server_status()  # Verify PDFtk and QPDF availability

🛠️ Troubleshooting

Common issues:

Problem Solution
PDFtk not found Install PDFtk and add to PATH
QPDF error Install QPDF via package manager
File not found Use list_default_directories() to check search paths
Permission denied Run with appropriate file permissions
Invalid PDF Use check_pdf_integrity() to validate file

Debug commands:

get_server_status()           # Check tool installation
list_default_directories()    # Verify search paths  
get_pdf_info('file.pdf')      # Validate PDF structure

🏗️ Architecture

pdf-mcp-server/
├── server.py              # FastMCP server with 16 tools
├── pdftk_tools.py         # PDFtk CLI wrapper
├── qpdf_tools.py          # QPDF CLI wrapper  
├── utils.py               # File utilities & path resolution
└── requirements.txt       # Python dependencies

Built with:

  • FastMCP - MCP server framework
  • PDFtk - PDF manipulation
  • QPDF - Advanced PDF processing

🤝 Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open Pull Request

📄 License

This project is licensed under the MIT License

👨‍💻 Author

Sohaib-2 - GitHub

🌟 Acknowledgments


Star this repo if it helped you! | 🐛 Report issues | 💡 Request features

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.