NDLOCR-lite MCP
NDLOCR-lite のCLIの薄いラッパーとして機能するMCPサーバ
必要なもの
- uv — パッケージマネージャ。公式インストール手順に従ってインストールしてください。
MCPクライアント別の設定マニュアル
Claude Desktop
-
設定ファイルをテキストエディタで開きます。
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
mcpServersに以下を追加します。{ "mcpServers": { "ndlocr-lite": { "command": "uvx", "args": ["ndlocr-lite-mcp"] } } }
-
Claude Desktop を再起動します。
Cursor
-
プロジェクトルートに
.cursor/mcp.jsonを作成します(グローバル設定の場合は~/.cursor/mcp.json)。 -
以下の内容を記述します。
{ "mcpServers": { "ndlocr-lite": { "command": "uvx", "args": ["ndlocr-lite-mcp"] } } }
-
Cursor を再起動します。
VS Code(GitHub Copilot)
-
プロジェクトルートに
.vscode/mcp.jsonを作成します。 -
以下の内容を記述します。
{ "servers": { "ndlocr-lite": { "command": "uvx", "args": ["ndlocr-lite-mcp"] } } }
-
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 |
自動変換(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)
| File | Size | Uploaded | |
|---|---|---|---|
| ndlocr_lite_mcp-0.2.0.tar.gz | 122.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 logRelease 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