MCP server wrapping the NDLOCR-lite CLI
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a49595bc15a1ac0574cb41b2abdc11a1c3c099d4856c228c1fd8fa81eedc37d
|
|
| MD5 |
bb481415f5f4e62867f4477111b21afd
|
|
| BLAKE2b-256 |
8a92eb74becc39b7e0fd4601d2d477564d0971902cc3e8426e3b19f16aaeaf94
|
Provenance
The following attestation bundles were made for ndlocr_lite_mcp-0.2.0.tar.gz:
Publisher:
publish.yml on HizZaniya/ndlocr-lite-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ndlocr_lite_mcp-0.2.0.tar.gz -
Subject digest:
0a49595bc15a1ac0574cb41b2abdc11a1c3c099d4856c228c1fd8fa81eedc37d - Sigstore transparency entry: 1776535837
- Sigstore integration time:
-
Permalink:
HizZaniya/ndlocr-lite-mcp@9ed3d5fefe2229b24e5f590e83751eb0039327ff -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/HizZaniya
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ed3d5fefe2229b24e5f590e83751eb0039327ff -
Trigger Event:
release
-
Statement type:
File details
Details for the file ndlocr_lite_mcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ndlocr_lite_mcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e2d72c3321ac8b802ba92cbd643a92b693d31e5afe652d40a527ce03d469e24
|
|
| MD5 |
5d0ce25087feb593435543738b0e48ef
|
|
| BLAKE2b-256 |
519015c3449f1b513537c742f6ba3ed879622fb5c9af9c5af0a7be875246ff40
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ndlocr_lite_mcp-0.2.0-py3-none-any.whl -
Subject digest:
4e2d72c3321ac8b802ba92cbd643a92b693d31e5afe652d40a527ce03d469e24 - Sigstore transparency entry: 1776536020
- Sigstore integration time:
-
Permalink:
HizZaniya/ndlocr-lite-mcp@9ed3d5fefe2229b24e5f590e83751eb0039327ff -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/HizZaniya
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ed3d5fefe2229b24e5f590e83751eb0039327ff -
Trigger Event:
release
-
Statement type: