Skip to main content
Glama
pdf-tables-mcp

pdf-tables-mcp

Want your AI agent to read a folder of supplier invoices or bank statements and tell you what doesn't add up? Start here. pdf-tables-mcp gives Claude, Cursor or any MCP client four read-only tools that turn text-layer invoice and statement PDFs into checked, structured data, without uploading anything.

pdf-tables-mcp

Invoice and bank-statement PDFs to structured, arithmetic-checked data for AI agents. Local and sandboxed.

CI License: MIT Python 3.10+

Real output of pdf-tables-mcp examples/invoices --scan: the same data the agent gets from extract_folder. The example PDFs are synthetic.


Why

Asking a chat model to "read these invoices" usually means uploading PDFs and hoping the numbers it reads back are the ones on the page. This server does the reading with a deterministic parser on your machine, checks the arithmetic (line amounts, subtotal + VAT = total, running bank balances) and hands the agent clean JSON plus a list of what failed the checks. The agent then does what it is good at: explaining, comparing and drafting the follow-up.

Related MCP server: pdfforge

Features

  • 🧾 Invoices: number, date, seller, buyer, currency, subtotal, VAT, total and line items (description, qty, unit price, amount)

  • 🏦 Bank statements: account holder, account, period, opening / closing balance, transactions with debit, credit and balance

  • βœ… Arithmetic checks on every document; mismatches come back as readable issues, not silent numbers

  • πŸ“ Folder tools: one summary row per PDF, invoice totals per currency, flagged and unreadable files; or all line items as one flat table

  • 🚦 No silent empties: every document has a status of ok, NO_ROWS or NEEDS_REVIEW; documents where no line items or transactions were found are listed separately in no_rows, so an agent never mistakes an empty extraction for a clean one

  • πŸ”’ Sandboxed and read-only: only folders you pass on the command line are reachable (.. and symlink escapes are refused), 25 MB and 200-file limits, nothing is written

  • πŸ–₯️ CLI too: --scan for a terminal summary, --call TOOL to see the exact JSON a tool returns

  • πŸͺΆ Parser: invoice-pdf-extractor v0.2.0, pinned to a commit (pure Python, pypdf); MCP protocol implemented without an SDK

Quick start

pip install git+https://github.com/purkat0301-sys/pdf-tables-mcp
pdf-tables-mcp ~/Invoices --scan
pdf-tables-mcp ~/Invoices        # run as an MCP server on stdio

MCP client config (Claude Desktop, Cursor, VS Code, ...), as in examples/mcp.json:

{ "mcpServers": { "invoices": { "command": "pdf-tables-mcp", "args": ["/path/to/Invoices"] } } }

Then ask, for example: "Which invoices in November don't add up, and what is the total per currency?"

How it works

flowchart LR
    A[AI agent] -->|tools/call| S[pdf-tables-mcp]
    S -->|path check| X{inside allowed folders?}
    X -- no --> E[error returned to agent]
    X -- yes --> P[invoice-pdf-extractor<br/>pypdf text layer]
    P --> C[parse fields, lines,<br/>transactions]
    C --> V[arithmetic checks]
    V --> S --> A

Tool

Input

Returns

list_pdfs

folder, recursive

PDF files and sizes

extract_pdf

path, doc_type, password

full document with lines or transactions and validation_issues

extract_folder

folder, recursive, doc_type

summary rows with status, invoice_totals per currency, flagged (checks failed), no_rows (nothing extracted), failed (unreadable)

invoice_lines

folder, recursive

every invoice line item as one table

What one document looks like (the PDF on the left, the tool result on the right):

Compared with the inspiration

Built on my own invoice-pdf-extractor after looking at general PDF-table MCP servers such as wesseltl/pdf-mcp.

pdf-tables-mcp

wesseltl/pdf-mcp

Focus

invoices and bank statements

any table in PDF and Word documents

Named invoice / statement fields

βœ…

via configurable profiles (per its README)

Arithmetic checks (totals, VAT, balances)

βœ… built in

see project

Folder summary and totals per currency

βœ…

see project

Generic table extraction, Word files

❌

βœ…

Browser app, Excel export

❌ (CLI + JSON)

βœ…

Scanned PDFs (OCR)

❌

❌ (per its README)

Path sandbox

βœ…

see project

If you need any table from any document, use pdf-mcp. If you need "read my invoices and show me the ones that are wrong", use this.

FAQ

Scanned invoices? Not supported: they have no text layer. Run OCR first (for example ocrmypdf in.pdf out.pdf); the tool says so when it meets one.

Which invoice layouts work? Text-layer PDFs with labelled fields (Invoice No, Date, Subtotal, VAT, Total) and line items in rows. Run --scan on your own folder to see before connecting an agent.

Does anything leave my machine? The server makes no network calls. What your MCP client sends to its model is up to the client.

Limitations

  • Layout-based parsing, reliable only on layouts similar to the parser's test samples. Unusual layouts can miss fields; the document is then marked NEEDS_REVIEW or NO_ROWS. Parser benchmark on 11 public real invoices (a development set, not blind): see invoice-pdf-extractor.

  • Text-layer PDFs only; no OCR.

  • Installs its parser from GitHub; not on PyPI yet.

Roadmap

See ROADMAP.md: duplicate-invoice detection, CSV/XLSX export tool (opt-in folder), supplier filter, date-range filter.

By the same author: invoice-pdf-extractor (the parser as a CLI) Β· recon-kit (match invoices to payments) Β· sheets-mcp (read-only SQL over CSV/XLSX) Β· mcp-preflight

Contributing

Issues and pull requests are welcome; a synthetic PDF that parses wrongly is the most useful bug report. pip install -e '.[dev]' && pytest.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Converts PDF bank statements into structured data (Markdown, JSON, CSV, JSONL) with verified transactions and balance checks, enabling agents to audit numbers.
      5
      12 npm
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Lets AI assistants read, search, edit, annotate, sign, redact and OCR PDF files entirely on the local machine, with no uploads and non-destructive writes to new files. It also merges, splits and reorganises pages, fills forms, compares versions to detect tampering, and converts documents between PDF, Word, Excel, images and text, including turning bank statements into spreadsheet rows.
      22
      AGPL 3.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Lets AI assistants and editors read documents on the local machine, turning PDFs, scans, invoices, receipts and bank statements into structured fields, line items and entities over stdio. Runs fully self-hosted with no cloud calls or API keys, so sensitive files never leave the user's machine.
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to convert bank statements and mobile money exports (PDF, scanned PDF/OCR, CSV, TSV, XLSX) into normalized, accounting-checked JSON transactions with confidence scores and alerts, entirely locally with no network calls or document storage.
      MIT