MP

m13253/pdflens-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

20 stars 2 forks 质量 70 趋势 18Apache-2.0

一个由人工编写、专为人工智能设计的 PDF 阅读 MCP 服务器

概览

一个由人工编写、为人工智能设计的 PDF 阅读 MCP 服务器。 Pdflens MCP 设计用于在工作区内使用 MCP Root 机制进行隐私和安全边界保护,因此用户可以自动批准所有 Pdflens MCP 工具调用,同时知道 LLM 不会意外将 PDF 内容上传到用户工作区外的 LLM 推理提供者。 然而,MCP决定弃用Root机制(SEP-2577),并将在2027年6月左右移除。文档还指出,我使用MCP Root进行访问控制的方法是错误的。 在MCP提供替代机制(例如SEP-1708)之前,维护该MCP服务器的核心功能是不可能的。因此,我暂停该项目的维护,直到找到允许自动批准PDF读取的替代方法。现有编码代理目前可能仍能使用Pdflens MCP,但更新的编码代理最终将不兼容。

概述(AI 翻译)

PDFLENS-MCP

一个由人工编写、为人工智能设计的 PDF 阅读 MCP 服务器。

⚠️ 停养通知 ⚠️

Pdflens MCP 设计用于在工作区内使用 MCP Root 机制进行隐私和安全边界保护,因此用户可以自动批准所有 Pdflens MCP 工具调用,同时知道 LLM 不会意外将 PDF 内容上传到用户工作区外的 LLM 推理提供者。

然而,MCP决定弃用Root机制(SEP-2577),并将在2027年6月左右移除。文档还指出,我使用MCP Root进行访问控制的方法是错误的。

在MCP提供替代机制(例如SEP-1708)之前,维护该MCP服务器的核心功能是不可能的。因此,我暂停该项目的维护,直到找到允许自动批准PDF读取的替代方法。现有编码代理目前可能仍能使用Pdflens MCP,但更新的编码代理最终将不兼容。

到来时,请尝试其他选项,比如在终端沙盒内运行 pdftotext 和 pdftoppm 命令。VS Code 自 1.109 起支持沙盒,Zed 自 1.14.2 起支持。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

pdflens-mcp

An MCP server for reading PDFs, coded by human, designed for AI.

⚠️ Out-of-maintenance notice ⚠️

Pdflens MCP is designed to use the MCP Root mechanism for privacy and security boundary within workspaces, so the user can auto-approve all Pdflens MCP tool calls, knowing that LLMs will not accidentally upload PDF contents outside user’s workspaces to LLM inference providers.

However, MCP decided to deprecate the Root mechanism (SEP-2577), and will remove it at around June 2027. The documentation also states that my approach to use MCP Root for access control is wrong.

Until MCP provides an alternative mechanism (e.g., SEP-1708), maintaining the core functionality of this MCP Server is impossible. Therefore, I am pausing the maintenance of this project until I find any alternative method to allow auto-approved PDF reading. Current coding agents may still be able to use Pdflens MCP for now, but newer coding agents will eventually be incompatible with it.

When the day comes, please try other options, for example, running pdftotext and pdftoppm commands inside terminal sandboxes. VS Code supports sandboxes since 1.109, and Zed since 1.14.2. For OCR requirements, please check Firecrawl/pdf-inspector.

Provided tools

  • get_pdf_num_pages
  • read_pdf_as_text
  • read_pdf_page_as_image‡

‡ Not all MCP clients support images.

Usage

  1. Install Rust compiler: https://rustup.rs/

  2. Download and build pdflens-mcp from crates.io

    cargo install --git https://codeberg.org/m13253/pdflens-mcp.git pdflens-mcp
    

    Usually, the program is installed to $HOME/.cargo/bin/pdflens-mcp. You can use cargo install --root /another/path pdflens-mcp to set a custom installation path.

  3. Add this MCP server to your MCP client of choice.

    (Note: We use sh to expand ~ to your actual home directory. If you are using Microsoft Windows, please instead put the full path to pdflens-mcp.exe to "command" and leave "args" empty.)

    1. If your MCP client supports mcp.json:

      {
        "mcpServers": {
          "pdflens": {
            "command": "sh",
            "args": ["-c", "exec ~/.cargo/bin/pdflens-mcp"]
          }
        }
      }
      
    2. Visual Studio Code:

      code --add-mcp "{\"name\": \"pdflens\", \"command\": \"sh\", \"args\": [\"-c\", \"exec ~/.cargo/bin/pdflens-mcp\"]}"
      
    3. Codex

      [mcp_servers.pdflens]
      command = "sh"
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "pdflens": { "command": "sh", "args": ["-c", "exec ~/.cargo/bin/pdflens-mcp"] } } }