Pdfport

io.github.CloudCorpRecords由 GitHub 帳號 CloudCorpRecords 發布v0.1.0更新於 Nov 7, 2026

Extract text and metadata from local PDFs, and merge or split PDF files.

已驗證STDIO僅桌面效率與工作流檔案與儲存

概覽

AI 產生的概覽

本機 MCP 伺服器,可擷取 PDF 的文字與中繼資料,並合併或拆分 PDF 檔案,只處理本機檔案。

可以做什麼
  • 逐頁擷取本機 PDF 的全文文字
  • 讀取文件中繼資料,例如標題、作者、主旨、關鍵字、建立者、產生器與日期,以及頁數
  • 回報頁數、每頁尺寸(點)、檔案大小與 PDF 版本
  • 依序將多個 PDF 合併成一個輸出檔,並保留第一個檔案的中繼資料
  • 將 PDF 拆分為每頁一個檔案,寫入指定的輸出目錄
適用情境
適合需要讓助理閱讀或摘要本機 PDF、檢視其中繼資料與結構,或在不把檔案上傳到任何地方的前提下合併、拆分 PDF 的情況。對常見產生器輸出的簡單、未加密 PDF 效果最好。
執行需求
以本機 stdio 程序執行,可透過 npm 套件的 npx 或容器映像啟動;使用 npx 需要 Node.js。未宣告任何帳號、API 金鑰、環境變數或標頭。僅限桌面端,處理過程不使用網路。
安裝前請注意
合併與拆分會在你指定的路徑寫入新檔案,請指向可安全變更的目錄。引擎是功能有限的純 TypeScript 實作:不支援加密檔案、物件串流、壓縮交叉參照串流、巢狀頁面樹,以及需要 ToUnicode 對照表的字型,合併或拆分也會失去表單與註解的保真度。超出支援範圍的檔案會直接報錯,不會回傳臆測的文字。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

pdfport

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.

Scope — what the engine does and does not handle

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.

Install

bash
npx @reneturcios/pdfport get-pdf-info ./report.pdf

Or run the container image:

bash
docker run -i ghcr.io/cloudcorprecords/pdfport

The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.

CLI

bash
# 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 --version

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.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

bash
npx -y @reneturcios/pdfport mcp

MCP client configuration:

json
{  "mcpServers": {    "pdfport": {      "command": "npx",      "args": ["-y", "@reneturcios/pdfport", "mcp"]    }  }}

Tools

ToolInputWhat it returns
extract_textfile_path (string, required)The file's text: every page's shown text, pages joined with a newline.
get_metadatafile_path (string, required)The Info dictionary's title, author, subject, keywords, creator, producer and dates (only the fields the document carries), plus the page count.
get_pdf_infofile_path (string, required)Page count, each page's MediaBox size in points, the file size in bytes, and the PDF version from the header.
merge_pdfsinput_files (array of strings, required), output_file (string, required)Writes the merged document and reports the output path and total page count. The first input's metadata is kept.
split_pdffile_path (string, required), output_dir (string, required)Writes one single-page file per page into the directory and reports the created file paths and page count.

Development

bash
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

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.

License

MIT — see LICENSE.

來源:README.md,提交 6856d03

工具

5

extract_text

Extract text from a local PDF file

輸入參數file_path必填

get_metadata

Read a PDF file's document metadata (title, author, dates, page count)

輸入參數file_path必填

get_pdf_info

Get summary information about a PDF file: page count, page sizes, file size, PDF version

輸入參數file_path必填

merge_pdfs

Merge multiple PDF files into one output file

輸入參數input_files必填output_file必填

split_pdf

Split a PDF file into one file per page in an output directory

輸入參數file_path必填output_dir必填

版本歷史

1
  1. v0.1.0最新Oct 31, 2026

評分

已滿足適用檢查項的 90%

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

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

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

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