pdf-toolbox-mcp

v0.1.6
pdf-toolbox-mcp Checked 2 days ago Published 2 months ago

Local-first PDF processing MCP server — OCR write-back, text extraction, page rendering, page surgery, encryption (OCRmyPDF + Poppler + qpdf)

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

tool_pdf_info Tool Pdf Info

获取 PDF 元信息:页数、是否加密、页面尺寸、标题作者等。处理任何 PDF 前先调用此工具。

ParameterTypeDescription
path *string

tool_extract_text Tool Extract Text

提取 PDF 文本(pdftotext)。pages 精确页范围如 '1-3,5';layout 保持版面;per_page 按页返回。

ParameterTypeDescription
path *string
layoutboolean
pages
per_pageboolean

tool_ocr_pdf Tool Ocr Pdf

对扫描件 OCR 并把文本层写回,产出可搜索 PDF(输出 <stem>_ocr.pdf)——本工具箱的核心差异化能力。 默认跳过已有文本层的页;默认语言 chi_sim+eng(缺语言包时自动降级并在结果中说明)。

ParameterTypeDescription
path *string
deskewboolean
lang
output
overwriteboolean
redo_ocrboolean

tool_render_pages Tool Render Pages

渲染指定页为 PNG。return_images=True 时直接返回图像内容块(供视觉查看复杂版面/图表/扫描页)。

ParameterTypeDescription
path *string
dpiinteger
out_dir
overwriteboolean
pagesstring
return_imagesboolean

tool_unlock_pdf Tool Unlock Pdf

用密码解锁加密 PDF,输出解密文件。user(打开)密码即可,无需 owner 密码。解锁后再走其他工具。

ParameterTypeDescription
password *string
path *string
output
overwriteboolean

tool_split_pdf Tool Split Pdf

拆分 PDF:ranges='1-3,5' 按区间出文件,或 every_n=N 每 N 页一段。二者二选一。

ParameterTypeDescription
path *string
every_n
out_dir
overwriteboolean
ranges

tool_merge_pdfs Tool Merge Pdfs

按传入顺序合并多个 PDF 为一个文件。

ParameterTypeDescription
output *string
paths *array
overwriteboolean

tool_rotate_pages Tool Rotate Pages

旋转页面 90/180/270 度。pages 缺省旋转全部页。

ParameterTypeDescription
angle *integer
path *string
output
overwriteboolean
pages

tool_protect_pdf Tool Protect Pdf

AES-256 加密(对外分发)。user_password 留空 = 打开无密码、仅权限限制;权限默认可打印可复制、不可修改。

ParameterTypeDescription
path *string
allow_annotateboolean
allow_assemblyboolean
allow_extractboolean
allow_formboolean
allow_modifyboolean
allow_printboolean
output
overwriteboolean
owner_password
user_passwordstring

tool_is_searchable Tool Is Searchable

智能路由入口:判断 PDF 是否已有可提取文本层,返回建议动作(extract_text 或先 ocr_pdf)。不确定时先调这个。

ParameterTypeDescription
path *string
sample_pagesinteger

tool_list_fonts Tool List Fonts

字体体检:列出字体与嵌入状态,未嵌入字体跨设备查看/打印可能缺字。

ParameterTypeDescription
path *string

tool_extract_images Tool Extract Images

抽取 PDF 内嵌图片为 PNG;list_only=true 只返回图片清单不落盘。 overwrite=true 才允许覆盖同名图片。

ParameterTypeDescription
path *string
list_onlyboolean
out_dir
overwriteboolean
pages

tool_extract_attachments Tool Extract Attachments

抽取 PDF 内嵌附件文件到指定目录;overwrite=true 才允许覆盖同名文件。

ParameterTypeDescription
path *string
out_dir
overwriteboolean

tool_check_repair Tool Check Repair

结构体检(语法/流编码);repair=true 尝试重建输出修复版文件。

ParameterTypeDescription
path *string
output
overwriteboolean
repairboolean

tool_linearize Tool Linearize

Web 优化:输出渐进加载版,适合在线浏览的发布文件。

ParameterTypeDescription
path *string
output
overwriteboolean

tool_batch_ocr Tool Batch Ocr

批量 OCR 写回:inputs 为文件路径或目录(取全部 PDF)。单文件失败不中断,逐文件返回结果。

ParameterTypeDescription
inputs *array
deskewboolean
lang
max_retriesinteger
out_dir
overwriteboolean
per_file_timeout
redo_ocrboolean

tool_sanitize Tool Sanitize

发布版脱敏:剥离 JS/OpenAction/元数据/附件(可选注释)。正文文本不动——防元数据与隐藏对象泄密。

ParameterTypeDescription
path *string
output
overwriteboolean
strip_annotationsboolean
strip_attachmentsboolean
strip_javascriptboolean
strip_metadataboolean

tool_redact Tool Redact

真涂黑(安全级):regions=[{page,x,y,w,h}](PDF 点、左上原点)。含涂黑区域的页被光栅化—— 被涂文字物理删除,复制/提取/文本层均无法恢复;其余页保留原文本层。 rasterize_all=true 全文档光栅化(最高防护档)。

ParameterTypeDescription
path *string
regions *array
dpiinteger
output
overwriteboolean
rasterize_allboolean

tool_locate_text Tool Locate Text

定位文本出现的页面与坐标框(PDF 点、左上原点)——找内容在哪、给 redact 量坐标的地基。 中文无分词、英文跨词均可命中(NFKC 归一化去空白匹配)。

ParameterTypeDescription
path *string
query *string
max_resultsinteger
pages

tool_redact_text Tool Redact Text

按内容真涂黑:自动定位每个关键词的全部出现处并涂黑(无需手工量坐标)。 如"把所有合同编号涂掉"。被涂页光栅化、文字物理删除;其余页保留文本层。

ParameterTypeDescription
path *string
queries *array
dpiinteger
output
overwriteboolean
rasterize_allboolean

tool_fill_form Tool Fill Form

填写 AcroForm 表单(字段名→字符串/布尔)。未匹配字段在 missing 中返回。

ParameterTypeDescription
fields *object
path *string
output
overwriteboolean

tool_edit_metadata Tool Edit Metadata

编辑元数据(docinfo+XMP 双写);clear=true 清空全部——对外发布前配合 sanitize 使用。

ParameterTypeDescription
path *string
author
clearboolean
creator
keywords
output
overwriteboolean
subject
title

tool_compress_pdf Tool Compress Pdf

压缩 PDF(ghostscript,有损:图像重采样)。target_mb 给定时沿 ebook→screen 下探直到达标(尽力而为)。

ParameterTypeDescription
path *string
output
overwriteboolean
qualitystring
target_mb

tool_dependency_status Tool Dependency Status

探测系统依赖、安装命令与可解锁工具。 工具报 missing_dependency 时先看这里。

tool_doctor Tool Doctor

一键诊断:导入、依赖快照、README 关键路径。