PDF Reader MCP server

Integrates with PyPDF2 to enable efficient text extraction and information retrieval from PDF documents for various applications.
Back to servers
Provider
Philip Van de Walker
Release date
Feb 20, 2025
Language
Python
Stats
11 stars

This PDF Reader MCP server provides tools for extracting text from PDF files, whether stored locally or accessible via URL. It handles various PDF formats and delivers standardized JSON output for seamless integration with your applications.

Installation

To set up the PDF Reader MCP server:

  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 .

Running the Server

With Local PDF Access

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.

Without Local PDF Access

If you only need to process PDFs from URLs:

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

MCP Configuration

With Local PDF Access

Add this configuration to your MCP settings:

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

Without Local PDF Access

For URL-only PDF processing:

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

Available Tools

Reading Local PDFs

Use the read_local_pdf tool to extract text from local PDF files:

Input:

{
  "path": "/pdfs/document.pdf"
}

Output:

{
  "success": true,
  "data": {
    "text": "Extracted content..."
  }
}

Reading PDFs from URLs

Use the read_pdf_url tool to extract text from PDF files available online:

Input:

{
  "url": "https://example.com/document.pdf"
}

Output:

{
  "success": true,
  "data": {
    "text": "Extracted content..."
  }
}

Error Handling

The server provides clear error messages for various scenarios:

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

Error responses follow this format:

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

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later