Sponsored by Deepsite.site

EasyOCR MCP tool

Created By
WindoC5 months ago
A Model Context Protocol (MCP) server that provides OCR capabilities using the EasyOCR library.
Content

EasyOCR MCP Server

A Model Context Protocol (MCP) server that provides OCR capabilities using the EasyOCR library.

About EasyOCR:
EasyOCR is an open-source Optical Character Recognition (OCR) library developed by JaidedAI. It supports over 80 languages, offers GPU acceleration, and is known for its ease of use and high accuracy. EasyOCR can extract text from images, scanned documents, and photos, making it suitable for a wide range of OCR tasks. For more details, visit the EasyOCR GitHub repository.

Features

  • 3 OCR Tools: Process images from base64, files, or URLs
  • Multi-language Support: Support for 80+ languages with dynamic selection
  • Flexible Output: Choose between text-only or detailed results with coordinates and confidence
  • Performance Optimized: Reader caching for better performance
  • Native EasyOCR Output: Returns EasyOCR's original format

Installation

# Install PyTorch with GPU support. Skip this step if you plan to use CPU only.
# For GPU support, adjust the command based on your system. For details, see: https://pytorch.org/get-started/locally/
uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128

# Install all dependencies
uv sync

# Run tests to verify the implementation
uv run test.py
uv run test-gpu.py

Usage

Available Tools

  1. ocr_image_base64 - Process base64 encoded images
  2. ocr_image_file - Process image files from disk
  3. ocr_image_url - Process images from URLs

Parameters

  • detail: Output detail level (default: 1)
    • 0: Text only - ['text1', 'text2', ...]
    • 1: Full details - [([[x1,y1], [x2,y2], [x3,y3], [x4,y4]], 'text', confidence), ...]
  • paragraph: Enable paragraph detection (default: false)
  • width_ths: Text width threshold for merging (default: 0.7)
  • height_ths: Text height threshold for merging (default: 0.7)

Note: Language selection is configured via the EASYOCR_LANGUAGES environment variable in your MCP configuration (see Configuration section below).

Example Output

Detail Level 1 (Full Details):

[
    ([[189, 75], [469, 75], [469, 165], [189, 165]], '愚园路', 0.3754989504814148),
    ([[86, 80], [134, 80], [134, 128], [86, 128]], '西', 0.40452659130096436)
]

Detail Level 0 (Text Only):

['愚园路', '西', '东', '315', '309', 'Yuyuan Rd.', 'W', 'E']

Running the Server

# Run the MCP server
uv run easyocr-mcp.py

# Or use mcp command
mcp run easyocr-mcp.py

MCP Configuration Example

If you are running this as a server for a parent MCP application, you can configure it in your main MCP config.json.

Windows Example:

{
  "mcpServers": {
    "easyocr-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "X:\\path\\to\\your\\project\\easyocr-mcp",
        "run",
        "easyocr-mcp.py"
      ],
      "env": {
        "EASYOCR_LANGUAGES": "en,ch_tra,ja"
      }
    }
  }
}

Linux/macOS Example:

{
  "mcpServers": {
    "easyocr-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/your/project/easyocr-mcp",
        "run",
        "easyocr-mcp.py"
      ],
      "env": {
        "EASYOCR_LANGUAGES": "en,ch_tra,ja"
      }
    }
  }
}

Environment Variables

  • EASYOCR_LANGUAGES: Comma-separated list of language codes (default: en)
    • Examples: en, en,ch_sim, ja,ko,en

Supported Languages

EasyOCR supports 80+ languages including:

  • en - English
  • ch_sim - Chinese Simplified
  • ch_tra - Chinese Traditional
  • ja - Japanese
  • ko - Korean
  • fr - French
  • de - German
  • es - Spanish
  • And many more...

GPU/CPU Configuration

GPU usage is determined at installation time based on your PyTorch installation. No runtime configuration needed.

Server Config

{
  "mcpServers": {
    "easyocr-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/your/project/easyocr-mcp",
        "run",
        "easyocr-mcp.py"
      ],
      "env": {
        "EASYOCR_LANGUAGES": "en,ch_tra,ja"
      }
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Amap Maps高德地图官方 MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
CursorThe AI Code Editor
ChatWiseThe second fastest AI chatbot™
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
WindsurfThe new purpose-built IDE to harness magic
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Serper MCP ServerA Serper MCP Server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Playwright McpPlaywright MCP server
DeepChatYour AI Partner on Desktop
Tavily Mcp
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.