Skip to main content

pdf-mcp

Python MCP License

Let your AI agent pull text and tables out of PDFs. An MCP server for invoices, reports, and statements, where the data lives in tables the model can't read from a pasted blob.

When you paste a PDF into a prompt, the columns collapse and the table turns to mush, so the model guesses at the numbers. This extracts the actual table structure with deterministic code, so the agent gets clean rows and never invents a cell.

What it turns a PDF into

A PDF invoice table like this:

Item     Qty   Price
Widget    3    12.50
Gadget    1    40.00
Bolt     10     0.25

comes back as structured rows (or CSV), not a flattened line of text:

[["Item","Qty","Price"],["Widget","3","12.50"],["Gadget","1","40.00"],["Bolt","10","0.25"]]

The tools it gives an agent

Tool What it does
page_count(path) How many pages the PDF has
extract_text(path, page) Text per page (one page, or the whole doc)
extract_tables(path, page) Tables as rows of cells, each with an honest assessment (looks_clean, warnings) flagging ragged or mostly-empty extractions
table_to_csv(path, page, index) One table as clean CSV text

Quickstart

pip install "pdf-agent-mcp[mcp]"

Add it to your MCP client (e.g. Claude Desktop):

{
  "mcpServers": {
    "pdf": { "command": "pdf-agent-mcp" }
  }
}

Now your agent can answer "pull the line items out of this invoice" by reading the PDF, not guessing.

Also usable from plain Python

from pdf_mcp import extractor

extractor.extract_tables("invoice.pdf")      # {'tables': [{'rows': [...]}], ...}
extractor.table_to_csv("invoice.pdf")        # clean CSV of the first table
extractor.extract_text("report.pdf", page=1)

Tests

python -m unittest discover -s tests     # builds its own test PDF, runs anywhere

License

MIT

Release files for pdf-agent-mcp 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdf-agent-mcp 0.1.2
File Size Uploaded
pdf_agent_mcp-0.1.2.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pdf-agent-mcp 0.1.2
File Interpreter ABI Platform
pdf_agent_mcp-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / pdf_agent_mcp-0.1.2.tar.gz

Download URL pdf_agent_mcp-0.1.2.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f861c2764b478c70d2b67e2e589480045d6ae11c93d8e42043b347c90067e4d9
BLAKE2b-256 checksum
How to use checksums
82711161b1badea14db2434ea773ba0d95f5ab7606a705a9f9e9ec7290a7371b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / pdf_agent_mcp-0.1.2-py3-none-any.whl

Download URL pdf_agent_mcp-0.1.2-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8d1d586c58666db7589a576d7480d9f7f93f55bc11855a57693574132294f26
BLAKE2b-256 checksum
How to use checksums
4c07927d460730007ee9e75d4a9b72e02f6a6d3a81dfe374bb80a93741831364
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page