PDF处理器MCP服务器
一种模型上下文协议(MCP)服务器,用于处理具有高级功能的PDF文档,包括LaTeX方程提取。此服务器使Claude能够从PDF文档中获取、处理和提取信息,包括LaTeX数学方程。
特性
- 从URL获取PDF
- 从PDF中提取文本
- LaTeX方程的识别与提取
- 通过MCP与Claude集成
安装
标准安装
pip install -e .安装克劳德桌面/Claude代码
要将此MCP服务器与克劳德桌面或克劳德代码一起使用:
- 如果尚未安装MCP CLI工具,请安装:
pip install "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= extract_latex=true
/mcp PDF_TOOLS read_processed_pdf filename=用法
独立运行
python pdf_tool_server.py环境变量
OUTPUT_DIR:存储已处理PDF的目录(默认:llm_output)PYTHONPATH:设置为包含mcp_pdf_processor包的目录
与克劳德一起使用
注册服务器后,您可以要求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= extract_latex=true
# This returns a filename for the processed output
# 3. Read the processed content
/mcp PDF_TOOLS read_processed_pdf filename=
# Now Claude can analyze the PDF content, including any LaTeX equations许可证
麻省理工学院
