ocrmypdf-mcp
Allows OCR processing of PDF attachments in a Zotero library, including batch OCR of all PDFs in the Zotero storage folder and single attachment OCR by storage key.
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., "@ocrmypdf-mcpAdd searchable text to my scanned document.pdf"
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.
ocrmypdf-mcp
A local Model Context Protocol (MCP) server that wraps OCRmyPDF, letting Claude Desktop (or any MCP client) add searchable text layers to scanned PDFs — with first-class support for batch-processing a Zotero library.
Everything runs locally. No documents leave your machine.
⚠️ Important: files are modified in place
By default, the OCR tools overwrite your original PDFs with the OCR'd version. This is intentional (so Zotero re-indexes the same attachment), but it means:
Back up your PDFs (or your Zotero storage folder) before a large batch run.
Use
dry_run: true(supported by all three OCR tools) to preview what would be processed.Use the
limitparameter ofbatch_ocr_folderfor small trial runs before processing an entire library.
⚠️ Risk of PDF damage or data loss
Any tool that rewrites PDFs can, in rare cases, produce a broken or degraded file. Be aware of the following before running OCR over documents you cannot re-download:
A rewritten PDF is a different file. Even in the safest mode the whole document is re-serialized. A malformed-but-viewable source PDF (some viewers tolerate damage that PDF libraries do not) may fail to convert, or convert with missing content. Files that OCRmyPDF cannot parse are reported as
failedand left untouched — but verify a sample of outputs after a large batch.Interrupted runs: OCRmyPDF writes to a temporary file and only replaces the original on success, so a crash or forced shutdown mid-run should not corrupt the source — but do not kill the process while it is copying the final output into place.
force=trueis destructive. It rasterizes every page: existing text layers, vector graphics, and annotations are permanently replaced by a flat image plus new OCR text. Use it only on documents whose existing text layer is garbage.Wrong language = garbage text layer. OCR with a language that doesn't match the document produces nonsense text that then makes the file look "already searchable" to future runs.
There is no undo. The tools do not keep backups. If the documents are irreplaceable, copy the folder first.
Related MCP server: Tesseract PDF MCP Server
Tools
Tool | Description | Modifies files |
| Report whether a PDF already has a searchable text layer | No |
| OCR a single PDF (in place, or to a new output path); supports | Yes |
| Start a background job that OCRs all PDFs under a folder, skipping ones that already have text; supports | Yes |
| Progress and per-file results of background jobs (or list all jobs) | No |
| Stop a running background job before its next file | No |
| OCR the PDF(s) under a Zotero storage key, in place; supports | Yes |
All tools follow the same rule: a PDF that already has a text layer is never touched. A PDF without one gets a text layer added while the original page images are preserved exactly (no deskew, no rotation, no recompression, no PDF/A conversion — unless you explicitly opt in via the deskew, rotate, or optimize parameters, which do alter the page images).
Prerequisites
What | Why | How to get it |
Python 3.10+ | Runs the server | |
Tesseract OCR 5.x | The OCR engine | Windows: |
Tesseract language packs for every language you OCR | Wrong/missing packs produce garbage text | Select them in the Windows installer, or drop |
Used by OCRmyPDF for PDF rendering | Windows: | |
Python packages ( | Server + PDF processing |
|
Note: Tesseract cannot auto-detect document language — it only detects script/orientation. Set ocr_default_lang to a +-joined list matching your library (e.g. eng+ces), and pass language explicitly per call for outliers (e.g. jpn+jpn_vert). Keep the list short: every extra language slows OCR and increases misreads.
Tested with Python 3.12, OCRmyPDF 16.x, Tesseract 5.4, Ghostscript 10.x on Windows 11.
Installation
git clone https://github.com/chemysterium/ocrmypdf-mcp.git
cd ocrmypdf-mcp
pip install -r requirements.txtVerify OCRmyPDF can find its dependencies:
ocrmypdf --versionConfiguration
Copy the template and edit it with your paths:
cp config.example.json config.jsonconfig.json (machine-specific, gitignored — never commit it):
{
"zotero_storage": "C:\\Users\\<you>\\Zotero\\storage",
"ocr_default_lang": "eng",
"tesseract_path": "C:\\Program Files\\Tesseract-OCR"
}Key | Meaning |
| Root of your Zotero |
| Tesseract language code(s), |
| Folder containing the Tesseract executable. Leave |
Settings can also be supplied (and are overridden) by environment variables:
ZOTERO_STORAGE, OCR_DEFAULT_LANG, TESSERACT_PATH.
To keep config.json somewhere else, point the OCRMYPDF_MCP_CONFIG env var at it.
Claude Desktop setup
Add to your claude_desktop_config.json (Settings → Developer → Edit Config), inside "mcpServers":
"ocrmypdf": {
"command": "python",
"args": ["C:\\path\\to\\ocrmypdf-mcp\\ocrmypdf_server.py"]
}If Claude Desktop can't find python, use the full path to your interpreter. Restart Claude Desktop; four new tools should appear.
Usage examples
Ask Claude things like:
"Check whether
C:\scans\paper.pdfneeds OCR.""Do a dry run of batch OCR on my Zotero storage folder and tell me how many files would be processed."
"OCR the first 10 scanned PDFs in
D:\archive, English plus Czech.""OCR the Zotero attachment
AB12CD34in place."
A sensible workflow for a large Zotero library:
batch_ocr_folderwithdry_run: true, then pollbatch_status→ see the scopebatch_ocr_folderwithlimit: 5→ verify quality on a handful of filesFull run — start the job, then check
batch_statusoccasionally (OCR is CPU-intensive; a large library can take hours)
Long runs and client timeouts
MCP clients abort tool calls that take too long — Claude Desktop's limit is about 60 seconds and is not configurable. Even scanning a large library for text layers can exceed that, let alone OCR-ing it.
batch_ocr_folder therefore returns immediately with a job_id while the work continues inside the server process. Poll batch_status for counters (scanned, processed, skipped, failed), the file currently being OCR'd, and recent per-file results. cancel_batch stops a job cleanly between files.
Notes:
Jobs live in server memory. If the MCP client (and thus the server) restarts, the job stops — files already OCR'd keep their text layer, no file is left half-written (OCRmyPDF replaces files atomically on success), and you can simply start the batch again: already-processed files are skipped.
ocr_pdfandocr_zotero_attachmentrun synchronously. For a single normal-sized document they finish well within the timeout; a very large single PDF (hundreds of scanned pages) may exceed it — the client shows an error, but the OCR still completes in the background and the file gets its text layer.
How it decides what to skip
A PDF is considered "already searchable" if its content streams (including Form XObjects) contain a meaningful number of PDF text-show operators. This is a fast heuristic — a stray stamp, watermark, or publisher header won't count as a real text layer.
Files that pass the check are never opened for writing. Files that fail it are OCR'd in OCRmyPDF's redo_ocr mode, which handles mixed pages correctly: existing real text (e.g. a journal header on a scanned page) is kept, image regions get OCR text, and nothing is rasterized. If you enable deskew or rotate (incompatible with redo_ocr), the tool falls back to skip_text mode, which skips any page already containing text.
License
MIT — see LICENSE. OCRmyPDF itself is licensed under MPL-2.0 and is used here as an unmodified dependency.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/chemysterium/ocrmypdf-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server