productivity

PDF Manipulation

andr3medeiros

by andr3medeiros

Automate PDF tasks using PyMuPDF: text, image, form, annotation & metadata handling—ideal for powder diffraction file ma

Provides comprehensive PDF processing capabilities through PyMuPDF, including text operations, page manipulation, image handling, form field management, annotation support, and metadata editing with intelligent auto-cropping and timestamped output files for document automation workflows.

github stars

5

0 commentsdiscussion

Both formats append explainx.ai attribution and the canonical URL for this MCP server listing.

Built on PyMuPDF libraryAuto-cropping with intelligent boundariesTimestamped output files

best for

  • / Document automation workflows
  • / PDF form processing and filling
  • / Batch PDF editing and manipulation
  • / Content extraction and reorganization

capabilities

  • / Add and replace text in PDFs
  • / Extract and insert images
  • / Split and merge PDF documents
  • / Fill and create form fields
  • / Add annotations and highlights
  • / Combine multiple pages into single layouts

what it does

Provides comprehensive PDF editing and manipulation capabilities through PyMuPDF. Lets you edit text, add images, manage forms, split/merge documents, and handle annotations directly in PDF files.

about

PDF Manipulation is a community-built MCP server published by andr3medeiros that provides AI assistants with tools and capabilities via the Model Context Protocol. Automate PDF tasks using PyMuPDF: text, image, form, annotation & metadata handling—ideal for powder diffraction file ma It is categorized under productivity. This server exposes 16 tools that AI clients can invoke during conversations and coding sessions.

how to install

You can install PDF Manipulation in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

license

MIT

PDF Manipulation is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

readme

PDF Manipulation MCP Server

📚 This project is entirely based on PyMuPDF - a powerful Python library for PDF manipulation. Please check out the official PyMuPDF documentation to learn more about its extensive capabilities!

A study project implementing a Model Context Protocol (MCP) server that provides comprehensive PDF manipulation capabilities using the official MCP FastMCP framework. This project focuses on direct PDF editing and manipulation features for learning and experimentation purposes.

<a href="https://glama.ai/mcp/servers/@andr3medeiros/pdf-manipulation-mcp-server"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@andr3medeiros/pdf-manipulation-mcp-server/badge" alt="PDF Manipulation Server MCP server" /> </a>

Quick Start: Run directly with uv run pdf-manipulation-mcp-server (like npx for Node.js packages)

Features

  • Text Operations: Add, replace, and manipulate text in PDFs
  • Image Operations: Add images and extract images from PDFs
  • Annotations: Add various types of annotations (text, highlight, underline, etc.)
  • Form Fields: Add and fill form fields
  • Page Manipulation: Merge, split, rotate, delete, and crop pages
  • Auto-Crop: Automatically detect and crop content boundaries
  • Page Combination: Combine multiple pages into single pages with various layouts
  • Metadata: Get and set PDF metadata

Quick Start

Prerequisites

  • Python 3.10+
  • pip (comes with Python)

📖 For detailed installation instructions, see INSTALL.md

Installation

Option 1: Run Directly with UV (Like npx)

# Run without installation (fastest)
uv run pdf-manipulation-mcp-server

Option 2: Install from PyPI

# Install the package
pip install pdf-manipulation-mcp-server

# Run the server
pdf-mcp-server

Option 3: Install from GitHub

# Install directly from GitHub
pip install git+https://github.com/yourusername/pdf-manipulation-mcp-server.git

# Run the server
pdf-mcp-server

Option 4: Clone and Install Locally

# Clone the repository
git clone https://github.com/yourusername/pdf-manipulation-mcp-server.git
cd pdf-manipulation-mcp-server

# Install in development mode
pip install -e .

# Run the server
pdf-mcp-server

Option 5: Using UV (Development)

# Clone the repository
git clone https://github.com/yourusername/pdf-manipulation-mcp-server.git
cd pdf-manipulation-mcp-server

# Install dependencies with UV
uv pip install mcp pymupdf

# Test the server
uv run pytest tests/ -v

# Run the server
uv run python server.py

Available Tools (15 Total)

Text Operations

  • pdf_add_text - Add text to a PDF at specified position
  • pdf_replace_text - Replace text in a PDF document

Image Operations

  • pdf_add_image - Add an image to a PDF
  • pdf_extract_images - Extract all images from a PDF

Annotations

  • pdf_add_annotation - Add annotations to a PDF (text, highlight, underline, strikeout)

Form Fields

  • pdf_add_form_field - Add form fields to a PDF (text, checkbox, radio, combobox)
  • pdf_fill_form - Fill form fields in a PDF with values

Page Manipulation

  • pdf_merge_files - Merge multiple PDF files into one
  • pdf_combine_pages_to_single - Combine multiple pages from a PDF into a single page
  • pdf_split - Split a PDF into individual pages or page ranges
  • pdf_rotate_page - Rotate a page in a PDF (90, 180, 270 degrees)
  • pdf_delete_page - Delete a page from a PDF
  • pdf_crop_page - Crop a page in a PDF with coordinate support
  • pdf_auto_crop_page - Automatically crop pages by detecting content boundaries

Metadata

  • pdf_get_info - Get metadata and information about a PDF
  • pdf_set_metadata - Set metadata for a PDF

How to Configure with Cursor IDE

Step 1: Install the Server

Follow the installation steps above to set up the MCP server.

Step 2: Configure Cursor IDE

Add this configuration to your Cursor settings:

Option A: Using an MCP config and uvx:

Create ~/.cursor/mcp_config.json:

{
  "mcpServers": {
    "pdf-manipulation": {
      "command": "uvx",
      "args": ["--from", "pdf-manipulation-mcp-server", "pdf-mcp-server"]
    }
  }
}

Option B: Using MCP Config File from a local installation

Create ~/.cursor/mcp_config.json:

{
  "mcpServers": {
    "pdf-manipulation": {
      "command": "uv",
      "args": ["run", "python", "server.py"],
      "cwd": "/path/to/pdf-manipulation-mcp-server"
    }
  }
}

Option C: Using Cursor Settings UI

  1. Open Cursor Settings (Cmd+, on Mac, Ctrl+, on Windows/Linux)
  2. Search for "MCP" in settings
  3. Add this configuration:
{
  "mcp.servers": {
    "pdf-manipulation": {
      "command": "uv",
      "args": ["run", "python", "server.py"],
      "cwd": "/path/to/pdf-manipulation-mcp-server"
    }
  }
}

Step 3: Restart Cursor IDE

After adding the configuration, restart Cursor IDE to load the MCP server.

Step 4: Test the Integration

  1. Open a new chat in Cursor
  2. Try these commands:
    • "Convert this PDF to Markdown"
    • "Add text to a PDF"
    • "Extract images from a PDF"
    • "Merge multiple PDFs"

Usage Examples

Basic PDF Auto-Crop Workflow

# Automatically crop PDF pages to remove margins
result = await pdf_auto_crop_page(
    pdf_path="document.pdf",
    padding=10.0
)

# Crop specific page with coordinates
result = await pdf_crop_page(
    pdf_path="document.pdf",
    page_number=0,
    x0=50, y0=50, x1=400, y1=300,
    coordinate_mode="bbox"
)

Adding Text to PDF

result = await pdf_add_text(
    pdf_path="document.pdf",
    page_number=0,
    text="New text content",
    x=100,
    y=100,
    font_size=14,
    color=[1, 0, 0]  # Red color
)

Working with Images

# Add image to PDF
result = await pdf_add_image(
    pdf_path="document.pdf",
    page_number=0,
    image_path="image.png",
    x=100,
    y=200,
    width=200,
    height=150
)

# Extract all images from PDF
result = await pdf_extract_images(
    pdf_path="document.pdf",
    output_dir="extracted_images"
)

Page Manipulation

# Merge multiple PDFs
result = await pdf_merge_files(
    pdf_paths=["doc1.pdf", "doc2.pdf", "doc3.pdf"]
)

# Combine pages from a single PDF
result = await pdf_combine_pages_to_single(
    pdf_path="document.pdf",
    page_numbers=[0, 1, 2],
    layout="vertical"
)

# Split PDF into individual pages
result = await pdf_split(
    pdf_path="document.pdf",
    output_dir="split_pages"
)

# Rotate a page
result = await pdf_rotate_page(
    pdf_path="document.pdf",
    page_number=0,
    rotation=90
)

Development

Project Structure

pdf-manipulation-mcp-server/
├── pdf_server.py          # Main MCP server implementation
├── server.py              # Entry point for UV
├── test_mcp_server.py     # Test script
├── pyproject.toml         # Project configuration
├── install.sh             # Installation script (Mac/Linux)
├── install.bat            # Installation script (Windows)
└── README.md              # This file

Running Tests

# Test the MCP server
uv run python test_mcp_server.py

# Run the server
uv run python server.py

Dependencies

  • mcp - Official MCP SDK for Python
  • pymupdf - Core PDF manipulation library
  • pytest - Testing framework (dev dependency)
  • pytest-asyncio - Async testing support (dev dependency)

File Safety

All operations create new files with timestamps to avoid overwriting originals. Output files follow the pattern: {original_name}_{operation}_{timestamp}.pdf

Error Handling

The server includes comprehensive error handling:

  • Validates PDF files before operations
  • Checks page numbers and coordinates
  • Provides clear error messages
  • Handles missing files gracefully
  • Catches and reports PyMuPDF exceptions

Troubleshooting

Common Issues

  1. "No tools" in Cursor settings: This is normal! Tools appear in the chat interface, not in settings.

  2. UV not found: Install UV first:

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  3. Python version error: UV will automatically install Python 3.11+ if needed.

  4. Dependencies not found: Make sure you're using UV:

    uv pip install mcp pymupdf
    

Debug Mode

To run the server in debug mode:

uv run python server.py --debug

Contributing

This is a study project, but contributions are welcome! If you'd like to contribute:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with uv run pytest tests/ -v
  5. Submit a pull request

Study Project Notes

This project was created as a learning exercise to explore:

  • Model Context Protocol (MCP) server development
  • PDF manipulation using PyMuPDF
  • FastMCP framework implementation
  • Automated testing with pytest
  • Content detection and cropping algorithms

License

This project is open source and available under the MIT License.

Support

For issues and questions:

  1. Check the troubleshooting section above
  2. Review the test output: uv run python test_mcp_server.py
  3. Check Cursor logs for MCP errors
  4. Open an issue on GitHub

FAQ

What is the PDF Manipulation MCP server?
PDF Manipulation is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
How do MCP servers relate to agent skills?
Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
How are reviews shown for PDF Manipulation?
This profile displays 50 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.7 out of 5—verify behavior in your own environment before production use.

Use Cases

Extended AI Capabilities

Add new capabilities to Claude beyond text generation

Example

Access external data sources, execute code, interact with tools and services

Transform Claude from chatbot to action-taking agent

Context Enhancement

Provide Claude with access to relevant context and data

Example

Load project documentation, access knowledge bases, query databases

Get more accurate, context-aware responses

Workflow Automation

Automate multi-step workflows combining AI and external tools

Example

Research → Summarize → Create document → Send notification

Complete complex tasks end-to-end without manual steps

Implementation Guide

Prerequisites

  • Claude Desktop 0.7.0+ or Cursor IDE with MCP support
  • Basic understanding of MCP architecture and capabilities
  • Access credentials for integrated services (if required)
  • Willingness to experiment and iterate on configuration

Time Estimate

15-60 minutes depending on server complexity

Installation Steps

  1. 1.Install MCP server: npm install -g [package-name] or via GitHub
  2. 2.Add server configuration to ~/.claude/mcp.json
  3. 3.Provide required credentials and configuration
  4. 4.Restart Claude Desktop to load new server
  5. 5.Test basic functionality with simple prompts
  6. 6.Explore capabilities and experiment with use cases
  7. 7.Document successful patterns for reuse

Troubleshooting

  • MCP server not loading: Check config syntax, verify installation
  • Connection errors: Check network, firewall, credentials
  • Feature not working: Read server docs, check required parameters
  • Performance issues: Monitor resource usage, check for network latency
  • Conflicts with other servers: Check port assignments, namespace collisions

Best Practices

✓ Do

  • +Read server documentation thoroughly before setup
  • +Start with simple use cases to validate functionality
  • +Test in non-production environment first
  • +Monitor resource usage and performance
  • +Keep servers updated for bug fixes and new features
  • +Document configuration for team members
  • +Use environment variables for sensitive configuration

✗ Don't

  • Don't grant overly permissive access to MCP servers
  • Don't skip reading security considerations in docs
  • Don't expose sensitive data without proper controls
  • Don't run untrusted MCP servers without code review
  • Don't ignore error messages—investigate root cause

💡 Pro Tips

  • Combine multiple MCP servers for powerful workflows
  • Create custom MCP servers for your specific needs
  • Share successful configurations with team
  • Use MCP inspector for debugging
  • Join MCP community for tips and troubleshooting

Technical Details

Architecture

Model Context Protocol standardizes how AI hosts (Claude, Cursor) communicate with external tools and data sources through server implementations.

Protocols

  • Model Context Protocol (MCP)
  • JSON-RPC 2.0
  • stdio or HTTP transport

Compatibility

  • Claude Desktop
  • Cursor IDE
  • Custom MCP clients

When to Use This

✓ Use When

Use when you need Claude to access external data, execute actions, or integrate with tools. Best for extending AI capabilities beyond conversation.

✗ Avoid When

Avoid when native integrations exist (use official APIs directly), for real-time critical systems, or when security/compliance requires zero external dependencies.

Integration

  • Tool composition: Chain multiple MCP tools in workflows
  • Context augmentation: Provide AI with relevant external data
  • Action delegation: Let AI execute tasks on external systems
  • Bidirectional sync: Keep AI context and external systems in sync

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.

List & Promote Your MCP Server

Share your MCP server with the developer community

GET_STARTED →
MCP server reviews

Ratings

4.750 reviews
  • Kaira Malhotra· Dec 20, 2024

    We wired PDF Manipulation into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.

  • Olivia Brown· Dec 20, 2024

    Strong directory entry: PDF Manipulation surfaces stars and publisher context so we could sanity-check maintenance before adopting.

  • Pratham Ware· Dec 16, 2024

    PDF Manipulation reduced integration guesswork — categories and install configs on the listing matched the upstream repo.

  • Kiara Khanna· Dec 16, 2024

    I recommend PDF Manipulation for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.

  • Nia Rao· Nov 11, 2024

    Useful MCP listing: PDF Manipulation is the kind of server we cite when onboarding engineers to host + tool permissions.

  • Yash Thakker· Nov 7, 2024

    I recommend PDF Manipulation for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.

  • Dev Torres· Nov 7, 2024

    PDF Manipulation reduced integration guesswork — categories and install configs on the listing matched the upstream repo.

  • Dhruvi Jain· Oct 26, 2024

    Strong directory entry: PDF Manipulation surfaces stars and publisher context so we could sanity-check maintenance before adopting.

  • Isabella Shah· Oct 26, 2024

    Useful MCP listing: PDF Manipulation is the kind of server we cite when onboarding engineers to host + tool permissions.

  • Omar Zhang· Oct 2, 2024

    PDF Manipulation reduced integration guesswork — categories and install configs on the listing matched the upstream repo.

showing 1-10 of 50

1 / 5