
labeveryday/mcp_pdf_reader
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
This mcp server will analyze and read pdf data.
개요
A powerful Model Context Protocol (MCP) server built with FastMCP that provides comprehensive PDF processing capabilities including text extraction, image extraction, and OCR for reading text within images. - : Extract text content from PDF pages - : Extract all images from PDF files - : Read text from images using Tesseract OCR - : Get detailed PDF structure and metadata - : Process specific page ranges - : OCR support for multiple languages You need to install Tesseract OCR on your system: 1. Download from: https://github.com/UB-Mannheim/tesseract/wiki 2. Install and add to PATH 3. Or use: conda install -c conda-forge tesseract Or if you have the environment activated: The server will start and listen for MCP requests on stdin/stdout.
README
원문 README의 일부입니다. 원문 보기.
MCP PDF Reader Server (Python + FastMCP)
A powerful Model Context Protocol (MCP) server built with FastMCP that provides comprehensive PDF processing capabilities including text extraction, image extraction, and OCR for reading text within images.
Features
- Text Extraction: Extract text content from PDF pages
- Image Extraction: Extract all images from PDF files
- OCR Capabilities: Read text from images using Tesseract OCR
- Comprehensive Analysis: Get detailed PDF structure and metadata
- Page Range Support: Process specific page ranges
- Multiple Languages: OCR support for multiple languages
Prerequisites
System Dependencies
Tesseract OCR
You need to install Tesseract OCR on your system:
Ubuntu/Debian:
sudo apt update
sudo apt install tesseract-ocr tesseract-ocr-eng
macOS:
brew install tesseract
Windows:
- Download from: https://github.com/UB-Mannheim/tesseract/wiki
- Install and add to PATH
- Or use:
conda install -c conda-forge tesseract
Additional Language Packs (Optional)
# For multiple languages
sudo apt install tesseract-ocr-fra tesseract-ocr-deu tesseract-ocr-spa
Installation
Quick Start with UV
- Install UV (if not already installed):
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
- Clone/Create the project:
mkdir mcp-pdf-reader-server
cd mcp-pdf-reader-server
- Initialize and install with UV:
# Copy the files (pdf_reader_server.py and pyproject.toml)
# Then install dependencies
uv sync
- Verify installation:
uv run python -c "import pytesseract; print(pytesseract.get_tesseract_version())"
Alternative: Manual Setup
If you prefer traditional setup:
- Create virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Install dependencies:
pip install fastmcp PyMuPDF pytesseract Pillow
Usage
Running the Server
With UV:
uv run python pdf_reader_server.py
Or if you have the environment activated:
python pdf_reader_server.py
The server will start and listen for MCP requests on stdin/stdout.
Available Tools
1. read_pdf_text
Extract text content from PDF pages.
Parameters:
file_path(string, required): Path to the PDF filepage_range(object, optional): Dict withstartandendpage numbers
Example:
{
"file_path": "/path/to/document.pdf",
"page_range": {"start": 1, "end": 5}
}
2. extract_pdf_images
Extract all images from a PDF file.
Parameters:
file_path(string, required): Path to the PDF fileoutput_dir(string, optional): Directory to save imagespage_range(object, optional): Page range to process
Example:
{
"file_path": "/path/to/document.pdf",
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →설정
{
"mcpServers": {
"pdf-reader": {
"command": "uv",
"args": ["run", "python", "/path/to/your/pdf_reader_server.py"],
"cwd": "/path/to/your/mcp-pdf-reader-server"
}
}
}