Inspect the source behind a PDF answer.

Search a PDF locally, then retrieve the cited text, table slice, or figure crop. Each citation identifies the physical page and source bounds so you can check the evidence.

npx -y pdf-decompiler inspect report.pdf
Terminal walkthrough showing pdf-decompiler inspect, cited BM25 search, compact Markdown read, and visual proof crop commands
CLI workflow: inspect document structure, run cited BM25 search, read compact Markdown, and crop visual proof.

Works with your existing agent stack

Claude Code OpenAI Codex Claude Desktop VS Code Cursor Windsurf Antigravity

Built for bounded retrieval and verifiable evidence

Every tool response is designed to keep context windows small, citations traceable to an exact document generation, and numbers auditable.

Cited Retrieval

Search and cite without dumping 100 pages into context

pdf_search builds a local inverted index and runs BM25, phrase, semantic, or hybrid queries across pages within a strict token budget. Each hit returns a compact excerpt with pageId, canonical elementId, and displayed-page bbox coordinates in points.

  • Every ID binds to an immutable extractionFingerprint so stale citations fail closed.
  • Unscanned or incomplete pages emit search_text_coverage_incomplete warnings so agents never mistake skipped pages for missing facts.
  • Paginate cleanly with signed cursors instead of truncating mid-sentence.
pdf_search response (compact citation)
{
  "documentId": "doc_01j8k9m2p4",
  "extractionFingerprint": "fp_41_a9f3c20e",
  "textCoverage": { "status": "complete", "indexedPages": 48 },
  "hits": [
    {
      "page": 12,
      "pageId": "page:12",
      "elementId": "table:12:1",
      "score": 11.42,
      "bbox": [48, 162, 540, 318],
      "excerpt": "Consolidated revenue (in millions): FY2025 $42.5"
    }
  ]
}
Clipped PNG rendering from PDFium showing a financial table region extracted via pdf-decompiler crop
Clipped PDFium crop via pdf-decompiler crop or pdf_render_page using the table sourceBbox.

Structured Tables & Visual Proof

Keep table units, headers, and pixel proof intact

Standard text extractors strip surrounding unit captions and merge columns across multi-column pages. pdf_get_element slices rows and columns while preserving tableContext: the verbatim preceding title, unit notes like (in millions) or (in thousands), canonical headers, and a union sourceBbox.

When a dense financial statement or diagram requires visual confirmation, pass sourceBbox directly to pdf_render_page to clip a bounded PNG or JPEG via Chromium PDFium WASM without rendering the entire document.

Claim Verification

Verify every number before your agent answers

Before presenting a dollar figure, percentage, or date, agents call pdf_verify_claim with the claim string and 1 to 12 cited elementIds. Stage 1 runs offline in 0 to 1 ms on CPU to check years, currencies, accounting negatives like (15.0), table unit scales (with per-share/EPS exemption), and derived arithmetic.

Optional Stage 2 semantic scoring supports TypeSafe AI Jev, gemini-decisions, and openai-compat. Every result emits a domain-separated HMAC-SHA256 attestation verified offline via verifyAttestation(), pdf-decompiler gate, or the Stop Hook.

Read the Claim Gate architecture and attestation spec
pdf_verify_claim verdict + HMAC attestation
{
  "verdict": "supported",
  "stage": "deterministic",
  "latencyMs": 0.4,
  "checks": {
    "years": "matched",
    "currency": "USD",
    "scale": "millions",
    "arithmetic": "exact"
  },
  "attestation": {
    "keyId": "local-hmac-v1",
    "claimSha256": "8c1f9a04e2...",
    "elementIds": ["table:12:1"],
    "hmacSha256": "3b7d41c89e..."
  }
}

Core engineering capabilities

Designed for local CPU execution, strict workspace boundaries, and predictable token accounting.

Apache-2.0 PDFium + PDF.js

Powered by Chromium PDFium WASM and PDF.js with zero AGPL or GPL dependencies in the extraction or rendering pipeline.

Local CPU OCR

Triggers Tesseract CLI by default for scanned or unmapped-font pages, or opt into pure-Node ONNX PP-OCRv5 with SHA-256-pinned models.

Deny-by-default security

Requires explicit --allow-root paths, enforces monotonic MCP roots/list confinement, and blocks IPv4/IPv6 SSRF via DNS pinning.

CLI, Skill & 10-tool MCP server

One npm package provides a one-shot terminal CLI, an Agent Skill, and a schema-versioned 10-tool stdio MCP server for Node.js 22 and 24.

Multi-document & folder search

Rank across 2 to 8 open documents with shared BM25 statistics via pdf_search_documents, or scan up to 32 PDFs in an allowed directory.

Token budgets & signed cursors

Compact structured mode cuts token volume by roughly 50%, while signed pagination cursors keep large page reads and table slices bounded.

Set up in under a minute

One package (pdf-decompiler) ships the CLI, the 10-tool stdio MCP server, and an Agent Skill. Select your client below.

CLI

bash
# Inspect structure, outline, and table counts
npx -y pdf-decompiler inspect report.pdf

# Cited BM25 search (one excerpt per page)
npx -y pdf-decompiler search report.pdf "Revenue" --page

# Read target pages as compact cited Markdown
npx -y pdf-decompiler read report.pdf --pages 1-2 --markdown --compact

# Render a clipped visual proof crop
npx -y pdf-decompiler crop report.pdf 1 --bbox 40,40,400,250 --out proof.png

# Verify a factual claim locally against a cited element
npx -y pdf-decompiler verify report.pdf --claim "FY2025 revenue was $42.5 million" --elements table:12:1 --provider auto

Claude Code

bash
claude mcp add pdf-decompiler -- npx -y pdf-decompiler mcp --allow-root ./pdfs

Codex

bash (or ~/.codex/config.toml)
codex mcp add pdf-decompiler -- npx -y pdf-decompiler mcp --allow-root ./pdfs

Claude Desktop

claude_desktop_config.json
{
  "mcpServers": {
    "pdf-decompiler": {
      "command": "npx",
      "args": ["-y", "pdf-decompiler", "mcp", "--allow-root", "/path/to/pdfs"]
    }
  }
}

VS Code

.vscode/mcp.json (uses "servers" and "type": "stdio")
{
  "servers": {
    "pdf-decompiler": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "pdf-decompiler", "mcp", "--allow-root", "${workspaceFolder}/pdfs"]
    }
  }
}

Cursor

.cursor/mcp.json
{
  "mcpServers": {
    "pdf-decompiler": {
      "command": "npx",
      "args": ["-y", "pdf-decompiler", "mcp", "--allow-root", "/path/to/pdfs"]
    }
  }
}

Need Windsurf, Antigravity, pdf-decompiler setup, or pdf-decompiler doctor? See the full MCP Setup Guide.

Research evaluations

Reproduce where citations support an answer and where the source check breaks down.

Find and inspect figure evidence

On 24 held-out SciEGQA papers, Decompiler's top citation localized 1 compact region. A caption-linked PyMuPDF baseline localized 11. Manual review found cases where a caption answered the question and cases where a tight crop lost the caption.

SciEGQA comparison and reproduction

Check row, year and scale

On 24 FinDVer claims with annotated evidence supplied, the offline check accepted 3 of 12 true claims and 9 of 12 false claims. A separate test on a fictional report exposed wrong-row and wrong-year matches. Both experiments are reproducible.

Table claim audit and reproduction

Reproduce a citation and crop with the offline sample report demo. Browse the historical extraction results.

Frequently asked questions

How can I check a number against its source?

Use citation bounding boxes to inspect the text, table or figure. The local claim gate screens for numeric and lexical matches and can flag unit, year and sign mismatches. Check the cited source for the correct row, year and entity.

Does PDF Decompiler send my PDFs to the cloud?

No. Extraction, indexing, search, rendering, OCR, and Stage 1 claim verification run locally on CPU. Filesystem access is deny-by-default unless you specify --allow-root, HTTPS fetches use DNS-pinned SSRF guards and require explicit opt-in, and Stage 2 remote verification stays disabled unless explicitly requested.

How is PDF Decompiler different from pypdf or PyMuPDF?

PDF Decompiler packages search, bounded retrieval and generation-bound citations as an MCP workflow. PyMuPDF provides native text, geometry and rendering APIs that can be used to build evidence retrieval pipelines. The research evaluation compares these approaches on scientific papers.

Does it support scanned PDFs and OCR?

Yes. Pages with scanned images or unmapped fonts automatically trigger local OCR via Tesseract CLI by default. You can also opt into pure-Node CPU PP-OCRv5 by installing onnxruntime-node and running npx -y pdf-decompiler ocr install.

Which MCP clients are supported?

Any standard stdio MCP client works with the 10-tool server (schema version 4.0.0), including Claude Code, Claude Desktop, OpenAI Codex, VS Code, Cursor, Windsurf, and Antigravity. Run npx -y pdf-decompiler setup --client <name> or check the MCP Setup Guide.

Ready to give your agents reliable PDF citations?

Connect the 10-tool stdio MCP server to your workspace or inspect the Apache-2.0 source code directly on GitHub.