Skip to main content

A powerful MCP server for comprehensive PDF processing with OCR and diagram detection

Project description

PDF Reader MCP Server

License: MIT Python 3.11+ PyPI version

A powerful Model Context Protocol (MCP) server that provides comprehensive PDF processing capabilities, including text extraction, OCR support, and network diagram detection. Designed to work seamlessly with Amazon Q Developer CLI and other MCP-compatible systems.

🚀 Features

  • Text Extraction: Extract text content from PDF files with high accuracy
  • PDF Analysis: Get comprehensive metadata (pages, document info, encryption status)
  • Page-Specific Processing: Extract text from specific pages
  • Multi-Language OCR: Support for Thai and English text recognition
  • Smart Processing: Automatically chooses between OCR and direct text extraction
  • Markdown Conversion: Convert PDF content to clean markdown format
  • Document Analysis: Determine if PDFs are scanned images or searchable text
  • Network Diagram Detection: Advanced capability to detect and extract network diagrams
  • MCP Integration: Seamless integration with Amazon Q Developer CLI

📦 Installation

Using uvx (Recommended)

The easiest way to use this MCP server is with uvx:

# Run directly without installation
uvx pdf-reader-mcp

# Or install globally
uvx install pdf-reader-mcp

Using pip

pip install pdf-reader-mcp

From Source

git clone https://github.com/zixma13/pdf-reader-mcp.git
cd pdf-reader-mcp
pip install -e .

📋 Prerequisites

  1. Install Tesseract OCR (required for OCR functionality):

    # For macOS
    brew install tesseract
    brew install tesseract-lang  # For language support including Thai
    
    # For Ubuntu/Debian
    # sudo apt-get install tesseract-ocr
    # sudo apt-get install tesseract-ocr-tha  # For Thai language support
    
  2. Install Python dependencies:

    pip install -r requirements.txt
    
  3. Ensure you have the virtual environment activated:

    source .venv/bin/activate
    
  4. Test the server:

    mcp dev main.py
    

Configuration for Amazon Q Developer CLI

Add the following to your ~/.aws/amazonq/mcp.json file:

{
  "mcpServers": {
    "pdf_reader": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/your/pdf_reader/pdf_reader",
        "run",
        "main.py"
      ]
    }
  }
}

Usage Examples

Once configured, you can use the PDF reader tools in Amazon Q:

Basic PDF Processing

  • To analyze a PDF and determine if it's a scanned image or searchable text:

    pdf_reader___analyze_pdf("/path/to/document.pdf")
    
  • To intelligently extract content from a PDF (automatically choosing between OCR and text extraction):

    pdf_reader___smart_extract_pdf("/path/to/document.pdf")
    
  • To intelligently convert a PDF to markdown:

    pdf_reader___smart_pdf_to_markdown("/path/to/document.pdf")
    
  • To extract text from a PDF:

    pdf_reader___read_pdf("/path/to/document.pdf")
    
  • To get metadata from a PDF:

    pdf_reader___get_pdf_metadata("/path/to/document.pdf")
    
  • To extract text from a specific page (0-indexed):

    pdf_reader___extract_pdf_page("/path/to/document.pdf", 0)
    
  • To extract text using OCR (supports Thai and English):

    pdf_reader___ocr_pdf("/path/to/document.pdf")
    
  • To extract text from a specific page using OCR:

    pdf_reader___ocr_pdf_page("/path/to/document.pdf", 0)
    
  • To convert PDF to markdown format:

    pdf_reader___pdf_to_markdown("/path/to/document.pdf")
    
  • To convert PDF to markdown format using OCR:

    pdf_reader___pdf_to_markdown("/path/to/document.pdf", use_ocr=True)
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf_reader_mcp-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf_reader_mcp-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file pdf_reader_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: pdf_reader_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for pdf_reader_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a5e58140d9463cf2f5477f2c68b8165a5136b5d7e937e209378e83f33f2ffc5
MD5 3dbe2c9f029f8b54bdf70ea04bc4034e
BLAKE2b-256 e0a37da9558a523ecd4b325548ca351b04793e6af405f9f019850aa3bb2e261a

See more details on using hashes here.

File details

Details for the file pdf_reader_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pdf_reader_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for pdf_reader_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3773d527b6576b7d6aed7ad2859c5c8e4dcb6cae45f8a962ff546efb2f828c57
MD5 e1621877bc0dbb89e2ce979ca66dc958
BLAKE2b-256 c35376f96e00d0898a90e004f323247fcdeeb80f70e70f7889426b9379902af3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page