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 分