extract_text
Extract text from a local PDF file
file_path必填
io.github.CloudCorpRecords由 GitHub 帳號 CloudCorpRecords 發布v0.1.0更新於 Nov 7, 2026
Extract text and metadata from local PDFs, and merge or split PDF files.
本機 MCP 伺服器,可擷取 PDF 的文字與中繼資料,並合併或拆分 PDF 檔案,只處理本機檔案。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
參照 儲存庫 中的啟動說明。
pdfport does the five PDF jobs that come up over and over: pull the text out of a file, read its document metadata, summarise it (pages, page sizes, file size, PDF version), merge several files into one, and split a file into one document per page. It works on local files only — nothing is uploaded anywhere.
The engine is a small, genuine PDF implementation written in pure TypeScript for this project. No PDF library is bundled and there are no runtime dependencies beyond the MCP SDK. The engine scans a document's indirect objects, follows the Catalog to its Pages tree, decodes plain and FlateDecode content streams, and recovers text from the standard text-showing operators. Merges renumber the source objects into one new object graph with a rebuilt page tree; splits emit one document per page the same way; both write a freshly computed cross-reference table.
Supported: simple PDFs with a flat page tree (a Catalog whose Pages node lists Page objects directly — the shape common generators produce, and the shape pdfport's own merge/split write), uncompressed or FlateDecode streams, literal and hex strings in content and in the Info dictionary, and per-page MediaBox sizes (inherited from the Pages node when a page omits its own).
Not supported: encrypted files, object streams and compressed cross-reference streams (PDF 1.5+ compact files), nested page trees, embedded-font encodings that need a ToUnicode map to read, and form/annotation fidelity on merge or split. Files outside the subset fail with a plain error saying what was not found — pdfport never returns invented text or metadata.
Or run the container image:
The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.
Exit codes: 0 on success, 1 when a file is missing or a document
cannot be processed (the error says which), 2 for usage errors.
One bin serves both faces. The mcp subcommand starts a stdio MCP
server:
MCP client configuration:
The test suite builds small PDFs from raw strings — plain and FlateDecode content streams — and drives the default engine end-to-end: extraction (including TJ arrays and literal-string escapes), metadata, info, merge and split are all asserted against the real implementation, then the file facade is exercised against real files in a temporary directory.
MIT — see LICENSE.
來源:README.md,提交 6856d03
Extract text from a local PDF file
file_path必填Read a PDF file's document metadata (title, author, dates, page count)
file_path必填Get summary information about a PDF file: page count, page sizes, file size, PDF version
file_path必填Merge multiple PDF files into one output file
input_files必填output_file必填Split a PDF file into one file per page in an output directory
file_path必填output_dir必填已滿足適用檢查項的 90%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
npx @reneturcios/pdfport get-pdf-info ./report.pdfdocker run -i ghcr.io/cloudcorprecords/pdfport# Print the document's textpdfport extract-text ./report.pdf
# Print the Info-dictionary metadata (plus page count) as JSONpdfport get-metadata ./report.pdf
# Print page count, page sizes, file size and PDF version as JSONpdfport get-pdf-info ./report.pdf
# Merge inputs, in order, into one output filepdfport merge ./combined.pdf ./a.pdf ./b.pdf ./c.pdf
# Split into <name>-page-1.pdf, <name>-page-2.pdf, ... in a directorypdfport split ./report.pdf ./report-pages
# Start the MCP serverpdfport mcp
pdfport --versionnpx -y @reneturcios/pdfport mcp{ "mcpServers": { "pdfport": { "command": "npx", "args": ["-y", "@reneturcios/pdfport", "mcp"] } }}npm installnpm run build # tsc -> dist/npm test # node test runner over test/*.test.ts, no networknpm run dev # run the CLI from source via tsx