# PDF Decompiler (`pdf-decompiler` v4.0.1) > Apache-2.0 local-first PDF evidence, cited retrieval, and verifiable claim-gate engine for AI agents. Ships as a CLI, Agent Skill, and 10-tool stdio MCP server on Node.js 22 / 24 (CPU-only, zero AGPL/GPL dependencies). ## Summary PDF Decompiler uses Chromium PDFium WASM (`@hyzyla/pdfium`) and PDF.js to extract generation-bound, coordinate-cited text, tables with verbatim unit headers (`(in millions)`, `(in thousands)`), and clipped visual proof crops locally on CPU. It includes a two-stage Verifiable Claim Gate (`pdf_verify_claim`) with offline deterministic checks and HMAC-SHA256 signed attestations. ## Quickstart ```bash npx -y pdf-decompiler inspect report.pdf npx -y pdf-decompiler search report.pdf "Revenue" --page npx -y pdf-decompiler read report.pdf --pages 1-2 --markdown --compact npx -y pdf-decompiler crop report.pdf 1 --bbox 40,40,400,250 --out proof.png npx -y pdf-decompiler verify report.pdf --claim "FY2025 revenue was $42.5 million" --elements table:12:1 --provider auto npx -y pdf-decompiler mcp --allow-root /path/to/pdfs ``` ## 10 MCP Tools (`SCHEMA_VERSION = "4.0.0"`) - `pdf_open`: Open a local or HTTPS PDF and return generation-bound `documentId` + `extractionFingerprint`. - `pdf_document_info`: Return metadata, outline, page classifications, counts, warnings, and cache status. - `pdf_search`: Offline inverted-index BM25, phrase, semantic, or hybrid search with compact citations (`pageId`, `elementId`, `bbox`) and `textCoverage` completeness signals. - `pdf_search_documents`: Ranked cited search across 2-8 open PDFs using shared BM25 statistics. - `pdf_search_folder`: Bounded cited search across up to 32 PDFs in an allowed local directory. - `pdf_get_pages`: Budgeted cited page retrieval in `structured` (`detail: "compact"` saves ~50% tokens) or `markdown` format. - `pdf_get_element`: Resolve a single element or paginated table slice with verbatim `tableContext` (`title`, `units`, canonical `headers`, `sourceBbox`). - `pdf_render_page`: Pooled, clipped PDFium visual proof rendering (`png`/`jpeg`, `resource` URI or bounded `inline`). - `pdf_verify_claim`: Stage 1 deterministic local math/unit/year/sign gate + opt-in Stage 2 decision models returning `supported`/`unsubstantiated`/`contradicted` + signed HMAC-SHA256 attestation. - `pdf_close`: Release active handles by `{ sourceId }` or `{ documentId, extractionFingerprint }`. ## CLI Subcommands - `inspect ` - `search [--page] [--phrase] [--json]` - `read --pages 1-2 [--markdown] [--compact|--full]` - `table [--compact|--full]` - `crop [--bbox x,y,w,h] [--format png|jpeg] [--out file]` - `verify --claim "..." --elements id1,id2 [--provider auto|deterministic|jev|gemini-decisions|openai-compat] [--allow-remote-verify]` - `gate --input file.json [--claim "..."] [--max-age-ms N]` - `setup --client [--allow-root path]` - `ocr install [--dir path]` - `doctor [--allow-root path]` - `mcp [--allow-root path]` ## Verifiable Claim Gate Overview - Stage 1 (0-1 ms, offline): Resolves canonical `elementIds`, enforces table unit scale (`thousands`/`millions`/`billions`) with EPS/per-share/ratio row exemption, parses accounting negatives `(15.0)`, checks currencies, validates years, checks negation polarity, and checks derived math (`sum`, `difference`, `ratio`, `share_percent`, `pct_change`). - Stage 2 (explicit opt-in only): Supports TypeSafe AI `Jev` (`TYPESAFE_API_KEY`), `gemini-decisions`, and `openai-compat`. `provider: "auto"` stays offline deterministic unless `PDF_DECOMPILER_VERIFY_ALLOW_REMOTE=1` or `--allow-remote-verify` is set. - Attestation & Harness Enforcement: Domain-separated HMAC-SHA256 verified offline via `verifyAttestation()` (`pdf-decompiler/verify`), `pdf-decompiler gate`, or `examples/hooks/verify-claims-hook.mjs`. - Two-stage development suite: 12/12 correct with the optional Jev reviewer. Offline table stress test: 1/9 true claims supported and 2/11 false or unsubstantiated claims incorrectly supported. See `docs/CLAIM-BINDING-EVALUATION.md`. - Given-evidence FinDVer diagnostic on 24 numeric claims: offline verifier accepted 3/12 true and 9/12 false. See the FinDVer section of `docs/CLAIM-BINDING-EVALUATION.md`. - Scientific PDF localization: on 24 held-out SciEGQA papers, the top Decompiler citation found 1 compact region and a PyMuPDF caption-linked baseline found 11. See `docs/SCIEGQA-LOCALIZATION.md`. ## Website Pages - Overview: https://noobieisgod.github.io/pdf-decompiler-mcp/ - MCP Setup Guide: https://noobieisgod.github.io/pdf-decompiler-mcp/mcp-setup.html - Claim Gate Deep Dive: https://noobieisgod.github.io/pdf-decompiler-mcp/claim-gate.html - Sitemap: https://noobieisgod.github.io/pdf-decompiler-mcp/sitemap.xml ## Repository & Package - GitHub: https://github.com/noobieisgod/pdf-decompiler-mcp - npm: https://www.npmjs.com/package/pdf-decompiler - Architecture docs: https://github.com/noobieisgod/pdf-decompiler-mcp/blob/main/docs/ARCHITECTURE.md - Tool reference: https://github.com/noobieisgod/pdf-decompiler-mcp/blob/main/docs/TOOLS.md - Client compatibility: https://github.com/noobieisgod/pdf-decompiler-mcp/blob/main/docs/CLIENT-COMPATIBILITY.md - Verification benchmark: https://github.com/noobieisgod/pdf-decompiler-mcp/blob/main/docs/VERIFICATION-BENCHMARK.md