
PDF Card MCP
io.github.velyan由 GitHub 帳號 velyan 發布v0.1.2更新於 Oct 25, 2026
Local-first MCP server + CLI that turns PDFs into source-linked, card-based HTML readers.
概覽
本地優先的 MCP 伺服器與命令列工具,把本機 PDF 轉成可攜、帶來源連結的 HTML 卡片閱讀器,支援筆記、螢光標記與靜態發佈。
- 可以做什麼
- 把本機 PDF 路徑轉換為獨立 HTML 閱讀器,內嵌樣式、頁面影像以及表格、圖表、公式的裁切圖,並產生卡片、頁面與警告的清單檔。用產生的閱讀器驗證筆記與螢光標記的附屬檔。從既有閱讀器與選用註解發佈唯讀靜態 HTML 檔案或目錄包。可選擇讓宿主模型挑選受限樣式標記或建議卡片邊界潤飾,同時保留原文。
- 適用情境
- 適合需要閱讀、引用或檢視密集文字層 PDF 的情境,希望把長文件拆成較小的帶來源連結卡片,並忠實保留表格、圖表與公式的影像裁切。也適合把自行撰寫的筆記與螢光標記匯出為 Markdown,或分享唯讀的帶註解閱讀器。
- 執行需求
- 以本機 Python 程序透過 stdio 執行;建議方式透過 uv 安裝 pdf-card-mcp 套件,Claude Desktop 安裝包會自行管理 Python。未宣告驗證、環境變數或請求標頭。掃描版 PDF 需要選用 OCR 支援,更強的表格偵測需要選用的 gmft 擴充,容器使用需掛載 PDF 與輸出目錄。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 PDF Card MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
PDF Card MCP
[CI] [Source Install] [Python 3.11-3.13] [License: MIT] [MCP Registry]
PDF Card MCP is a local-first MCP server and CLI for turning dense local PDFs into portable, source-linked HTML readers. An MCP host can ask it to convert a PDF path, validate notes/highlights, or publish a static annotated reader bundle. The converter preserves source text, renders source pages for verification, crops detected tables, figures, and display formulas as images, derives safe reader styling from the original PDF palette, and writes a standalone HTML file that can be moved across devices without losing assets.
Default conversion runs locally and does not require a hosted service. Optional MCP sampling is deliberately bounded: the host model may choose validated style tokens or suggest card-boundary polish operations, but raw CSS and source-text rewrites are rejected.
The default reader is designed for comfortable reading: large type, small cards, search, section navigation, next/previous controls, keyboard navigation, a font-size slider, and source-page previews.
PDF Card MCP is meant for PDFs you actually need to read, cite, or inspect. It turns long documents into smaller source-linked cards, keeps tables/figures/formulas as faithful image crops, and lets you export your own notes and highlights as Markdown.
Quick Install (one-click)
PDF Card MCP is a Python server, so it needs a runtime. The one thing to install first is
uv — it manages Python for you, so you do not have to. This is
the only prerequisite for every install path below:
Then add the server with one click. The buttons run the published
pdf-card-mcp package through uv:
[Add to Cursor] [Add to VS Code]
Claude Code (terminal):
Claude Desktop (no terminal, no prerequisites): download pdf-card-mcp-desktop.mcpb from the
latest release and double-click it to
install as an extension. This bundle declares the uv runtime, so Claude Desktop installs Python
and dependencies for you — you do not need the uv step above for this path.
After installing, restart (or reload MCP servers in) your client so it picks up the new server.
Real Screenshots
These screenshots are from a generated reader for Agents in Software Engineering and the same source PDF opened side by side for comparison.
Quick Examples
Convert a local PDF into one portable HTML reader:
Use the explicit subcommand form with PDF-derived styling:
Run the MCP server so a compatible host can generate readers from local PDF paths:
Publish a read-only static reader with selected public annotations:
Output At A Glance
Status
This is an early open-source implementation. It is useful for text-layer PDFs now, with
best-effort table detection via pdfplumber, permissive raster rendering via pypdfium2,
and optional richer local table detection via gmft. Scanned PDFs need optional OCR support.
Install
Most people should use the one-click install above. To install the package directly instead, from PyPI:
Or install the latest unreleased changes directly from the repository:
For local development:
uv is recommended for MCPB packaging:
Install the optional local ML table detector when you want stronger table crops:
Use In An MCP Client
Add it to Claude Code or another CLI-compatible MCP client with uvx (requires
uv):
Generic MCP host configuration:
For local development before the PyPI release, point the client at this checkout:
Claude Desktop can also install the .mcpb bundle from the latest GitHub release.
Docker / Registry Scanners
The repository includes a minimal Dockerfile so registries such as Glama can build the
server, start it over stdio, and inspect its MCP tool schemas. The server still works on local
file paths, so container users must mount any PDFs and output directories they want the tool to
read or write:
CLI Usage
The command writes:
document.html: standalone reader with embedded CSS, JavaScript, table crops, figure crops, formula crops, and source-page images.document.manifest.json: structured metadata without embedded image payloads.
The explicit subcommand form is also supported:
Notes, Highlights, And Static Publishing
Generated readers include a local annotation overlay:
- A highlight is selected source text.
- A note is selected source text plus your own typed note text.
Select text in a text card, choose Highlight or Note, and use Export Markdown to download
a readable .annotations.md file. Import is intentionally not exposed in the reader UI yet.
Notes and highlights are user-authored data and are kept separate from the source-derived
document.manifest.json.
The lower-level CLI and MCP publishing tools still accept a structured annotation bundle when you need to build a read-only static reader with embedded annotations. Validate that bundle against a reader:
Publish a shareable static reader with public annotations:
If --output is a directory instead of an .html file, the command writes a static bundle:
index.htmlreader.manifest.jsonreader.annotations.jsonbundle.json
Publishing includes only visibility: public annotations by default, redacts the local
source_pdf path by default, and renders the published reader read-only by default. Use
--include-private only when you intentionally want private local notes included in the
published output. Publishing fails if any included annotation cannot be anchored to the reader;
run validate-annotations to inspect mismatches before publishing.
MCP Tool
The MCP server is the automation layer around the same local converter. It accepts local file paths from an MCP client and returns generated reader paths, manifest metadata, warnings, and publishing/validation results.
The server exposes three tools:
Inputs:
pdf_path: local PDF path.output_path: optional HTML output path.title: optional title override.standalone: defaults totrue; asset-folder output is reserved for a later release.ocr: optional OCR fallback ifpytesseractis installed.max_pages: optional processing limit.theme: defaults tosoft.style_engine:fixed,pdf, orsampling; defaults topdf.fixedpreserves the original soft palette,pdfderives bounded colors and typography hints locally from the source PDF, andsamplingasks the host LLM to choose validated style tokens from those local hints.table_engine:auto,pdfplumber, orgmft;autousesgmftwhen installed.text_engine:char_geometryorpdfplumber_words; defaults tochar_geometryso missing spaces are repaired from PDF character positions instead of trusting fused words.postprocess_engine:noneorsampling; defaults tonone. When set tosampling, the MCP server asks the host LLM for boundary-only card polish operations, validates exact source-text preservation, and rewrites the generated reader. If the MCP client does not support sampling, deterministic output is returned with a warning.model_cache_dir: optional cache directory for local ML table model weights.offline: use only already-cached optional ML models.
validate_reader_annotations checks a notes/highlights sidecar against a generated reader.
publish_reader_bundle writes a publish-ready static HTML file or directory bundle from an
existing generated reader and an optional annotation sidecar.
Sampling post-processing is intentionally narrow. For card boundaries, the host LLM may
suggest merges, heading extraction, or front-matter/footnote classification, but Python
validation rejects any operation that rewrites, deletes, invents, or reorders source text.
For style_engine=sampling, the host LLM may only choose bounded style tokens and palette
candidate IDs; it cannot return raw CSS, JavaScript, or arbitrary colors. If sampling is
unavailable, the reader keeps deterministic PDF-derived styling and returns a warning.
Run the server locally:
MCPB Packaging
This repo is arranged so the root can be packed directly:
This builds three bundles:
dist/pdf-card-mcp-lite.mcpbanddist/pdf-card-mcp.mcpbdeclareserver.type = "python"for MCP registry and Smithery directory compatibility. The full bundle additionally installs thetable-mlextra. These execute throughuv, so the host (or user) must provideuv.dist/pdf-card-mcp-desktop.mcpbdeclaresserver.type = "uv"(frommanifest.uv.json). Claude Desktop manages Python and dependencies itself, so end users can double-click to install with no prerequisites. This is the bundle linked from the one-click install section above.
No bundle vendors ML model weights; gmft downloads and caches them locally on first use unless
offline=true is set with a prewarmed cache.
Privacy
Default PDF processing is local. The deterministic converter does not upload document contents or call external APIs. Optional OCR runs locally when the user has installed OCR dependencies.
When style_engine=sampling or postprocess_engine=sampling is enabled through MCP, the host
LLM may receive bounded style hints or card text snippets so it can return validated style-token
or boundary-operation plans. Use deterministic fixed/pdf style and postprocess_engine=none
when no document-derived text should leave the local process.
Published readers may contain extracted PDF text, source-page images, table/figure/formula crops, and any included public notes or highlights. Only publish generated readers when you have the rights to share the source document content and your annotations.
How It Works
See docs/how-it-works.html for a self-contained visual explainer
of the conversion pipeline, including page rendering, table/figure crops, overlap suppression,
text-card merging, and standalone HTML output.
How Tables Are Handled
All detected tables are rendered as image cards. The converter uses pdfplumber to find table
regions and can optionally use gmft/Table Transformer for stronger local detection. It then
uses pypdfium2 to rasterize only the source table region into PNG. Captions are preserved as
reader text and alt text, but the table itself remains an image so layout and numeric alignment
survive conversion.
If a document mentions tables but no reliable table regions are found, the manifest includes a warning so callers can decide whether to inspect the source pages.
How Formulas Are Handled
Display formulas are treated as image cards when the PDF exposes them as centered, formula-like text blocks. The extracted formula string is retained for alt/search metadata, but the reader shows the source crop so subscripts, superscripts, arrows, and math spacing remain faithful.
License
MIT
來源:README.md,提交 470a16e
工具
0版本歷史
1- v0.1.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分