EasyOCR MCP Server
EasyOCR MCPサーバー
EasyOCRライブラリを使用してOCR機能を提供するModel Context Protocol (MCP) サーバーです。
EasyOCRについて:
EasyOCRは、JaidedAIによって開発されたオープンソースの光学文字認識(OCR)ライブラリです。80以上の言語をサポートし、GPUアクセラレーションを提供しており、使いやすさと精度の高さで知られています。EasyOCRは画像、スキャンされたドキュメント、写真からテキストを抽出できるため、幅広いOCRタスクに適しています。詳細については、EasyOCR GitHubリポジトリをご覧ください。
機能
3つのOCRツール: Base64、ファイル、またはURLから画像を処理
多言語サポート: 動的な選択が可能な80以上の言語サポート
柔軟な出力: テキストのみ、または座標と信頼度を含む詳細な結果を選択可能
パフォーマンス最適化: パフォーマンス向上のためのリーダーキャッシュ
メモリ制御: 自動アンロードおよびリクエストごとのアンロードオプション
ネイティブEasyOCR出力: EasyOCRのオリジナル形式を返却
Related MCP server: RapidOCR MCP Server
インストール
GPUセットアップ
プロジェクト環境を作成する前に、GPUのパスを1つ選択してください。
NVIDIA GPU
OS、Pythonバージョン、CUDAバージョンに合わせて、公式のPyTorchインストールセレクターを使用してください:
PyTorchセレクターからの一般的なWindows pipの例:
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124インストール後、以下を確認してください:
python -c "import torch; print(torch.__version__); print(torch.cuda.is_available())"AMD GPU
AMD GPUのサポートはプラットフォームに依存します:
LinuxおよびWSL: 公式のROCm / Radeon PyTorchインストールガイドを使用してください
Windowsネイティブ: ROCmサポートは存在しますが、AMDはWindows上で完全なROCmスタックがまだサポートされていないと注記しています
公式リファレンス:
PyTorchローカルインストールガイド: https://docs.pytorch.org/get-started/locally/
AMD Windows互換性マトリックス: https://rocm.docs.amd.com/projects/radeon-ryzen/en/latest/docs/compatibility/compatibilityrad/windows/windows\\\\_compatibility.html
AMD PyTorchインストールガイド: https://rocm.docs.amd.com/projects/radeon-ryzen/en/latest/docs/install/installrad/wsl/install-pytorch.html
Windows上のこのリポジトリでは、テスト済みのパスとして、既存のROCm対応PyTorchインストールを以下で再利用します:
C:\Users\antonio\AppData\Local\Programs\Python\Python312\python.exeそのインタープリターは以下で検証されました:
python -c "import torch; print(torch.__version__); print(torch.cuda.is_available()); print(getattr(torch.version, 'hip', None))"AMD ROCmでの結果の期待される形状:
torch.cuda.is_available()がTrueを返すtorch.version.hipがNoneではない
プロジェクト環境
# Windows example used in this repo:
# C:\Users\antonio\AppData\Local\Programs\Python\Python312\python.exe
#
# Keep using uv, but create the venv from the existing Python 3.12 interpreter.
# `--system-site-packages` allows the venv to reuse packages already installed
# in that interpreter, such as an existing AMD-enabled PyTorch build.
# Create the project venv from the existing interpreter
uv venv --python C:\Users\antonio\AppData\Local\Programs\Python\Python312\python.exe --system-site-packages
# Sync this project's dependencies into the venv
uv sync
# Remove uv-installed CPU PyTorch packages so the venv falls back to the
# AMD ROCm build that already exists in Python312
uv pip uninstall torch torchvision
# Run tests through uv without re-syncing the environment
uv run --no-sync test.py
uv run --no-sync test-gpu.pyこれにより、既存の Python312 インストールをターゲットにしつつ、プロジェクトを uv で維持します。--system-site-packages を指定しない場合、通常のvenvはベースインタープリターに既にインストールされているパッケージを参照できません。初期セットアップ後は uv run --no-sync を使用して、uv がロックファイルからCPU専用のPyTorchホイールを再インストールしないようにしてください。
使用方法
利用可能なツール
ocr_image_base64- Base64エンコードされた画像を処理ocr_image_file- ディスク上の画像ファイルを処理ocr_image_url- URLからの画像を処理unload_ocr_models- メモリを解放するためにキャッシュされたOCRモデルをアンロード
パラメータ
detail: 出力詳細レベル (デフォルト:1)0: テキストのみ -['text1', 'text2', ...]1: 詳細 -[([[x1,y1], [x2,y2], [x3,y3], [x4,y4]], 'text', confidence), ...]
paragraph: 段落検出を有効にする (デフォルト:false)width_ths: マージのためのテキスト幅しきい値 (デフォルト:0.7)height_ths: マージのためのテキスト高さしきい値 (デフォルト:0.7)unload_jobdone: このOCR呼び出しの直後にモデルをアンロードする (デフォルト:UNLOAD_JOBDONEから)
注意: 言語選択は、MCP設定の EASYOCR_LANGUAGES 環境変数で構成されます(以下の「設定」セクションを参照)。
出力例
詳細レベル 1 (詳細):
[
([[189, 75], [469, 75], [469, 165], [189, 165]], '愚园路', 0.3754989504814148),
([[86, 80], [134, 80], [134, 128], [86, 128]], '西', 0.40452659130096436)
]詳細レベル 0 (テキストのみ):
['愚园路', '西', '东', '315', '309', 'Yuyuan Rd.', 'W', 'E']サーバーの実行
# Run the MCP server through uv
uv run --no-sync easyocr-mcp.pyMCP設定例
これを親MCPアプリケーションのサーバーとして実行している場合は、メインのMCP config.json で設定できます。
Windowsの例:
{
"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の例:
{
"mcpServers": {
"easyocr-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/project/easyocr-mcp",
"run",
"easyocr-mcp.py"
],
"env": {
"EASYOCR_LANGUAGES": "en,ch_tra,ja"
}
}
}
}環境変数
EASYOCR_LANGUAGES: 言語コードのカンマ区切りリスト (デフォルト:en)例:
en,en,ch_sim,ja,ko,en
EASYOCR_UNLOAD_TIMEOUT: 自動アンロードまでの非アクティブ秒数 (デフォルト:300,0で無効)UNLOAD_JOBDONE:trueの場合、デフォルトで各OCR呼び出し後にモデルをアンロードする (デフォルト:false)
サポートされている言語
EasyOCRは以下を含む80以上の言語をサポートしています:
en- 英語ch_sim- 中国語(簡体字)ch_tra- 中国語(繁体字)ja- 日本語ko- 韓国語fr- フランス語de- ドイツ語es- スペイン語その他多数...
GPU/CPU設定
GPUの使用は、easyocr-mcp.py を起動する環境内で認識されるPyTorchインストールによって決定されます。Python312 から --system-site-packages を指定して uv venvを作成した場合、サーバーはそのインタープリターにインストールされている既存のAMD対応PyTorchを再利用できます。
クイック検証コマンド:
uv run --no-sync python test-gpu.py
uv run --no-sync python test.py
uv run --no-sync python test_mcp_tools.pyこのリポジトリの検証済みAMDセットアップでは、test-gpu.py は以下を報告します:
ROCm対応の
torchビルドcuda_available=True空ではない
hip_version
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for Qwen Image 3 AI image generation
OCR.space MCP — wraps the OCR.space API (ocr.space) for image/PDF → text OCR.
MCP server for NanoBanana AI image generation and editing
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Related MCP Servers
- FlicenseAqualityDmaintenanceA Tesseract.js-based server that enables image-to-text recognition within MCP-compatible environments like Cursor. It supports multiple languages and common image formats, allowing users to extract text from local files using natural language commands.2-
- AlicenseAqualityDmaintenanceHigh-performance OCR MCP server supporting multiple input modes (path, base64, URL, upload), batch processing, and output formats like plain, JSON, and Markdown.42MIT
- AlicenseCqualityCmaintenanceA local OCR MCP server that extracts text from images using PP-OCRv6 for fast text extraction and VL-1.6 for document structure analysis, with automatic model routing and GPU detection.32MIT
- AlicenseNot gradedqualityBmaintenanceAn MCP server wrapping PaddleOCR to provide OCR text recognition for Chinese, English, Japanese, and Korean languages, supporting images from local paths, URLs, and base64 data.MIT