Skip to main content
Glama

mcp-pdf-utils

用于 PDF 处理的 MCP 服务器。支持合并、拆分、旋转、添加水印、提取文本等功能。

适用于 Claude Desktop、Cursor、VS Code、ChatGPT 以及任何兼容 MCP 的客户端。

npm License: MIT


为什么选择它

PDF 处理是开发者最常见的任务之一,但目前还没有好用的 MCP 服务器。现有的选项星标很少。而这个工具确实好用。

所有操作都在本地运行。无需 API 密钥。无需云服务。您的 PDF 永远不会离开您的机器。

Related MCP server: PDF MCP Server

工具

工具

描述

pdf_info

获取元数据、页数、文件大小

pdf_extract_text

从页面中提取文本内容

pdf_merge

将多个 PDF 合并为一个

pdf_split

将 PDF 拆分为单独的页面文件

pdf_extract_pages

将页面范围提取为新的 PDF

pdf_rotate

将页面旋转 90°、180° 或 270°

pdf_add_watermark

添加文本水印(例如 DRAFT、CONFIDENTIAL)

pdf_delete_pages

删除特定页面

pdf_reorder

重新排列页面顺序

pdf_set_metadata

设置标题、作者、主题、关键字

pdf_create

从纯文本创建新的 PDF

快速开始

Claude Desktop

添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "pdf-tools": {
      "command": "npx",
      "args": ["-y", "mcp-pdf-utils"]
    }
  }
}

就是这样。重启 Claude Desktop 并开始让它处理 PDF 吧。

Claude Code

claude mcp add pdf-tools -- npx -y mcp-pdf-utils

Cursor

添加到您的 Cursor MCP 设置中:

{
  "mcpServers": {
    "pdf-tools": {
      "command": "npx",
      "args": ["-y", "mcp-pdf-utils"]
    }
  }
}

VS Code

添加到您的 VS Code MCP 配置中:

{
  "mcp": {
    "servers": {
      "pdf-tools": {
        "command": "npx",
        "args": ["-y", "mcp-pdf-utils"]
      }
    }
  }
}

使用示例

连接后,只需自然地与您的 AI 对话:

  • “将 invoice_jan.pdf 和 invoice_feb.pdf 合并为 combined.pdf”

  • “从 report.pdf 中提取第 3-7 页”

  • “给 contract.pdf 添加一个 CONFIDENTIAL 水印”

  • “presentation.pdf 有多少页?”

  • “将 scan.pdf 中的所有页面旋转 90 度”

  • “从我的文档中删除第 5 页”

  • “提取此 PDF 中的所有文本”

  • “重新排序页面:先放第 3 页,然后是 1,最后是 2”

开发

git clone https://github.com/zekovdev/mcp-pdf-utils.git
cd mcp-pdf-utils
npm install
npm run dev

使用 MCP Inspector 进行测试

npm run inspect

这将打开官方的 MCP Inspector,您可以在其中直观地测试每个工具。

工作原理

该服务器使用 pdf-lib 进行 PDF 处理,使用 pdf-parse 进行文本提取。两者均在本地运行,没有任何外部依赖——无需 API 密钥、无需网络调用、无需云服务。

通信使用 MCP stdio 传输,这意味着服务器作为本地进程运行,由您的 AI 客户端启动并通过 stdin/stdout 与其通信。

路线图

  • [ ] PDF 压缩(减小文件大小)

  • [ ] 从 PDF 中提取图像

  • [ ] PDF 转图像(页面缩略图)

  • [ ] 添加页码

  • [ ] PDF 加密/密码保护

  • [ ] 填写 PDF 表单字段

  • [ ] 扫描版 PDF 的 OCR(通过 Tesseract)

  • [ ] 图像转 PDF 转换

贡献

欢迎提交 PR。在提交之前,请运行 npm run inspect 测试您的更改。

许可证

MIT

Available Tools

11 tools
pdf_add_watermarkC

Add a text watermark to all or specific pages of a PDF.

Inputs: file (required), output (required), text (required), fontSize, +3 more.

pdf_createC

Create a new PDF document from plain text content.

Inputs: output (required), text (required), title, fontSize.

pdf_delete_pagesC

Delete specific pages from a PDF.

Inputs: file (required), output (required), pages (required).

pdf_extract_pagesB

Extract a range of pages from a PDF into a new PDF file.

Inputs: file (required), output (required), startPage (required), endPage (required).

pdf_extract_textC

Extract text content from a PDF file. Optionally specify page range.

Inputs: file (required), startPage, endPage.

pdf_infoB

Get PDF metadata: page count, title, author, creator, creation date, file size.

Inputs: file (required).

pdf_mergeC

Merge multiple PDF files into a single PDF.

Inputs: files (required), output (required).

pdf_reorderB

Reorder pages of a PDF. Provide the desired page order.

Inputs: file (required), output (required), order (required).

pdf_rotateB

Rotate pages of a PDF by 90, 180, or 270 degrees.

Inputs: file (required), output (required), angle (required), pages.

pdf_set_metadataC

Set or update PDF metadata (title, author, subject, keywords, creator).

Inputs: file (required), output (required), title, author, +3 more.

pdf_splitA

Split a PDF into separate files. Extract specific pages or split into individual page files.

Inputs: file (required), outputDir (required), pages.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 11 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no significant overlap. For example, pdf_extract_pages creates a new PDF from a range, while pdf_split divides into separate files, and pdf_delete_pages removes pages without creating new files. The descriptions specify unique actions on PDFs, making misselection unlikely.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with the prefix 'pdf_' (e.g., pdf_add_watermark, pdf_extract_text). This uniform snake_case naming makes the set predictable and easy to understand, enhancing usability for agents.

    Tool Count5/5

    With 11 tools, the count is well-scoped for PDF manipulation tasks. It covers a comprehensive range of operations without being overwhelming, including creation, editing, extraction, merging, and metadata handling, which aligns perfectly with the server's purpose.

    Completeness5/5

    The tool set provides complete coverage for PDF manipulation, including CRUD-like operations (create, modify, delete pages), metadata management, and advanced features like watermarking and rotation. There are no obvious gaps; agents can perform all common PDF tasks without dead ends.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that provides comprehensive PDF processing capabilities including text extraction, image extraction, table detection, annotation extraction, metadata retrieval, page rendering, and document structure analysis.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server for PDF form filling, basic editing, and OCR text extraction. It enables users to merge, rotate, annotate, and sign PDFs, while also supporting text extraction from both searchable and scanned image-based documents.
      15
      Apache 2.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that provides tools for reading, writing, and manipulating PDF files, including text extraction, metadata retrieval, and merging or splitting documents. It also enables users to create PDFs from plain text and convert specific pages or entire documents into images.
      1
      -
    • A
      license
      A
      quality
      B
      maintenance
      A comprehensive MCP server with 37 tools for PDF operations including reading, searching, creating, merging, splitting, watermarking, form filling, and more, built on open-source libraries.
      37
      42 npm
      2
      MIT