Repository avatar
Other Tools
v0.3.0
active

any2llm

io.github.ahmetemreapo/any2llm

Read local PDF, Office, EPUB, and code files as Markdown with PDF page numbers for citations.

Documentation

any2llm

any2llm turns a folder of PDFs, Office files, and code into Markdown that an AI chat can cite page by page.

Three delivery documents become two Markdown attachments. A local chat cites the original PDF page, which the demo shows for verification.
pipx install any2llm
any2llm demo

PyPI Python 3.11+ MCP Registry Platform compatibility MIT license

Quick start · Examples · Claude and Cursor (MCP) · Docs · Türkçe

Why any2llm?

AI chats read documents well, but it is hard to check where an answer came from. Most converters drop page numbers, so the chat can't cite them.

  • Each PDF fragment carries its source page number, so you can check the answer against the original page.
  • One run handles a mixed folder: PDF, Word, PowerPoint, Excel (values and formulas), EPUB, HTML, CSV, Markdown, and source code.
  • Large folders are split into batches that fit your chat's context window, and the prompt tells the chat how to read them in order.
  • You can attach the output in any chat, pipe it into a CLI, or connect Claude and Cursor through MCP.
  • Everything runs on your computer. Credential files are skipped, likely secrets are flagged, and broken, encrypted, or binary files are reported instead of crashing the run.
  • The terminal and the generated prompts come in 11 languages.

People use it for supplier offers and spreadsheets, contract drafts, research papers, course material, books, and codebases. Unlike MarkItDown, Docling, Pandoc, or Repomix, it keeps PDF page numbers inside the chat attachment and writes a prompt that asks for citations. See the comparison for details.

Quick start

  1. Run any2llm ./my-documents. With uv you can skip the install and run uvx any2llm ./my-documents. See installation help for Windows, macOS, and Linux.
  2. Pick your files. All readable files start checked. Press Enter to continue.
  3. Attach the numbered .md files from _llm_pack/ and paste the prompt that's already on your clipboard. Then check the cited pages.
WhereYou runYou get
Any AI chatany2llm ./docsNumbered Markdown attachments and a citation prompt on your clipboard
Claude, Cursor, and MCP appsclaude mcp add any2llm -- uvx any2llm mcp ~/DocumentsThe AI reads your folder itself, on request
Scripts and pipesany2llm ./docs --stdout | llm "List every deadline"One Markdown stream on standard output

Try it without installing

Ready-made output files are in examples/: a work example with delivery dates and a student example with midterm material. Attach one to your AI chat, ask the question listed there, and compare the answer with the original PDF page.

Use it with any AI chat

any2llm "./documents"          # keep the quotes if the path has spaces
any2llm ./documents -r         # include subfolders
any2llm ./documents --task "Find every payment deadline and who owes it"
  1. On the first run, choose your language, a detail level, and whether to open the output folder.
  2. Select files, then attach the numbered Markdown files from _llm_pack/ and paste the prompt (also saved as PROMPT.txt).
  3. If there are several batches, follow the upload order the terminal prints and send the continuation word between them in the same chat.

[!NOTE] Models don't always follow multi-batch instructions. If one doesn't move on, resend your last message and name the next batch. Check important citations against the original.

Use it in Claude, Cursor, and other MCP apps

any2llm mcp runs a local Model Context Protocol server. The AI gets two read-only tools: list_documents shows what a folder contains, and read_documents returns Markdown with PDF page tags, in batches when the content is large. The server never reads outside the folder you give it.

Claude Code:

claude mcp add any2llm -- uvx any2llm mcp ~/Documents
Claude Desktop, Cursor, Windsurf, and other apps with an mcpServers file
{
  "mcpServers": {
    "any2llm": {
      "command": "uvx",
      "args": ["any2llm", "mcp", "/Users/you/Documents"]
    }
  }
}

If the app can't find uvx, use its full path (which uvx on macOS and Linux, where uvx on Windows). With a pipx install, use "command": "any2llm" and "args": ["mcp", "/Users/you/Documents"]. Add --ocr or --ocr-lang tur after the folder to read scanned pages.

Then ask: "Read the contracts folder and list each termination clause with its PDF page."

Use it in scripts and pipes

--stdout prints one unsplit pack to standard output and sends progress and warnings to standard error. It selects every readable file and writes nothing to disk.

any2llm ./contracts --stdout | claude -p "Which contract renews automatically? Cite the PDF page."
any2llm ./papers -r --stdout | llm "Compare the sample sizes across these papers"
any2llm ./notes --stdout | pbcopy        # macOS (Linux: wl-copy or xclip, Windows: clip)
any2llm ./notes --stdout > notes-pack.md
All command-line options
OptionEffect
-r, --recursiveInclude subfolders
-y, --yesSelect every readable file without prompting
--stdoutPrint one unsplit pack to standard output
--task TEXTPut your question into the generated prompt
--max-tokens INTToken budget per batch
--lang CODETerminal and prompt language: en, zh, hi, es, fr, ar, bn, pt, ru, ur, tr
--ocr, --ocr-lang LANGOCR PDF pages without extractable text (for example eng+tur)
--exclude GLOBSkip matching paths (repeatable). Root .gitignore rules also apply.
-o DIR, --output DIROutput folder (default _llm_pack)
--detailsList every skipped file
--plainNumbered menus instead of checkboxes
--no-openDon’t open the output folder
--include-sensitiveInclude files that look like credentials
setup, demo, mcp [DIR]Change settings, run the demo, or start the MCP server

Full reference: docs/SPEC.md

What gets extracted

FormatWhat you get
PDFText per physical page in <page> tags. Pages without text are flagged, and optional OCR can read them.
Word (.docx)Paragraphs and tables in document order
PowerPoint (.pptx)Text and tables, slide by slide
Excel (.xlsx)Visible sheets as tables, with cached values and formulas
EPUBChapters in reading order. DRM-protected books are skipped.
HTMLSaved pages as readable text with headings, lists, and tables. Templates stay as code.
Text and codeMarkdown, CSV, JSON, YAML, and source code, with whitespace preserved

Charts, images, and page layout aren’t extracted. Check the original when an answer depends on a visual.

Privacy, limits, and OCR

  • Privacy: extraction and OCR run locally. tiktoken may download its vocabulary on first use. Common credential files (*.pem, id_rsa, credentials*, …) are skipped, and likely secrets in extracted text are flagged but left in the output, so review it before uploading. See the security policy.
  • Limits: up to 32 MiB per file, 500 pages per PDF, 128 MiB uncompressed per Office or EPUB archive, and 120 seconds of extraction per file. Your chat’s attachment and context limits still apply.
Set up OCR for scanned PDFs

Install Poppler (pdftoppm) and Tesseract with the language data you need, and add their folders to PATH as absolute paths. Use --ocr for English or --ocr-lang to choose installed languages, for example --ocr-lang eng+tur. OCR only runs on PDF pages without usable text, and recognized pages are marked in the batch. Check important names and numbers against the scan.

Contributing

Bug reports, examples, translations, and code are all welcome. Start with the contributing guide or an issue labeled good first issue.

If any2llm saved you time, a star helps other people find it.

License

MIT

PYPI
any2llm
Install Command
pip install any2llm
Runtime: uvx