Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

pdf-reader-mcp

MCP.Pizza Chef: trafflux

pdf-reader-mcp is an MCP server that enables reading and extracting text content from PDF files, supporting both local files and PDFs accessible via URLs. It features error handling for corrupt or invalid PDFs, auto-detection of PDF encoding, volume mounting for local file access, and outputs standardized JSON data for seamless integration with LLMs and other MCP clients.

Use This MCP server To

Extract text content from local PDF documents Read and parse PDFs hosted at remote URLs Convert PDF text into standardized JSON for LLM processing Handle corrupt or invalid PDF files gracefully Mount local directories to serve PDFs dynamically Enable LLMs to access and analyze PDF content in real time

README

PDF Reader MCP Server

A Model Context Protocol (MCP) server that provides tools for reading and extracting text from PDF files, supporting both local files and URLs.

Author

Philip Van de Walker
Email: philip.vandewalker@gmail.com
GitHub: https://github.com/trafflux

Features

  • Read text content from local PDF files
  • Read text content from PDF URLs
  • Error handling for corrupt or invalid PDFs
  • Volume mounting for accessing local PDFs
  • Auto-detection of PDF encoding
  • Standardized JSON output format

Installation

  1. Clone the repository:
git clone https://github.com/trafflux/pdf-reader-mcp.git
cd pdf-reader-mcp
  1. Build the Docker image:
docker build -t mcp/pdf-reader .

Usage

Running the Server

To run the server with access to local PDF files:

docker run -i --rm -v /path/to/pdfs:/pdfs mcp/pdf-reader

Replace /path/to/pdfs with the actual path to your PDF files directory.

If not using local PDF files:

docker run -i --rm mcp/pdf-reader

MCP Configuration

Add to your MCP settings configuration:

{
  "mcpServers": {
    "pdf-reader": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v",
        "/path/to/pdfs:/pdfs",
        "mcp/pdf-reader"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}

Without local file PDF files:

{
  "mcpServers": {
    "pdf-reader": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "mcp/pdf-reader"],
      "disabled": false,
      "autoApprove": []
    }
  }
}

Available Tools

  1. read_local_pdf

    • Purpose: Read text content from a local PDF file
    • Input:
      {
        "path": "/pdfs/document.pdf"
      }
    • Output:
      {
        "success": true,
        "data": {
          "text": "Extracted content..."
        }
      }
  2. read_pdf_url

    • Purpose: Read text content from a PDF URL
    • Input:
      {
        "url": "https://example.com/document.pdf"
      }
    • Output:
      {
        "success": true,
        "data": {
          "text": "Extracted content..."
        }
      }

Error Handling

The server handles various error cases with clear error messages:

  • Invalid or corrupt PDF files
  • Missing files
  • Failed URL requests
  • Permission issues
  • Network connectivity problems

Error responses follow the format:

{
  "success": false,
  "error": "Detailed error message"
}

Dependencies

  • Python 3.11+
  • PyPDF2: PDF parsing and text extraction
  • requests: HTTP client for fetching PDFs from URLs
  • MCP SDK: Model Context Protocol implementation

Project Structure

.
├── Dockerfile          # Container configuration
├── README.md          # This documentation
├── requirements.txt   # Python dependencies
└── src/
    ├── __init__.py    # Package initialization
    └── server.py      # Main server implementation

License

Copyright 2025 Philip Van de Walker

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Contact

For questions, issues, or contributions, please contact Philip Van de Walker:

pdf-reader-mcp FAQ

How do I provide local PDF files to the pdf-reader-mcp server?
You can mount a local directory containing PDFs into the Docker container using the -v flag, e.g., docker run -v /path/to/pdfs:/pdfs.
Can pdf-reader-mcp read PDFs from URLs?
Yes, it supports reading and extracting text from PDFs accessible via HTTP URLs.
How does pdf-reader-mcp handle corrupt or invalid PDF files?
The server includes error handling to detect and report issues with corrupt or invalid PDFs, preventing crashes.
What output format does pdf-reader-mcp provide?
It outputs extracted PDF text in a standardized JSON format suitable for consumption by MCP clients and LLMs.
Is there support for different PDF encodings?
Yes, pdf-reader-mcp auto-detects PDF encoding to accurately extract text content.
How do I install and run pdf-reader-mcp?
Clone the GitHub repo, build the Docker image, and run the container with appropriate volume mounts for local PDFs.
Can pdf-reader-mcp be integrated with multiple LLM providers?
Yes, it is provider-agnostic and works with OpenAI, Claude, Gemini, and other LLMs via MCP.
Does pdf-reader-mcp support real-time PDF text extraction?
Yes, it can serve PDF text extraction requests in real time for interactive LLM workflows.