Skip to main content

NDLOCR-lite MCP

NDLOCR-lite のCLIの薄いラッパーとして機能するMCPサーバ

Ko-fi


必要なもの


MCPクライアント別の設定マニュアル

Claude Desktop

  1. 設定ファイルをテキストエディタで開きます。

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. mcpServers に以下を追加します。

    {
      "mcpServers": {
        "ndlocr-lite": {
          "command": "uvx",
          "args": ["ndlocr-lite-mcp"]
        }
      }
    }
    
  3. Claude Desktop を再起動します。


Cursor

  1. プロジェクトルートに .cursor/mcp.json を作成します(グローバル設定の場合は ~/.cursor/mcp.json)。

  2. 以下の内容を記述します。

    {
      "mcpServers": {
        "ndlocr-lite": {
          "command": "uvx",
          "args": ["ndlocr-lite-mcp"]
        }
      }
    }
    
  3. Cursor を再起動します。


VS Code(GitHub Copilot)

  1. プロジェクトルートに .vscode/mcp.json を作成します。

  2. 以下の内容を記述します。

    {
      "servers": {
        "ndlocr-lite": {
          "command": "uvx",
          "args": ["ndlocr-lite-mcp"]
        }
      }
    }
    
  3. VS Code を再起動し、Copilot Chat から MCP ツールが利用可能になっていることを確認します。


ツールリファレンス

ocr_file

1つのファイルに対してOCRを実行します。

パラメータ

パラメータ 型 デフォルト 説明
source string 必須 ファイルの絶対パスまたは相対パス
viz boolean false 認識領域の可視化画像を生成するか
enable_tcy boolean false 縦中横の読み取り改善を有効にするか
output_dir string null 出力先ディレクトリ(省略時は一時ディレクトリ。viz を保持したい場合は指定)

レスポンス

{
  "source": "/path/to/image.webp",
  "pages": [
    {
      "page": 1,
      "text": "認識されたテキスト全文",
      "regions": [
        {
          "order": 0,
          "type": "本文",
          "text": "行のテキスト",
          "bbox": [100, 200, 400, 30],
          "conf": 0.942
        }
      ],
      "viz_path": "/path/to/output/viz_image.jpg"
    }
  ]
}
  • viz_path は viz=true かつ output_dir を指定した場合のみ含まれます。
  • PDF は1ページにつき1エントリが pages に追加されます(複数ページ PDF は pages の要素数がページ数と一致します)。

ocr_directory

ディレクトリ内のすべての対応ファイルに対してOCRを実行します。

パラメータ

source にディレクトリパスを指定する点以外は ocr_file と同じです。

パラメータ 型 デフォルト 説明
source string 必須 ディレクトリの絶対パスまたは相対パス
viz boolean false 認識領域の可視化画像を生成するか
enable_tcy boolean false 縦中横の読み取り改善を有効にするか
output_dir string null 出力先ディレクトリ(省略時は一時ディレクトリ。viz を保持したい場合は指定)

レスポンス

{
  "source": "/path/to/dir",
  "files": [
    {
      "file": "image01.jpg",
      "pages": [{ "page": 1, "text": "...", "regions": [] }]
    },
    {
      "file": "broken.heic",
      "error": "conversion failed: ..."
    }
  ]
}
  • 変換またはOCRに失敗したファイルは pages の代わりに error フィールドを持ちます。

対応フォーマット一覧

フォーマット 拡張子 備考
JPEG .jpg .jpeg ネイティブ対応
PNG .png ネイティブ対応
TIFF .tiff .tif ネイティブ対応
JPEG 2000 .jp2 ネイティブ対応
BMP .bmp ネイティブ対応
WebP .webp 自動変換(Pillow)
GIF .gif 自動変換(Pillow、最初のフレームのみ)
AVIF .avif 自動変換(Pillow)
HEIC/HEIF .heic .heif 自動変換(pillow-heif)
SVG .svg 自動変換(cairosvg、要libcairo2)
PDF .pdf 自動変換(pymupdf、全ページ処理)

NDLOCR-lite 帰属表示

本プロジェクトは国立国会図書館が CC BY 4.0 ライセンスで公開している NDLOCR-lite を利用しています。


ライセンス

MIT License

Metadata

Release files for ndlocr-lite-mcp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ndlocr-lite-mcp 0.2.0
File Size Uploaded
ndlocr_lite_mcp-0.2.0.tar.gz 122.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ndlocr-lite-mcp 0.2.0
File Interpreter ABI Platform
ndlocr_lite_mcp-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 131.5 kB

Release files / ndlocr_lite_mcp-0.2.0.tar.gz

Download URL ndlocr_lite_mcp-0.2.0.tar.gz
Size 122.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0a49595bc15a1ac0574cb41b2abdc11a1c3c099d4856c228c1fd8fa81eedc37d
BLAKE2b-256 checksum
How to use checksums
8a92eb74becc39b7e0fd4601d2d477564d0971902cc3e8426e3b19f16aaeaf94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.

Transparency log

Release files / ndlocr_lite_mcp-0.2.0-py3-none-any.whl

Download URL ndlocr_lite_mcp-0.2.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e2d72c3321ac8b802ba92cbd643a92b693d31e5afe652d40a527ce03d469e24
BLAKE2b-256 checksum
How to use checksums
519015c3449f1b513537c742f6ba3ed879622fb5c9af9c5af0a7be875246ff40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page