Skip to main content

PDF to Markdown engine for LLMs. Smart table extraction, OCR, MCP server for AI IDEs.

Project description

thinkpdf

Convert PDFs to clean Markdown for LLMs. Includes MCP Server for AI coding assistants.

Python 3.10+ License: AGPL v3 PyPI

Features

Feature Description
Smart Detection Auto-chooses best engine for each PDF
High Table Accuracy Uses IBM Docling's TableFormer
Fast Mode pdfmd for simple documents
Smart Cache Never reprocess the same PDF
MCP Server For AI coding assistants

Installation

pip install thinkpdf

For maximum quality (requires GPU):

pip install thinkpdf[docling]

Usage

MCP Server

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "thinkpdf": {
      "command": "python",
      "args": ["-m", "thinkpdf.mcp_server"]
    }
  }
}

Then just ask:

"Read the PDF at D:\docs\manual.pdf and explain it"

Python API

from thinkpdf import convert

# Simple conversion
markdown = convert("document.pdf")
print(markdown)

# With output file
convert("document.pdf", "output.md")

CLI

thinkpdf document.pdf -o output.md

How It Works

  1. Analyzes PDF complexity (tables, scans, simple text)
  2. Chooses best engine (Docling for complex, pdfmd for simple)
  3. Checks cache (instant if already converted)
  4. Converts to structured Markdown
  5. Caches result for next time

MCP Tools

When using as MCP server:

Tool Description
read_pdf Convert and return content directly
convert_pdf Convert and save to file
get_document_info Get PDF metadata

Requirements

  • Python 3.10+
  • PyMuPDF (included)
  • Docling (optional, for best quality)

License

AGPLv3 - Open source license. Commercial use requires sharing source code.

Project details


Download files

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

Source Distribution

thinkpdf-1.0.1.tar.gz (67.3 kB view details)

Uploaded Source

Built Distribution

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

thinkpdf-1.0.1-py3-none-any.whl (74.4 kB view details)

Uploaded Python 3

File details

Details for the file thinkpdf-1.0.1.tar.gz.

File metadata

  • Download URL: thinkpdf-1.0.1.tar.gz
  • Upload date:
  • Size: 67.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for thinkpdf-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2ca7393e8ecf9f31086fe18f08bfc7165ec99b1d6f2e2a9150ab3790c1ddcf4b
MD5 8f519465a7666880faccb2dcf0860da7
BLAKE2b-256 121fd428bd9e83ba46f06536a35f462833374cecfbacc21375e2d38c443eaff7

See more details on using hashes here.

File details

Details for the file thinkpdf-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: thinkpdf-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 74.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for thinkpdf-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 057233c1a04330efc575a5005595f4ad8b1f0ee7b1209926819535c826c1115e
MD5 83ccdb183bc8ee7a32800ab3ee6d1650
BLAKE2b-256 175f8e97f3c5e321ad25775dc8fad6b7f74fa9a4d8378d7251c74a0aaa2b08c8

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