PDF处理器MCP服务器
一个模型上下文协议 (MCP) 服务器,用于处理 PDF 文档,并具备 LaTeX 公式提取等高级功能。该服务器使 Claude 能够从 PDF 文档中获取、处理和提取信息,包括 LaTeX 数学公式。
特征
- 从 URL 获取 PDF
- 从 PDF 中提取文本
- LaTeX 公式识别和提取
- 通过 MCP 与 Claude 集成
安装
标准安装
安装 Claude Desktop/Claude Code
要将此 MCP 服务器与 Claude Desktop 或 Claude Code 一起使用:
- 如果尚未安装,请安装 MCP CLI 工具:
- 使用 MCP CLI 工具安装服务器:
mcp install /path/to/pdf_tool_server.py --with-editable /path/to/mcp_pdf_processor
例如,如果您已将此存储库克隆到~/mcp_pdf_processor
:mcp install ~/mcp_pdf_processor/pdf_tool_server.py --with-editable ~/mcp_pdf_processor
- 使用 MCP Inspector 进行开发:
mcp dev /path/to/pdf_tool_server.py --with-editable /path/to/mcp_pdf_processor
- 在 Claude Desktop 中,您现在可以通过以下命令在对话中使用 PDF_TOOLS 服务器:
/mcp PDF_TOOLS fetch_pdf url=https://example.com/document.pdf
/mcp PDF_TOOLS process_pdf hash_id=<HASH_ID> extract_latex=true
/mcp PDF_TOOLS read_processed_pdf filename=<FILENAME>
用法
独立运行
python pdf_tool_server.py
环境变量
OUTPUT_DIR
:存储已处理 PDF 的目录(默认值: llm_output
)PYTHONPATH
:设置为包含 mcp_pdf_processor 包的目录
与 Claude 一起使用
当服务器注册完成后,你可以要求 Claude 执行以下操作:
- “获取并分析 [URL] 处的 PDF”
- “从 [URL] 处的 PDF 中提取 LaTeX 方程式”
- “总结 [URL] 处的 PDF 内容”
要求
该服务器需要以下主要依赖项:
- Python 3.9 或更高版本
pymupdf
:PDF处理和文本提取mcp
:模型上下文协议支持pydantic
:数据验证和序列化aiohttp
:异步 HTTP 客户端/服务器torch
:用于 LaTeX 方程提取(可选)pix2tex
:用于 LaTeX 方程式识别(可选)
请参阅pyproject.toml
以获取依赖项和版本要求的完整列表。
使用示例
以下是使用 Claude Desktop 的 PDF 处理器的完整示例工作流程:
# 1. Fetch a PDF without reading it
/mcp PDF_TOOLS fetch_pdf url=https://arxiv.org/pdf/2505.05522
# This returns a hash_id, which you'll use in the next step
# 2. Process the PDF with LaTeX extraction
/mcp PDF_TOOLS process_pdf hash_id=<HASH_ID> extract_latex=true
# This returns a filename for the processed output
# 3. Read the processed content
/mcp PDF_TOOLS read_processed_pdf filename=<FILENAME>
# Now Claude can analyze the PDF content, including any LaTeX equations
执照
麻省理工学院