LM

labeveryday/mcp_pdf_reader

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

13 stars 8 forks 品質 55 トレンド 20

このmcpサーバーは、PDFデータを分析し、読み込みます.

概要

テキスト抽出、画像抽出、OCRなどの包括的なPDF処理機能を提供するFastMCPで構築された強力なモデルコンテキストプロトコル(MCP)サーバー。 - : PDFページからテキストコンテンツを抽出する - : PDFファイルからすべての画像を抽出 - : テキストをTesseract OCRを使用して画像から読む - : 詳細なPDF構造とメタデータを入手 - : プロセス固有のページ範囲 - : 複数の言語のためのOCRサポート システムにTesseract OCRをインストールする必要があります。 1. ダウンロード: https://github.com/UB-Mannheim/tesseract/wiki 2。 PATH 3にインストールして追加します。 または使用:condaは-cのconda-forgeのtesseractを取付けます または環境を活動化させたら: サーバは、stdin/stdout の MCP リクエストの開始とリスニングを行います.

概要(AI 翻訳)

テキスト抽出、画像抽出、OCRなどの包括的なPDF処理機能を提供するFastMCPで構築された強力なモデルコンテキストプロトコル(MCP)サーバー。

##特徴

  • テキスト抽出: PDFページからテキストコンテンツを抽出する
  • イメージ抽出:PDFファイルからすべての画像を抽出する
  • OCR機能:Tesseract OCRを使用して画像からテキストを読みます
  • 包括的な分析:詳細なPDF構造とメタデータを入手
  • ページ範囲サポート: 特定のページ範囲を処理する
  • 複数の言語:複数の言語のためのOCRサポート

前提条件

システム依存関係

テセラクトOCR

システムにTesseract OCRをインストールする必要があります。

Ubuntu/Debian:

macOS:

Windows:

  1. ダウンロード: https://github.com/UB-Mannheim/tesseract/wiki
  2. PATHにインストールして追加する
  3. または使用: [conda install -c conda-forge tesseract]

追加言語パック(オプション)

インストール

##UV でクイックスタート

1.UV(インストールされていない場合):

2.プロジェクトをクローン/作成する:

3。UVで初期化してインストール:

4.インストールの確認:

代替:手動セットアップ

伝統的なセットアップを好む場合:

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

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:

  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

Additional Language Packs (Optional)

# For multiple languages
sudo apt install tesseract-ocr-fra tesseract-ocr-deu tesseract-ocr-spa

Installation

Quick Start with UV

  1. 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"
  1. Clone/Create the project:
mkdir mcp-pdf-reader-server
cd mcp-pdf-reader-server
  1. Initialize and install with UV:
# Copy the files (pdf_reader_server.py and pyproject.toml)
# Then install dependencies
uv sync
  1. Verify installation:
uv run python -c "import pytesseract; print(pytesseract.get_tesseract_version())"

Alternative: Manual Setup

If you prefer traditional setup:

  1. Create virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. 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 file
  • page_range (object, optional): Dict with start and end page 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 file
  • output_dir (string, optional): Directory to save images
  • page_range (object, optional): Page range to process

Example:

{
  "file_path": "/path/to/document.pdf",
GitHub で README 全文を見る

インストール

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" } } }