Skip to main content

MCP server wrapping the NDLOCR-lite CLI

Project description

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_pathviz=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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ndlocr_lite_mcp-0.2.0.tar.gz (122.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ndlocr_lite_mcp-0.2.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file ndlocr_lite_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: ndlocr_lite_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 122.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ndlocr_lite_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0a49595bc15a1ac0574cb41b2abdc11a1c3c099d4856c228c1fd8fa81eedc37d
MD5 bb481415f5f4e62867f4477111b21afd
BLAKE2b-256 8a92eb74becc39b7e0fd4601d2d477564d0971902cc3e8426e3b19f16aaeaf94

See more details on using hashes here.

Provenance

The following attestation bundles were made for ndlocr_lite_mcp-0.2.0.tar.gz:

Publisher: publish.yml on HizZaniya/ndlocr-lite-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ndlocr_lite_mcp-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ndlocr_lite_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e2d72c3321ac8b802ba92cbd643a92b693d31e5afe652d40a527ce03d469e24
MD5 5d0ce25087feb593435543738b0e48ef
BLAKE2b-256 519015c3449f1b513537c742f6ba3ed879622fb5c9af9c5af0a7be875246ff40

See more details on using hashes here.

Provenance

The following attestation bundles were made for ndlocr_lite_mcp-0.2.0-py3-none-any.whl:

Publisher: publish.yml on HizZaniya/ndlocr-lite-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page