unlimited-ocr-mcp
Exposes OCR tools for CrewAI agents to extract text from images and PDF documents.
Enables LangChain agents to invoke OCR tools for parsing single images, multiple images, and PDF documents.
Provides OpenAI-compatible tool schemas so applications using OpenAI-style function calling can invoke the OCR tools.
Click on "Deploy 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., "@unlimited-ocr-mcp Extract the text from the PDF at ./documents/scanned.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.
Unlimited-OCR MCP Server
MCP (Model Context Protocol) Server and Tool definitions for Unlimited-OCR — enables Agent frameworks (LangChain, DuMate, AutoGPT, CrewAI, etc.) to invoke OCR as a structured tool.
Features
MCP Server — exposes OCR capabilities via the Model Context Protocol (stdio & SSE transport)
OpenAI-compatible Tool Definitions — JSON schemas for function calling
Dual Backend — supports both local Transformers inference and remote vLLM/SGLang HTTP API
Three OCR Modes — single image (
gundam/base), multi-image, and PDFFull Parameter Coverage —
crop_mode,ngram,max_length,dpi, etc.
Related MCP server: GLM OCR MCP Server
Quick Start
Install
pip install -e ".[all]"
# Or minimal install (HTTP backend only):
pip install -e ".[pdf]"Start MCP Server
Option 1: HTTP backend (vLLM / SGLang server)
# Start an SGLang/vLLM server first
python -m sglang.launch_server \
--model baidu/Unlimited-OCR \
--served-model-name Unlimited-OCR \
--port 10000 ...
# Then start the MCP server
UNLIMITED_OCR_BACKEND=http \
UNLIMITED_OCR_SERVER_URL=http://127.0.0.1:10000 \
python -m mcp.serverOption 2: Transformers backend (local GPU)
UNLIMITED_OCR_BACKEND=transformers \
UNLIMITED_OCR_MODEL=baidu/Unlimited-OCR \
python -m mcp.serverOption 3: SSE transport (for remote agents)
UNLIMITED_OCR_BACKEND=http \
python -m mcp.server --transport sse --port 8080Configure in Agent Frameworks
Claude Desktop / MCP Client
Add to your MCP client config:
{
"mcpServers": {
"unlimited-ocr": {
"command": "python",
"args": ["-m", "mcp.server"],
"env": {
"UNLIMITED_OCR_BACKEND": "http",
"UNLIMITED_OCR_SERVER_URL": "http://127.0.0.1:10000"
}
}
}
}LangChain (direct tool call)
from skill.tool_definitions import call_tool
# Direct call — no LLM orchestrator needed
result = call_tool("ocr_parse_image", {
"image_path": "document.jpg",
"image_mode": "gundam",
})
print(result["text"])LangChain (LLM tool calling)
from skill.tool_definitions import get_openai_tools
from mcp.ocr_engine import OCREngine
tools = get_openai_tools()
llm_with_tools = llm.bind_tools(tools)
# The LLM decides when to call OCR
response = llm_with_tools.invoke("Parse the document at document.jpg")See examples/langchain_integration.py for a complete example.
Available Tools
ocr_parse_image
Parse a single image using Unlimited-OCR.
Parameter | Type | Default | Description |
| string | required | Path to the image file |
|
|
| Image processing mode |
| string | — | Directory to save results |
| int | 35 | N-gram repetition penalty |
| int | 128 | N-gram window size |
| int | 32768 | Max output token length |
Image modes:
gundam(default):base_size=1024,image_size=640,crop_mode=True— recommended for most imagesbase:base_size=1024,image_size=1024,crop_mode=False— full image processing
ocr_parse_multi
Parse multiple images (multi-page). Always uses base mode.
Parameter | Type | Default | Description |
| string[] | required | List of image paths |
| string | — | Directory to save results |
| int | 35 | N-gram repetition penalty |
| int | 1024 | N-gram window size |
| int | 32768 | Max output token length |
ocr_parse_pdf
Parse a PDF document (auto-converts pages to images, then multi-page OCR).
Parameter | Type | Default | Description |
| string | required | Path to the PDF file |
| int | 300 | DPI for PDF-to-image conversion |
| string | — | Directory to save results |
| int | 35 | N-gram repetition penalty |
| int | 1024 | N-gram window size |
| int | 32768 | Max output token length |
Configuration
Environment variables:
Variable | Default | Description |
|
| Backend: |
|
| Model name or path |
|
| vLLM/SGLang server URL |
|
| Torch dtype (transformers only) |
|
| Device (transformers only) |
Project Structure
unlimited-ocr-mcp/
├── mcp/ # MCP Server
│ ├── __init__.py
│ ├── ocr_engine.py # OCR engine (Transformers + HTTP backends)
│ ├── server.py # MCP Server (stdio + SSE transport)
│ └── pdf_utils.py # PDF to image conversion
├── skill/ # Skill / Tool definitions
│ ├── _meta.json # Skill metadata
│ ├── SKILL.md # Skill definition (name, description, instructions)
│ ├── skill-card.md # Skill card (publisher, use case, risks)
│ ├── tool_definitions.py # OpenAI-compatible tool definitions (Python)
│ └── openai_tools.json # Standalone tool schema (JSON)
├── examples/
│ ├── langchain_integration.py
│ └── mcp_client_example.py
├── pyproject.toml
├── requirements.txt
├── LICENSE
└── README.mdRequirements
Python >= 3.10
MCP backend:
mcpSDK >= 1.0.0Transformers backend:
torch,transformers,Pillow,einops,addict,easydictHTTP backend:
requests(vLLM or SGLang server running separately)PDF support:
pymupdf>= 1.23.0
Related
Unlimited-OCR — the upstream OCR model
MCP Specification — Model Context Protocol docs
Feature Request Issue #97 — the original proposal
License
Apache License 2.0
Available Tools
3 toolsocr_parse_imageB
Parse a single image using Unlimited-OCR. Supports 'gundam' (crop mode) and 'base' modes.
Inputs: image_path (required), image_mode, max_length, output_dir, +2 more.
ocr_parse_multiB
Parse multiple images (multi-page) using Unlimited-OCR.
Inputs: image_paths (required), max_length, output_dir, ngram_window, +1 more.
ocr_parse_pdfC
Parse a PDF document using Unlimited-OCR.
Inputs: pdf_path (required), dpi, max_length, output_dir, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool targets a distinct input type: a single image, multiple images, or a PDF. The descriptions make the boundaries clear, so an agent can select the correct tool without confusion.
All tools follow the consistent 'ocr_parse_<input>' pattern using snake_case. The naming is predictable and immediately communicates each tool's purpose.
Three tools is a well-scoped size for an OCR-focused server, covering the main input types without unnecessary bloat.
The tool surface covers the core OCR workflows: single images, multi-image batches, and PDFs. There are no obvious missing operations for the stated purpose.
Maintenance
Related MCP Connectors
OCR for agents: PDFs and images to Markdown or JSON, routed across OCR models. Free models included.
Document conversion and OCR for AI agents: PDF, Office docs, images to text.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
PDF and image tools for AI agents: compress, merge, split, OCR, sign. Runs locally, never uploads.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to recognize and extract text from images using PaddleOCR, supporting both file paths and base64 input with structured results including confidence scores and text positions.21MIT
- FlicenseAqualityCmaintenanceEnables text extraction from images and PDF files using the ZhipuAI GLM-OCR API. It allows users to process documents through local file paths or base64-encoded data for high-quality OCR results.15-
- FlicenseNot gradedqualityDmaintenanceProvides OCR capabilities for images and PDFs using Mistral AI's OCR API, supporting both local files and URLs with output in markdown or JSON format.-
- AlicenseAqualityDmaintenanceEnables AI agents to convert images and PDFs, including large scanned books, into Markdown through GLM-OCR, with support for long-image slicing, progress tracking, and asynchronous OCR tasks.71MIT