Skip to main content

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:

Metadata

Release files for iflow-mcp-pdf-reader 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iflow-mcp-pdf-reader 1.0.0
File Size Uploaded
iflow_mcp_pdf_reader-1.0.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp-pdf-reader 1.0.0
File Interpreter ABI Platform
iflow_mcp_pdf_reader-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / iflow_mcp_pdf_reader-1.0.0.tar.gz

Download URL iflow_mcp_pdf_reader-1.0.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
49648611804eb8857411f2e86f12c4574efdce91cfc2c1e8df53ad076646d587
BLAKE2b-256 checksum
How to use checksums
fc79a7c70c07cfe254e9c5370786713bc9e6824519e20e112699de2b32de0a05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / iflow_mcp_pdf_reader-1.0.0-py3-none-any.whl

Download URL iflow_mcp_pdf_reader-1.0.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b824d97d69e4fa2db98e350709512452473ccabea04c1cf8775547d7cedfeb2b
BLAKE2b-256 checksum
How to use checksums
702168296e30fe3c5f2fd4832f4d92d77f2c95debb49414e60e46b419a041bf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page