PDF Reader MCP server

Extracts and processes content from PDF documents, offering text reading, OCR capabilities, and image retrieval with performance-optimized caching.
Back to servers
Setup instructions
Provider
DeepSeekMine
Release date
Apr 28, 2025
Language
Python
Stats
24 stars

MCP PDF Server is a specialized server that allows you to extract text and images from PDF files through a simple API interface. It supports standard text extraction, OCR recognition for scanned documents, and image extraction with a convenient web debugger for testing your requests without writing code.

Installation

To install the MCP PDF Server, you'll need Python 3.9 or newer. Install the required dependencies using pip:

pip install pymupdf mcp

Note: If you plan to use OCR features, you may need additional OCR libraries or a special MuPDF build with OCR support.

Starting the Server

Once you've installed the dependencies, you can launch the server with:

python txt_server.py

The server will start, and you should see a message indicating it's running:

Serving on http://127.0.0.1:6231

Using the Web Interface

The MCP PDF Server includes a built-in web debugger that makes it easy to test functionality:

  1. Open your browser and navigate to http://127.0.0.1:6231
  2. Select the tool you want to use from the left panel
  3. Fill in the required parameters in the right panel
  4. Click "Run" to execute the tool and view results

This interface allows you to quickly test the server's capabilities without writing any code.

Available Tools

read_pdf_text

Extracts normal text from PDF documents, page by page.

Parameters:

  • file_path: Path to the PDF file
  • start_page: First page to extract (starting from 1)
  • end_page: Last page to extract

Example:

mcp run read_pdf_text --args '{"file_path": "pdf_resources/example.pdf", "start_page": 1, "end_page": 5}'

read_by_ocr

Uses Optical Character Recognition to extract text from scanned or image-based PDFs.

Parameters:

  • file_path: Path to the PDF file
  • start_page: First page to process
  • end_page: Last page to process
  • language: OCR language code (e.g., "eng" for English)
  • dpi: Resolution for OCR processing

Example:

mcp run read_by_ocr --args '{"file_path": "pdf_resources/example.pdf", "start_page": 1, "end_page": 1, "language": "eng"}'

read_pdf_images

Extracts all images from a specified page in the PDF.

Parameters:

  • file_path: Path to the PDF file
  • page_number: The page to extract images from

Example:

mcp run read_pdf_images --args '{"file_path": "pdf_resources/example.pdf", "page_number": 3}'

Important Notes

  • PDF files should be placed in the pdf_resources/ directory, or you can provide an absolute file path
  • When working with large PDF files, you may need to adjust timeout and memory settings
  • The OCR functionality requires appropriate OCR support in your environment

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "pdf-reader" '{"command":"python","args":["txt_server.py"]}'

See the official Claude Code MCP documentation for more details.

For 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 > Tools & Integrations and click "New MCP Server".

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

{
    "mcpServers": {
        "pdf-reader": {
            "command": "python",
            "args": [
                "txt_server.py"
            ]
        }
    }
}

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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "pdf-reader": {
            "command": "python",
            "args": [
                "txt_server.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

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