Get the FREE Ultimate OpenClaw Setup Guide →

pdf

Comprehensive PDF manipulation toolkit. Merge, split, encrypt, optimize PDFs through natural language commands via MCP protocol.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio sohaib-2-pdf-mcp-server python server.py

How to use

This PDF MCP server provides a range of containerized PDF manipulation tools that are accessible via Claude through the Model Context Protocol. It exposes operations such as merging multiple PDFs, splitting a document into pages, extracting specific pages, rotating pages, and performing security and optimization tasks like encrypting, decrypting, repairing, and compressing PDFs. The tools are designed to be invoked by natural language commands from Claude, translating your requests into precise PDF operations behind the scenes. Common workflows include combining several PDFs into one, securing a document with password protection, extracting a page range for review, or preparing a file for web distribution with size optimization.

You can interact with the MCP server by starting the Python server (server.py) and configuring Claude to point at it under the pdf tool set. Typical tasks you might ask for include merging documents, extracting specific pages, encrypting a file with a password, or checking a PDF’s metadata. The tool reference in the README lists the available functions such as merge_pdfs, split_pdf, extract_pages, encrypt_pdf, optimize_pdf, get_pdf_info, and more, enabling both routine document prep and deeper analysis through natural language prompts.

How to install

Prerequisites:

  • Python 3.8+ installed on your system
  • Access to install Python packages (pip)
  • Optional: a virtual environment tool (venv) if you prefer isolation

Step-by-step installation:

  1. Clone the repository: git clone https://github.com/Sohaib-2/pdf-mcp-server.git cd pdf-mcp-server

  2. Create and activate a virtual environment (recommended): python -m venv .venv

    Windows

    .venv\Scripts\activate

    macOS/Linux

    source .venv/bin/activate

  3. Install Python dependencies: pip install -r requirements.txt

  4. Run the MCP server: python server.py

If you prefer to install without a virtual environment, install the requirements system-wide and run: pip install fastmcp requests pathlib python server.py

Additional notes

  • The server exposes a rich set of PDF operations. Refer to the tool reference in the README for the full list and usage examples.
  • Ensure external tools required by the wrappers (PDFtk and QPDF) are installed on your system if you plan to use related operations:
    • PDFtk: install via your OS package manager (e.g., apt, brew) or from the PDFtk website.
    • QPDF: install via your OS package manager (e.g., apt, brew).
  • If Claude integration requires a specific config path, ensure Claude is pointing to the same server.py instance and that the pdf toolset name matches (in examples it’s pdf-tools; in this MCP setup we’re using pdf).
  • Common issues can include missing dependencies, tool wrappers not finding external binaries, or firewall/network restrictions preventing Claude from reaching the local server.
  • You can verify server availability and basic functionality via get_server_status() and list_default_directories() commands once the server is running.

Related MCP Servers

Sponsor this space

Reach thousands of developers