doc2md-lite

io.github.tidybytetools由 GitHub 帳號 tidybytetools 發布v1.1.1更新於 Nov 5, 2026

Turn local text PDFs and HTML files into clean Markdown, tables kept. Runs on your computer.

已驗證STDIO僅桌面檔案與儲存知識與記憶

概覽

AI 產生的概覽

本機 MCP 伺服器,把含文字的 PDF 或已儲存的 HTML 檔轉成乾淨的 Markdown,表格保留為 Markdown 表格。

可以做什麼
  • 把本機含文字的 PDF 或已儲存的 .html 檔轉換為 Markdown 文字
  • 表格保留為 Markdown 表格,首列作為表頭
  • 保留標題、段落、清單,HTML 另保留粗體、斜體、連結與程式碼區塊
  • 可選擇把結果寫入指定的輸出路徑,並回傳該路徑而非文字
適用情境
適合需要讓助理把本機文件當成文字讀取、引用、摘要或建立索引的情境,例如在 RAG 切塊或貼進提示詞之前。僅適用於有真實文字層的 PDF 與已儲存的 HTML 檔,且一次只處理一個檔案。
執行需求
以 PyPI 套件形式透過 uvx 在本機以 stdio 執行,需要安裝 uv,並要求 Python 3.10 以上版本。不需要 API 金鑰或帳號。檔案從本機路徑讀取,助理需能存取這些路徑。
安裝前請注意
沒有 OCR:掃描檔或純圖片 PDF 頁面會被略過,雙欄 PDF 可能欄位混在一起。它不會下載網頁,需先儲存頁面。一次只處理一個檔案,不支援 .docx、資料夾、頁碼範圍或加密 PDF。若指定輸出路徑,會在該處寫入檔案。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 doc2md-lite,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[Tidy Byte Tools]

doc2md-lite

[License: MIT] [Python 3.10+] [MCP server] [MCP Registry] [PyPI downloads] [Glama score] [Action test]

Free. No API key. Runs on your own computer, so your files stay with you.

A tool that turns a text PDF or a saved web page (.html) into clean Markdown. Tables stay real Markdown tables. Need Word files, chunks for AI search (RAG), whole folders or page ranges? The paid version does that: doc2md on Gumroad

Runs on your own computer, so your files are never uploaded anywhere. MIT license. Python 3.10 or newer, on Windows, Mac and Linux.

Install

pip install doc2md-lite

Or use pipx, which keeps it in its own space:

pipx install doc2md-lite

Want the newest code from GitHub instead?

pip install git+https://github.com/tidybytetools/doc2md-lite

Use it

doc2md-lite report.pdf                 # writes report.mddoc2md-lite page.html -o page.mddoc2md-lite report.pdf -o -            # print the Markdown on screendoc2md-lite report.pdf --tables text   # also find tables with no border lines

Example run:

Saved: report.md  (4 headings, 1 tables)

What you get from a PDF:

# Spring Store Report
Our team checked every store in March. Most stores met the new goal...
## Sales by region
| Region | Stores | Sales || --- | --- | --- || North | 12 | $48,200 || South | 9 | $39,950 |

What it keeps: headings (found by font size and bold in PDFs), paragraphs, bullet and numbered lists, tables, and in HTML also bold, italic, links and code blocks. From web pages it drops scripts, styles, menus and footers.

When you run it in a terminal it ends with one short line about the paid version. --quiet turns it off, and it never shows when output is piped or redirected.

Known limits

  • Scanned PDFs. Pages that are just an image (no text layer) are skipped, and the tool tells you which ones.
  • Headings in PDFs are a best guess from font size and bold. Odd layouts may need a quick fix.
  • Two-column PDFs (like science papers) may mix the columns.
  • One file at a time. No folders, no page ranges, no Word files, no RAG chunks. The paid version has those.
  • Files only. It does not download web pages. Save the page first.

Lite vs paid

lite (free)doc2md
Text PDF and HTML to Markdownyesyes
Tables kept as Markdown tablesyesyes
Word (.docx), with bold, italic, links and listsnoyes
RAG chunks (JSONL with page, heading path, size and overlap)noyes
Whole folders, sub-folders toonoyes
Page ranges and password-protected PDFsnoyes

Other good free tools

Pick what fits you. MarkItDown reads many more file types. pandoc is great for Word and HTML but does not read PDFs. pymupdf4llm is fast on PDFs but uses the AGPL license. doc2md-lite is small, MIT, keeps PDF tables as tables, and has an MCP server built in.

Use it with your AI app (MCP)

There is a small free MCP server built in. It gives your AI app one tool, convert_to_markdown. No API key or account is needed. It needs uv, which gives you the uvx command.

Run it by hand to check it starts (it waits quietly for an app to talk to it):

uvx --from doc2md-lite doc2md-lite-mcp

Shorter way to start the same server: uvx doc2md-lite mcp.

Pick your app below and copy the block. Restart the app after you save.

Claude Desktop

Open Settings > Developer > Edit Config. That opens claude_desktop_config.json. Add this:

json
{  "mcpServers": {    "doc2md-lite": {      "command": "uvx",      "args": ["--from", "doc2md-lite", "doc2md-lite-mcp"]    }  }}

If Claude says it can't find uvx, run which uvx (Mac/Linux) or where uvx (Windows) and put that full path in "command".

Cursor

Put the same block in ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):

json
{  "mcpServers": {    "doc2md-lite": {      "command": "uvx",      "args": ["--from", "doc2md-lite", "doc2md-lite-mcp"]    }  }}

VS Code

VS Code uses servers, not mcpServers. Put this in .vscode/mcp.json in your project, or run MCP: Open User Configuration to use it everywhere:

json
{  "servers": {    "doc2md-lite": {      "type": "stdio",      "command": "uvx",      "args": ["--from", "doc2md-lite", "doc2md-lite-mcp"]    }  }}

Or add it with one command:

code --add-mcp '{"name":"doc2md-lite","type":"stdio","command":"uvx","args":["--from","doc2md-lite","doc2md-lite-mcp"]}'

Cline

In the Cline panel, click the MCP Servers icon, open Configure, then click Configure MCP Servers. Add this inside mcpServers:

json
{  "mcpServers": {    "doc2md-lite": {      "command": "uvx",      "args": ["--from", "doc2md-lite", "doc2md-lite-mcp"],      "disabled": false,      "autoApprove": []    }  }}

Codex

One command:

codex mcp add doc2md-lite -- uvx --from doc2md-lite doc2md-lite-mcp

Or add this to ~/.codex/config.toml:

toml
[mcp_servers.doc2md-lite]command = "uvx"args = ["--from", "doc2md-lite", "doc2md-lite-mcp"]

Gemini CLI

This repo is also a Gemini CLI extension. Install it with:

gemini extensions install https://github.com/tidybytetools/doc2md-lite

Tool: convert_to_markdown(path, tables="lines", output_path=""). It returns the Markdown text. If you set output_path, it saves the file there and returns the path instead.

Use it in GitHub Actions

Turn the PDFs and web pages in your repo into Markdown on every push. Markdown is easy to search, easy to read in a pull request, and easy for AI tools to use.

yaml
name: Docs to Markdownon: [push, pull_request]permissions:  contents: readjobs:  markdown:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v7      - uses: tidybytetools/doc2md-lite@v1        with:          files: docs/**/*.pdf          output-dir: markdown          artifact-name: docs-markdown   # download the .md files from the run page

Keep Markdown copies in sync. Do you commit a .md copy next to each PDF? Use check mode. The step fails, on the right file, when a copy is missing or out of date. It never writes anything in check mode.

yaml
      - uses: tidybytetools/doc2md-lite@v1        with:          files: docs/**/*.pdf          check: "true"

To make the copies, run doc2md-lite your.pdf on your computer, or run the action without check and commit what it wrote. Use the same doc2md-lite version in both places so the output matches. The action installs fixed versions of pdfplumber and Beautiful Soup, so the same file always gives the same Markdown.

It runs the code in the same tag you pick. No API key, no account, and your files are not sent anywhere outside GitHub. It works on Linux, Windows and Mac runners. Scanned PDF pages (just a picture, no text) are skipped with a warning. Set fail-on-scanned: "true" to fail on them instead.

Inputs

InputDefaultWhat it does
files**/*.pdfWhich files to convert (.pdf, .html, .htm). Glob patterns, one per line or split by commas.
excludenode_modules/**, **/node_modules/**, vendor/**Patterns to skip.
output-dir(empty)Folder for the Markdown. It copies the folder layout. Empty saves each .md next to its file.
tableslinesPDF tables: lines (with borders), text (also lined up by spaces), or off.
checkfalseOnly check. Fail if a Markdown copy is missing or out of date.
fail-on-scannedfalseFail when a PDF has scanned pages with no text.
fail-if-no-filestrueFail when no files match.
artifact-name(empty)If set, upload the Markdown as an artifact with this name. Needs output-dir.
python-version(empty)Python to set up. Empty uses the runner's Python (3.10 or newer).

Outputs

OutputWhat it is
filesHow many PDF and HTML files matched.
convertedHow many were converted (or checked) with no errors.
changedHow many Markdown files are new or changed. In check mode, how many are missing or out of date.
scanned-filesHow many PDFs have scanned pages.
output-dirThe output folder.

The run page also gets a short report with one row per file: where the Markdown went, and how many headings and tables it found.

For AI agents

  • Use when: you have a local PDF with real text (you can select the words) or a saved HTML file, and you want Markdown to read or store.
  • Don't use when: the PDF is a scan, the file is .docx, or you need many files or chunks with page numbers. Use the paid version for those.
  • Input: a file path, plus optional tables (lines, text, off).
  • Output: Markdown text. Tables are Markdown tables with the first row as the header.
  • CLI exit code is 0 on success and 1 on error (message on stderr, or {"ok": false, "error": ...} with --json). See also llms.txt.

Python

python
from doc2md_lite import convertmd, info = convert("report.pdf")   # info: type, tables, headings, scanned_pages

Tests

pip install pdfplumber beautifulsoup4 reportlab "mcp<2"python3 -m unittest discover tests

License

MIT. See LICENSE.

來源:README.md,提交 99e9efe

工具

1

convert_to_markdown

Convert PDF or HTML to Markdown

Turn a local text PDF or saved HTML file into clean Markdown. Use this when you want to read, quote, summarize or index a document as text, for example before RAG chunking or pasting into a prompt. Tables are kept as Markdown tables. Do not use it for scanned PDFs or photos (there is no OCR), for live web URLs (save the page as .html first), or when you only need the tables as CSV data (use a PDF table extractor instead). path: full path to a .pdf or .html file on this computer. tables: PDF tables. "lines" (default) finds tables with border lines, "text" also tries tables lined up by spaces, "off" gives plain text. output_path: optional. If set, the Markdown is saved there and that path is returned. An existing file at that path is replaced. If empty, nothing is written and the Markdown text is returned. Tables come back as Markdown tables. Scanned (image-only) PDF pages have no text and are skipped.

輸入參數path必填tablesoutput_path

版本歷史

2
  1. v1.1.1最新Nov 4, 2026
  2. v1.0.0Nov 4, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分