oxidize-pdf
About
Rust-powered PDF toolkit over MCP: create, read, and analyze PDFs; extract text and entities for RAG; convert to Markdown; split/merge/rotate/reorder pages; manage form fields and annotations; encrypt documents. Runs locally via uvx oxidize-mcp.
Details
- Author
- bzsanti
- Categories
- File Management, Other, Knowledge Base
Jump to
Setup
Install oxidize-pdf in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/bzsanti/oxidize-python
Follow the installation instructions in the repository README, then restart your MCP client.
Rust-powered PDF library for Python.Generate, parse, split, merge, and manipulate PDFs with native performance. Ships with a built-inMCP serverso AI agents can work with PDFs out of the box.
No C dependencies. No Java. No subprocess calls.
pip install oxidize-pdf # Core library pip install "oxidize-pdf[mcp]" # + MCP server for AI agents
Platforms:Linux (x86_64, aarch64) | macOS (x86_64, Apple Silicon) | Windows (x86_64)Requires:Python 3.10+
Give your AI agent full PDF capabilities in one line:
Add to yourclaude_desktop_config.json:
{ "mcpServers": { "oxidize-pdf": { "command": "oxidize-mcp", "env": { "OXIDIZE_WORKSPACE": "/path/to/your/pdfs" } } } }
Copilot's agent mode speaks MCP. Add.vscode/mcp.jsonto your workspace:
{ "servers": { "oxidize-pdf": { "command": "oxidize-mcp", "env": { "OXIDIZE_WORKSPACE": "/path/to/your/pdfs" } } } }
Open the Chat view, switch toAgentmode, and the 12 PDF tools appear in the tool picker. (The same block also works under themcp.serverskey in your usersettings.jsonif you prefer a global install.)
TheOpenAI Agents SDKspawns the server over stdio and exposes its tools to an agent:
from agents import Agent, Runner from agents.mcp import MCPServerStdio async with MCPServerStdio( params={"command": "oxidize-mcp", "env": {"OXIDIZE_WORKSPACE": "/path/to/your/pdfs"}}, cache_tools_list=True, ) as server: agent = Agent( name="PDF assistant", instructions="Use the oxidize-pdf tools to inspect and manipulate PDFs.", mcp_servers=[server], ) result = await Runner.run(agent, "How many pages does report.pdf have?") print(result.final_output)
A runnable version is inexamples/openai_agents_quickstart.py.
Both integrations run the serverlocally over stdio, so its tools operate on PDFs in the configured workspace directory. Remote/hosted use (e.g. the OpenAI Responses API hosted MCP tool) needs an HTTP transport and is not yet exposed.
The server also exposesresources(session data, capabilities, version info) andprompts(guided workflows for summarization, data extraction, form filling, and more).
OXIDIZE_WORKSPACE=/path/to/pdfs oxidize-mcp
The server is configured entirely through environment variables:
Resource caps (OXIDIZE_MAX_) protect the server from a large or malicious PDF: oversized documents are rejected up front and tool responses are bounded rather than serialized unbounded. Exceeding a cap returns an error with codeRESOURCE_LIMIT.
from oxidize_pdf.mcp.server import run run()
from oxidize_pdf import Document, Page, Font, Color doc = Document() doc.set_title("My Document") doc.set_author("Jane Doe") page = Page.a4() page.set_font(Font.HELVETICA, 24.0) page.set_text_color(Color.black()) page.text_at(72.0, 750.0, "Hello from oxidize-pdf!") page.set_font(Font.TIMES_ROMAN, 12.0) page.text_at(72.0, 700.0, "Generated with Python + Rust.") doc.add_page(page) doc.save("output.pdf")
from oxidize_pdf import PdfReader reader = PdfReader.open("document.pdf") print(f"Pages: {reader.page_count}, Version: {reader.version}") for i, text in enumerate(reader.extract_text()): print(f"--- Page {i + 1} ---") print(text)
from oxidize_pdf import split_pdf, merge_pdfs, rotate_pdf, extract_pages split_pdf("input.pdf", "output_dir/") # Split into individual pages merge_pdfs(["part1.pdf", "part2.pdf"], "merged.pdf") # Merge multiple PDFs rotate_pdf("input.pdf", "rotated.pdf", 90) # Rotate all pages extract_pages("input.pdf", "subset.pdf", [0, 2, 4]) # Extract specific pages
from oxidize_pdf import Document, Page, Color doc = Document() page = Page.a4() page.set_fill_color(Color.hex("#3498db")) page.draw_rect(72.0, 700.0, 200.0, 100.0) page.fill() page.set_stroke_color(Color.red()) page.set_line_width(2.0) page.draw_circle(300.0, 500.0, 50.0) page.stroke() doc.add_page(page) doc.save("graphics.pdf")
from oxidize_pdf import Color, Point, Rectangle, Margins, Font # Colors Color.rgb(1.0, 0.0, 0.0) # RGB Color.hex("#ff6600") # Hex Color.cmyk(0.0, 1.0, 1.0, 0.0) # CMYK # Geometry Point(72.0, 720.0) Rectangle.from_xywh(72.0, 72.0, 468.0, 648.0) Margins.uniform(72.0) # Fonts — all 14 standard PDF fonts Font.HELVETICA # Font.HELVETICA_BOLD Font.TIMES_ROMAN # Font.TIMES_BOLD Font.COURIER # Font.COURIER_BOLD
from oxidize_pdf import PdfReader, PdfError, PdfIoError, PdfParseError try: reader = PdfReader.open("missing.pdf") except PdfIoError as e: print(f"I/O error: {e}") except PdfParseError as e: print(f"Parse error: {e}") except PdfError as e: print(f"PDF error: {e}")
Exception hierarchy:PdfError>PdfIoError,PdfParseError,PdfEncryptionError,PdfPermissionError
oxidize-pdf includes anMCPserver that exposes PDF capabilities to AI assistants like Claude. Install with themcpextra:
Add this to yourclaude_desktop_config.json:
{ "mcpServers": { "oxidize-pdf": { "command": "uvx", "args": ["--from", "oxidize-pdf[mcp]", "oxidize-mcp"] } } }
claude mcp add oxidize-pdf -- uvx --from "oxidize-pdf[mcp]" oxidize-mcp
- oxidize://fonts— Available built-in PDF fonts
- oxidize://page-sizes— Standard page sizes with dimensions
- oxidize://capabilities— Server capabilities and tool listing
- oxidize://version— Version information
- oxidize://workspace— PDF files in the workspace directory
- oxidize://session/{id}— Session data by ID
- Encryption write support:Document.encrypt()configures encryption parameters but the underlying Rust library does not yet serialize the encryption dictionary to the PDF output. Reading encrypted PDFs works correctly.
- Image extraction returns raw embedded streams:extract_images_from_pdfextracts each embedded image as-is (e.g. aDCTDecodeJPEG is written byte-for-byte). Imagepreprocessing*— auto rotation-correction, contrast enhancement, denoise, upscaling, force-grayscale — is not available, because the build excludes the upstreamexternal-imagesfeature (and itsimage-crate dependency). This keeps extraction faithful and lossless; it does not silently return empty or stub results.
- CPython only: PyPy and GraalPy are not supported.
A server for AI agents to selectively process and extract content from PDF documents.
Parses PDF files from a URL into structured formats like JSON and Markdown.
A server for processing PDF files, allowing text and table extraction, metadata retrieval, and file listing within a specific directory.
Analyze and extract information from DLIS (Digital Log Interchange Standard) files, including channel data and metadata.
Read, analyze, and manipulate data in Excel (XLSX, XLS) and CSV files with advanced filtering and analytics.
Convert various file formats for documents and images, such as DOCX, PDF, CSV, and more.
Extract text, images, and perform OCR on PDF documents using Tesseract OCR.
Document conversion MCP server — PDF, DOCX, HTML, EPUB to Markdown with 6 tools and Docker support
A server that converts PDF files to PNG images. Requires the poppler library to be installed.
Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





