LabscoMCP early access ↗
NameetPMCP SERVER

pdfmux

Self-healing PDF extraction for AI agents — routes each page to the best of several backends, audits its own output, re-extracts the pages it got wrong, and flags what it still cannot read instead of dropping it.

by NameetP ↗Document Conversion, PDF & TranslationCommunity

LABSCO SUMMARY

Extraction that checks its own work.

The distinguishing move is the audit: most extractors hand back whatever they got and stay quiet about the pages they mangled, and that silent garbage is what poisons a RAG pipeline. pdfmux routes per page, re-extracts the failures with a stronger backend, and — crucially — flags what it still cannot read rather than dropping it. The verify path turns the same audit outward, certifying any other engine's output for silent drops. It runs fully locally by default; a Gemini key is only for a paid fallback on pages every local backend finds hard, and the README is candid that the certifier is lexical, catching missing and garbled content, not faithful paraphrase.

What it is

A PDF extraction tool with an MCP server, built so an AI agent gets clean text rather than silent gaps. It routes each page to the best-fitting extraction backend, then audits the result — catching blank pages, scrambled columns and broken tables — re-extracts the failures with a stronger backend, and marks what it still cannot read. A separate verify path audits any other extractor's output against the source PDF for pages that were silently dropped.

What you get

  • PDFs converted to Markdown, JSON or RAG-ready chunks — convert_pdf, extract_streaming, batch_convert
  • A PDF analysed and its metadata read before extraction — analyze_pdf, get_pdf_metadata
  • Structured extraction against a schema or preset (invoice, receipt, contract, resume, paper) — extract_structured
  • Per-page routing across built-in backends — PyMuPDF, OpenDataLoader, RapidOCR, Docling, Surya, Marker, Mistral OCR — with a BYOK LLM fallback
  • An audit that re-extracts pages the first backend got wrong, and flags what it still cannot read rather than dropping it
  • Certification of any extractor's output against the source PDF, returning a verdict, the silently dropped page numbers, and a coverage score
  • First-class Arabic, Persian, Urdu and Hebrew handling with automatic RTL reordering

Requirements

pip install pdfmux for digital PDFs; the README strongly recommends pdfmux[ocr] for any real batch, since almost every directory has at least one scan that returns empty text without OCR. Further extras add table extraction ([tables]), neural extraction ([marker]) and specific LLM providers. The MCP server runs with pdfmux serve (stdio or --http), or via the npm package pdfmux-mcp with npx -y pdfmux-mcp. Python 3.11+. The pyproject names the package pdfmux at 1.8.7. An optional GEMINI_API_KEY enables a paid Gemini fallback for low-confidence pages — pdfmux runs fully locally without it. MIT licensed; the certify path is patent-clean and reuses only the shipped audit layer.

Setup effort

One command — pip install pdfmux