Tesseract OCR MCP Server
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 OCR MCP Serverextract text from the attached image"
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 OCR MCP Server
A lightweight, containerized Model Context Protocol (MCP) server and HTTP API for Tesseract OCR. Built on Alpine Linux, it allows AI assistants (like Claude Desktop, Cursor, or Windsurf) and standard applications to perform Optical Character Recognition via stdin/stdout streams or REST API endpoints.
🚀 Features
Dual Mode Operation: Run as an MCP server (stdin/stdout) for AI integration, an HTTP REST API, or both simultaneously.
Lightweight: Based on
jitesoft/tesseract-ocr:alpine(~43MB base).Secure: Optional API Key authentication for HTTP endpoints.
Flexible Input: Accepts file uploads, base64 encoded strings, or file paths.
Configurable: Control ports, host, languages, and modes via environment variables.
Auto-Cleanup: Temporary files are automatically managed and deleted after processing.
Related MCP server: Gemini OCR MCP Server
📋 Prerequisites
Docker & Docker Compose
Portainer or Dockhand (optional, for GUI management)
An MCP Client (e.g., Claude Desktop, Cursor IDE) if using MCP mode
🛠️ Installation & Deployment
1. Clone the Repository
git clone <your-repo-url>
cd tesseract-mcp-server2. Configure Environment
Copy the example environment file and edit it to suit your needs:
cp .env.example .env
nano .envKey Configuration Options:
Variable | Default | Description |
|
| Enable MCP stdio protocol (for AI assistants). |
|
| Enable HTTP REST API. |
|
| Port for the HTTP server. |
|
| Host interface to bind to. |
| `` | Recommended. Set a secret key to protect HTTP endpoints. |
|
| Default OCR language code (e.g., |
|
| Max upload size in bytes (default 10MB). |
3. Deploy with Docker Compose
docker-compose up -d --build4. Deploy via Portainer / Dockhand
Go to Stacks > Add Stack.
Paste the contents of
docker-compose.yml.In the Environment Variables section, add your desired config (see
.env.example).Click Deploy.
🔌 Usage Modes
Mode 1: HTTP API (REST)
If HTTP_ENABLED=true, the server exposes REST endpoints.
🔐 Authentication
If API_KEY is set in your environment, you must include it in every request via:
Header:
x-api-key: YOUR_API_KEYQuery Param:
?api_key=YOUR_API_KEY
Endpoints
1. Health Check
curl http://localhost:3000/health2. OCR via File Upload
curl -X POST http://localhost:3000/ocr \
-H "x-api-key: YOUR_API_KEY" \
-F "image=@path/to/image.png" \
-F "language=eng" \
-F "output_format=text"3. OCR via Base64
curl -X POST http://localhost:3000/ocr/base64 \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image_data": "iVBORw0KGgoAAAANSUhEUg...",
"language": "eng",
"output_format": "text"
}'4. Get Configuration
curl http://localhost:3000/config \
-H "x-api-key: YOUR_API_KEY"Mode 2: MCP Server (AI Integration)
If MCP_ENABLED=true, the server listens on stdin/stdout. This is designed to be connected to AI clients like Claude Desktop or Cursor.
Setup for Claude Desktop
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"tesseract-ocr": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MCP_ENABLED=true",
"-e",
"HTTP_ENABLED=false",
"your-image-name:latest"
]
}
}
}Note: Ensure the image is built locally or available in your registry.
Available MCP Tools
ocr_image: Process an image from a path or base64 string.ocr_from_stdin: Process raw base64 image data.get_config: Retrieve current server configuration.
🌍 Supported Languages
Tesseract supports many languages. You must install the specific language packs in the Docker image if you need more than English.
To add languages, modify the Dockerfile.mcp:
RUN apk add --no-cache tesseract-ocr-fra tesseract-ocr-deuThen specify the language in your request:
{ "language": "fra" } // FrenchCommon codes: eng (English), spa (Spanish), fra (French), deu (German), chi_sim (Chinese Simplified).
🏗️ Project Structure
.
├── docker-compose.yml # Deployment configuration
├── Dockerfile.mcp # Image build instructions
├── package.json # Node.js dependencies
├── server.js # Main application logic (MCP + HTTP)
├── .env.example # Example environment variables
└── README.md # This file🔒 Security Best Practices
Always set an
API_KEYin production environments when exposing HTTP ports.Restrict
HOST: If running locally, setHOST=127.0.0.1to prevent external access.Limit File Size: Adjust
MAX_FILE_SIZEto prevent denial-of-service via large uploads.Read-Only Volumes: If mounting volumes for input, mount them as read-only (
:ro) where possible.
🐛 Troubleshooting
Q: The container starts but exits immediately.
A: Check logs with docker logs tesseract-mcp-server. Ensure MCP_ENABLED or HTTP_ENABLED is set to true. If both are false, the server has nothing to do.
Q: I get "Unauthorized" errors.
A: You have set an API_KEY in your environment but are not sending it in the request headers or query parameters.
Q: OCR accuracy is low.
A: Try preprocessing the image (increasing contrast, resizing) before sending it. You can also experiment with the psm (Page Segmentation Mode) parameter in the MCP tool arguments.
📄 License
MIT License. Feel free to use and modify.
🙏 Credits
Base Image: jitesoft/tesseract-ocr
MCP SDK: @modelcontextprotocol/sdk
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/daboatan/tesseract-ocr-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server