- Home
- MCP servers
- MCP PDF Server
MCP PDF Server
- python
35
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"deepseekmine-mcp-pdf-reader": {
"command": "python",
"args": [
"txt_server.py"
]
}
}
}You can run a lightweight MCP server that reads PDFs by extracting text, applying OCR to image-based PDFs, and pulling images from pages. It includes a built‑in web debugger for easy testing, making it straightforward to verify each tool’s output before integrating into larger workflows.
How to use
You interact with the PDF reading MCP server by starting a local stdio MCP endpoint and then issuing tool calls from an MCP client. The server exposes three main tools you can run: read_pdf_text to extract normal text page by page, read_by_ocr to recognize text via OCR on scanned or image PDFs, and read_pdf_images to pull images from a specified PDF page.
How to install
python
- Install Python 3.9 or newer if you do not have it already.
- Install required Python packages:
pip install pymupdf mcp
- Start the server:
python txt_server.py
- Access the web debugger at:
http://127.0.0.1:6231
Notes
- To enable OCR features, ensure your MuPDF build includes OCR support or you have external OCR libraries available.
Configuration and usage notes
Place PDF files you want to process inside the pdf_resources/ directory. You can also provide absolute file paths when calling tools. The web debugging interface helps you test each tool by selecting it from the left panel, entering parameters on the right panel, and clicking Run.
Web debugger URL: http://127.0.0.1:6231. Tools available: read_pdf_text, read_by_ocr, read_pdf_images. OCR support requires an environment with OCR capability. For large files, monitor memory usage and adjust accordingly.
Troubleshooting and tips
If you do not see the server listening message, verify that you started the correct script (txt_server.py) and that Python is available in your system path. If OCR fails, confirm that OCR libraries are installed and that your MuPDF build supports OCR.
Example workflow with the MCP client
- Extract text from pages 1 through 5 from a PDF located at pdf_resources/example.pdf using read_pdf_text. - Perform OCR on page 1 of the same document with read_by_ocr. - Extract all images from page 3 with read_pdf_images.
Available tools
read_pdf_text
Extracts normal text from PDF pages, returning text organized by page.
read_by_ocr
Recognizes text via OCR for scanned or image-based PDFs, with language and DPI options.
read_pdf_images
Extracts images from a specific PDF page, outputting images in Base64 encoding.