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
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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf_agent_mcp-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf_agent_mcp-0.1.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file pdf_agent_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: pdf_agent_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for pdf_agent_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4102467507788065813fc3dd2b86659dd2518fc6c93bcba5e110ce743e71621e
MD5 5e9b0731d4b10d11dffae7f8786229bb
BLAKE2b-256 95262bda2c0dec6517564171409969716e1ae265c5f5683216dcc35e894ed6fd

See more details on using hashes here.

File details

Details for the file pdf_agent_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pdf_agent_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for pdf_agent_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c2cb87427fc0cbc8fdc5b53870545b48bdbb8b4eda69e88eff04a283d3a148a
MD5 31d927c0f5835dc44bc568816d26b0e4
BLAKE2b-256 4110a46d22871a5eaf58ff72ebc8bb1f801715e6d06216735de31831fa056f6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page