Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Tesseract PDF MCP Serverextract text from the quarterly report PDF in English"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Tesseract PDF MCP Server
A Model Context Protocol (MCP) server that provides OCR capabilities for PDF documents using Tesseract OCR. This server allows AI assistants to extract text from PDF files, supporting multiple languages including English and Simplified Chinese out of the box.
Features
PDF to Text Conversion: Extract text from PDF documents using OCR technology
Multi-language Support: Process documents in multiple languages (English and Simplified Chinese by default)
Dockerized Solution: Easy deployment with Docker
MCP Integration: Seamlessly integrates with AI assistants that support the Model Context Protocol
Prerequisites
Docker installed on your system
Build Instructions
Build the Docker image with the following command:
Running the Server
Run the MCP server with the following command:
Important Notes:
The
-v /path/to/your/pdfs:/pdfsoption mounts a volume from your host system to the Docker container, allowing the server to access PDF files.Replace
/path/to/your/pdfswith the actual path to the directory containing your PDF files.The server will be accessible via standard input/output (stdio) as specified in the MCP protocol.
Usage
The server provides a tool called convert_pdf that can be used to extract text from PDF files.
Input
The convert_pdf tool accepts the following JSON input:
Parameters:
file_path(required): Path to the PDF file to process. This should be the path inside the container (e.g.,/pdfs/document.pdf).language(optional): Language for OCR processing. Default is"eng"(English).Available languages by default:
"eng"(English),"chi_sim"(Simplified Chinese)
Output
The tool returns a JSON response with the following structure:
On success:
status: Will be"success"output_path: The absolute path to the generated text file
On error:
status: Will be"error"message: Error descriptionoutput_path: Will benull
Example Usage
When connected to an AI assistant that supports MCP:
The assistant can use the
convert_pdftool to extract text from a PDF fileThe text file will be created in the same directory as the PDF file
The assistant can then access the text file to analyze its contents
Connecting to AI Tools
To connect this MCP server to AI tools that support the Model Context Protocol, you'll need to configure the tool with the appropriate settings.
Configuration Example
Add the following configuration to your AI tool's settings:
Make sure to replace /path/to/your/pdfs with the actual path to your PDF files directory.
Usage with AI Tools
Once connected:
The AI tool will have access to the
convert_pdftool provided by this MCP serverYou can ask the AI to extract text from PDF documents
The AI will use the MCP server to process the PDFs and access the resulting text
Adding More Languages
The server comes with English (eng) and Simplified Chinese (chi_sim) language support by default. To add more languages:
Modify the
Dockerfileby adding additional language packs to theapt-get installcommand:
Rebuild the Docker image:
Available Language Codes
Some common language codes for Tesseract OCR:
eng: Englishchi_sim: Simplified Chinesechi_tra: Traditional Chinesefra: Frenchdeu: Germanspa: Spanishita: Italianjpn: Japanesekor: Koreanrus: Russian
For a complete list of available language packs, refer to the Tesseract documentation.
Debugging Inside the Container
If you need to debug or test the PDF conversion logic directly inside the container, follow these steps:
Starting an Interactive Shell
Launch an interactive shell session in the container with the following command:
This command:
Creates a container from the
tesseract-pdf-mcpimageMounts your local PDF directory to
/datainside the containerOverrides the default command to start a bash shell
Removes the container automatically when you exit (
--rm)
Working Inside the Container
Once inside the container's shell, you can:
Navigate the filesystem using standard Linux commands (
cd,ls, etc.)Access your mounted PDFs in the
/datadirectoryRun Python scripts or start an interactive Python session
Testing the Conversion Function
You can test the PDF to text conversion directly using Python's interactive shell:
The converted text file will be saved in the same directory as your PDF file (in the /data directory), making it accessible from your host machine as well.