home / mcp / pdf manipulation mcp server
A study project: MCP server for direct PDF manipulation and editing
Configuration
View docs{
"mcpServers": {
"andr3medeiros-pdf-manipulation-mcp-server": {
"command": "uv",
"args": [
"run",
"pdf-manipulation-mcp-server"
]
}
}
}You can perform a wide range of PDF edits directly through a Model Context Protocol (MCP) server built for PDF manipulation. This server lets you add or replace text, insert images, manage annotations and form fields, and perform page-level operations like merging, splitting, rotating, cropping, and auto-cropping, all while preserving metadata and producing safe output files with timestamps.
You connect to the MCP server using an MCP client and issue high-level operations such as adding text, extracting images, or merging PDFs. Start by choosing an available operation, for example to add text to a PDF page, crop pages, or auto-crop all pages to content boundaries. The server creates new output files with timestamps so originals remain intact, and it validates inputs to prevent invalid operations.
Prerequisites: you need Python 3.10 or newer and a working Python environment with pip.
Option 1: Run with UV (no installation required) so you can start experimenting quickly.
uv run pdf-manipulation-mcp-serverOption 2: Install from PyPI and run the server directly from your system path.
pip install pdf-manipulation-mcp-server
# Run the server
pdf-mcp-serverOption 3: Install from GitHub and run the server from your environment.
pip install git+https://github.com/yourusername/pdf-manipulation-mcp-server.git
# Run the server
pdf-mcp-serverOption 4: Clone the project, install in development mode, then run.
# 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-serverOption 5: Development workflow with UV for dependencies and tests.
# 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 in development
uv run python server.pyConfiguration and usage notes help you tailor the server to your environment. All operations produce new files with timestamps in the same directory structure as the originals, following the pattern {original_name}_{operation}_{timestamp}.pdf to avoid overwriting sources.
Common troubleshooting tips include ensuring you have the required Python version, installing dependencies with the correct tool (UV or pip), and checking the logs for MCP errors if tools do not appear in the client interface. If UV or Python versions cause issues, install the appropriate version and retry the setup.
Development notes cover the core capabilities: text and image operations, annotations, form fields, page manipulation (merge, combine, split, rotate, delete, crop), auto-cropping, page layout options, and metadata management.
Add text to a PDF at a specified position with control over font size and color.
Replace existing text within a PDF document.
Insert an image into a PDF at a chosen location and size.
Extract all images from a PDF to an output directory.
Add annotations such as text, highlight, underline, or strikeout to PDF pages.
Add form fields like text, checkbox, radio, or combobox to a PDF.
Fill in form fields in a PDF with provided values.
Merge multiple PDF files into a single document.
Combine multiple pages into a single page with a chosen layout.
Split a PDF into individual pages or specified ranges.
Rotate a specific page by 90, 180, or 270 degrees.
Delete a page from a PDF.
Crop a page using coordinates with optional bounding box mode.
Automatically crop pages by detecting content boundaries.
Retrieve metadata and information about a PDF.
Set metadata for a PDF.